Repository navigation
fix(gates 5, 23, 24): a comment must not spend a window, or invent a gap (#415 class, #423) - #440
Merged
Merged
Conversation
…gap (#415 class, #423) The runner-side half of #423. Same class as the seven checkers in the companion change, three different mechanisms. gate-5 — A DOCBLOCK WAS CHARGED AGAINST AN ATTRIBUTE'S VISIBILITY. `_head_block` takes the union of {the contiguous annotation run, a 20-line slice}. For a MULTI-LINE attribute the run breaks at the `)]` line — it matches none of the five run patterns — so the SLICE is the only thing that can reach the `#[`, and an ordinary docblock between them spends it. Measured on two fixtures differing in NOTHING but the length of that docblock, both carrying a real `#[AuthorizedAdminSetting(\n Application::APP_ID\n)]`: 2 doc lines -> [gate-5] route-auth: PASS 30 doc lines -> [gate-5] route-auth: FAIL — 1 routed method(s) missing auth attribute The attribute is present in both. This is a SECURITY gate telling an author that documenting an endpoint is what made it unsafe, and the cheapest way to clear it is to delete the paragraph. The walk now steps over a multi-line attribute BY STRUCTURE — on a line that closes more brackets than it opens it scans up for the `#[` that opens them, requiring the brackets between to balance — rather than by distance. Same repair `check_contract_coverage` documents at its L208, "WHY THIS IS NOT A LINE WINDOW". It cannot run away: the scan is bounded at 40 lines, it must land on a real `#[` at line start, and the previous-member clamp still cuts the window at the last `}`. The anti-widening pair is the point, and it caught something. On `multiline-attribute-borrow` — the same file plus one unguarded routed method below it — the OLD runner reports FAIL — 2, flagging the genuinely guarded `save` as well as `open`. The new one reports FAIL — 1 and names `open`. So the change removes exactly the false finding and keeps the real one, in the same fixture. gate-23 — THE ONE `grep`-KIND CAPABILITY ROW NEVER READ CODE. A docblock saying *"We deliberately do NOT set a Postgres search_path here — isolation is OpenRegister's job (ADR-022)"* produced `[or-capability:tenant-boundary]` against a file that does exactly what the ADR asks: 1 finding, dropping to 0 once the candidate is re-asked on its code lines. A real `SET search_path` still fires. The PDOK rule in the same file has routed through `_code_lines` since it was written; the capability rows never got it. `grep -rln` stays as the candidate finder. gate-24 — A COMMENT INVENTED A COVERAGE GAP. Both probes deciding `na` vs `structural` were raw greps, so // TODO: one day we could do `new LeafDescriptor(...)` here // We used to call registerIntegration({...}); removed in 2.4 made the gate claim the repo has a server↔JS pair nobody correlated. Not a red gate — a fabricated gap in the arithmetic that decides whether a run's coverage is believed. Measured on the fixture, the runner's own summary: before COVERAGE: 17 of 65 … (17 of 18 applicable gates ran) after COVERAGE: 17 of 65 … (17 of 17 applicable gates ran) and gate-24 is the ONLY verdict that moves in the whole 65-gate run. A real `new LeafDescriptor(` plus a real `registerIntegration(` stays structural. MASKS, NOT NEW STRIPPERS. gate-24 shells out to lib/source_scope.py (`--mask php`, `--mask js-comments`), the same way gate-20 already does; gate-23 reuses its own file's `_code_lines`. A file type with no mask is judged RAW, which is the pre-#423 behaviour and errs towards `structural`, the stricter side — and `.vue` is deliberately in that set, because masking an SFC routes through the `<!-- … -->` handling #424 is repairing and a hole there would let a comment REMOVE a real registration from the count. Same for a mask that fails to run: the raw answer stands. ARMS. gate-5: two new fixtures and four assertions in test_gate_route_auth.sh (37 -> 41). gate-23: two in test_or_abstraction_pdok.sh. gate-24: two in test_gates_23_33_never_green_over_nothing.sh (42 -> 44). With the runner and the linter restored from origin/main, exactly the evidence arms flip — gate-5's "29-line docblock" and "exactly ONE finding", gate-23's "silent: docblock", both of gate-24's — and the controls do not.⚠️ gate-23's first arms were written as `assert_rc` and BOTH passed on the UNFIXED script. The capability rows have their own bake-in epoch, so the suite's forced BLOCK mode never reaches them and WARN mode exits 0 whatever it found: the arm was measuring the epoch, not the finding. They assert the FILE LIST now, and force the capability epoch as a second witness. Agreement between the two arms was the tell.
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.
Closes part of #423 — the false-positive half of the #415 comment class, runner side. Companion PR for the checker side: gates 9, 27, 28, 46, 47, 61, 62.
gate-5 — a docblock was charged against an attribute's visibility
_head_blocktakes the union of {the contiguous annotation run, a 20-line slice}. For a multi-line attribute the run breaks at the closing line, so the slice is the only thing that can reach the opener — and an ordinary docblock between them spends it. Two fixtures differing in nothing but the length of that docblock, both carrying a real three-line#[AuthorizedAdminSetting(...)]:The attribute is present in both. A security gate telling an author that documenting the endpoint is what made it unsafe, whose cheapest remedy is to delete the paragraph.
The walk now steps over a multi-line attribute by structure — on a line that closes more brackets than it opens it scans up for the opener, requiring the brackets between to balance — rather than by distance. The same repair
check_contract_coveragedocuments at its L208, "WHY THIS IS NOT A LINE WINDOW". It is bounded at 40 lines, must land on a real attribute opener at line start, and the previous-member clamp still cuts the window at the last}.The anti-widening pair caught something. On
multiline-attribute-borrow— the same file plus one unguarded routed method below it — the OLD runner reportsFAIL — 2, flagging the genuinely guarded method as well. The new one reportsFAIL — 1and names the unguarded one. The change removes exactly the false finding and keeps the real one, in the same fixture.gate-23 — the one grep-kind capability row never read code
A docblock recording that the class deliberately does not do the thing produced a finding identical to a real one:
or_abstraction_findings=1, dropping to 0 once the candidate is re-asked on its code lines. A real statement still fires. The PDOK rule in the same file has routed through_code_linessince it was written; the capability rows never got it.grep -rlnstays as the candidate finder.gate-24 — a comment invented a coverage gap
Both probes deciding
navsstructuralwere raw greps, so two comments describing registrations that were removed made the gate claim the repo has a server↔JS pair nobody correlated. Not a red gate — a fabricated gap in the arithmetic that decides whether a run's coverage is believed:and gate-24 is the only verdict that moves in the whole 65-gate run. Real registrations stay structural.
Masks, not new strippers
gate-24 shells out to
lib/source_scope.py(--mask php,--mask js-comments), the same way gate-20 already does; gate-23 reuses its own file's_code_lines. A file type with no mask is judged raw — the pre-#423 behaviour, erring towardsstructural, the stricter side — and.vueis deliberately in that set, because masking an SFC routes through the delimiter handling under repair in #424 and a hole there would let a comment remove a real registration from the count. Same for a mask that fails to run: the raw answer stands.Arms
gate-5: two new fixtures, four assertions (suite 37 → 41). gate-23: two assertions. gate-24: two assertions (suite 42 → 44). With the runner and the linter restored from
origin/main, exactly the evidence arms flip and the controls do not.tests/run-helper-suites.sh: 83 passed, 0 failed, 2 quarantined (both pre-existing and documented).🤖 Generated with Claude Code