Hold a capture permission to the rule that carries it - #214
Merged
Merged
Conversation
|
Comprehensive tests clearly validate capture boundaries for marker rules. 🎯 Quality: 94% Elite · 📦 Size: Medium 📈 This month: Your 179th PR — above team average · Averaging Excellent |
A capture permission belongs to a rule, not to the condition that matched. The guard evaluates a rule and reports that the rule matched; it does not record which of the rule's conditions was responsible. So the permissions a rule carries apply to every match of it, whichever condition found one — and a rule that reads both the body and a named parameter, carrying a raw opt-in, attaches a prefix of the body to a match found only in that parameter. The consequence for anyone writing rules is that the source is the boundary: a rule needing the body as evidence reads the body and nothing else, and a rule reading a named parameter needs no raw opt-in because a named value already travels with its detection. Six cases hold that. A rule reading one named parameter reports that parameter as evidence and none of the body. A rule reading the body reports a bounded prefix of it and no value resolved from the request line — the query reaches a detection as key names, which says which fields were present without saying what was in them, and the route carries no query string. A match found past the bound is reported with evidence that does not contain it, because the opt-in bounds what may be shown rather than what may match. `truncated` is what separates that from a rule that matched nothing. Both non-matching cases send a matching request through the same guard, since "nothing was reported" is also what a guard reporting nothing at all looks like. The reporter's own completion signal is awaited rather than approximated with a sleep, and a guard that never calls its callback rejects rather than resolving. Every rule, marker and value in the file is synthetic.
patchstackdave
force-pushed
the
test/marker-family-capture-boundary
branch
from
September 3, 2026 13:20
e3a53f7 to
035f15f
Compare
Contributor
Author
|
/review |
daniloradovic
approved these changes
Sep 3, 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.
A capture permission belongs to a rule, not to the condition that matched.
The guard evaluates a rule and reports that the rule matched; it does not record which of the rule's conditions was responsible. So the permissions a rule carries apply to every match of it, whichever condition found one — and a rule that reads both the body and a named parameter, carrying a raw opt-in, attaches a prefix of the body to a match found only in that parameter.
The consequence for anyone writing rules: the source is the boundary. A rule that needs the body as evidence reads the body and nothing else. A rule reading a named parameter needs no raw opt-in, because a named value already travels with its detection.
What the cases hold
The named case asserts the evidence positively — the parameter's value is what comes back — rather than only that the body is absent, which would pass with named capture broken altogether.
What the query does reach
Key names, as
query_keys: which fields were present, not what was in them. And aroutecarrying no query string. A value would have to come through capture, and a body rule permits none. Both are asserted.A match past the bound
The opt-in bounds what may be shown, not what may match. So a detection arrives whose evidence does not contain what matched, and
truncatedis what separates that from a rule that matched nothing — a reader treating it as a false positive would retire a rule for matching something it was not permitted to show.Test mechanics worth noting
Both non-matching cases send a matching request through the same guard, since "nothing was reported" is also what a guard reporting nothing at all looks like. The reporter's own completion signal is awaited rather than approximated with a sleep, and a guard that never calls its callback rejects rather than resolving a test that never ran.
Scope
This is the generic, rule-scoped capture invariant. It is not an execution gate for any particular rule set: every rule, marker and value here is synthetic, and pinning specific policies belongs wherever those policies are reviewed.
2328 tests pass; typecheck clean.