Refactor handler matching and validate command entity bounds - #304
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Supersedes #222.