Skip to content

Refactor handler matching and validate command entity bounds - #304

Merged
negasus merged 1 commit into
mainfrom
fix/pr-222-handlers
Oct 4, 2026
Merged

negasus merged 1 commit into
mainfrom
fix/pr-222-handlers

Conversation

@negasus

@negasus negasus commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

This replaces the complex handler matching function with separate update extraction and matching helpers, incorporating the refactoring and tests from #222. Invalid command entities are skipped without panics, integer overflow, or false matches against an empty pattern. Missing update data uses a success flag instead of allocating an error.

The public API and existing matching behavior for valid input remain unchanged. The existing UTF-16 entity-offset issue is left for a separate fix. Credit for the original refactoring is preserved in the commit's co-author trailer.

Validation:

  • Tests passed for all packages and examples, plus race checks for the bot and models packages.
  • Handler statement coverage remains 100%.
  • Comparison against the previous implementation passed for 2,625 input combinations.
  • New lint findings: none. Full local lint reports 16 findings in unchanged files.
  • Skipping handlers with missing update data allocates zero bytes.

Supersedes #222.

Apply the handler decomposition and tests from PR #222. Return success flags from private extraction helpers, avoid allocations for absent update data, and reject invalid command bounds without overflow or empty-pattern matches.

Co-authored-by: Ivan Kalashnikov <ivank.public@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.45%. Comparing base (6fd12c4) to head (36b648f).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
+ Coverage   55.81%   56.45%   +0.64%     
==========================================
  Files          34       34              
  Lines        2917     2942      +25     
==========================================
+ Hits         1628     1661      +33     
+ Misses       1240     1236       -4     
+ Partials       49       45       -4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@negasus
negasus merged commit 40e0021 into main Oct 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants