fix: compare opaque fragment identifiers verbatim - #806
Merged
markstory merged 2 commits intoJul 21, 2026
Conversation
`fragment_identifier_matcher` ran both the required identifier and the request URL fragment through `parse_qsl`. For an opaque fragment such as `/users/5` (no `=`), `parse_qsl` returns `[]`, so any two opaque fragments — or a request with no fragment at all — compared equal. A matcher for `#/users/5` therefore matched `#/users/6`, `#section2`, and URLs with no fragment. Only run the order-insensitive `parse_qsl` comparison when the identifier is query-string-style (contains `=`); otherwise compare the fragment strings verbatim. Key=value fragments are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
==========================================
+ Coverage 99.84% 99.90% +0.06%
==========================================
Files 9 9
Lines 3295 3322 +27
==========================================
+ Hits 3290 3319 +29
+ Misses 5 3 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
markstory
approved these changes
Jul 21, 2026
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.
What type of PR is this?
Description
fragment_identifier_matcherran both the required identifier and the requestURL fragment through
parse_qsl. For an opaque fragment such as/users/5(no
=),parse_qslreturns[], so any two opaque fragments — or a requestwith no fragment at all — compared equal. A matcher registered for
#/users/5therefore also matched
#/users/6,#section2, and URLs with no fragment.This only runs the order-insensitive
parse_qslcomparison when the identifieris query-string-style (contains
=); otherwise it compares the fragmentstrings verbatim. Key=value fragments are unaffected.
Related Issues
None.
PR checklist
black/isort/flake8locally (all clean)Added/updated tests?
test_fragment_identifier_matcher_opaquefails onmain(thematcher accepts
#/users/6) and passes with this change; the fulltest_matchers.pysuite stays green.Disclosure: this change was authored by an AI coding agent (Claude Code) on this
account — it found the bug, reproduced it against
main, wrote the failing testfirst, and confirmed key=value fragments are unaffected. The account holder
reviews every change and is accountable for it. Happy to close if it's not
wanted.