Repository navigation
fix(hydra-gates): step over whole PHP attributes when walking up to a docblock - #900
Open
rubenvdlinde wants to merge 1 commit into
Open
rubenvdlinde wants to merge 1 commit into
rubenvdlinde wants to merge 1 commit into
Conversation
… docblock Seven docblock walks skipped only lines starting with `#[` (some also `]` or `)]`). A multi-line attribute, stacked attributes, or a closing line with a trailing comment stopped the walk, so an existing docblock read as missing. Gate 16 already had a bracket-counting step for one multi-line attribute (#811); it did not handle comments or attributes stacked on one line, and the other six walkers had nothing. php_attributes.attribute_block_start reads the span as PHP: it finds the nearest `#[` line, requires one or more complete attributes (brackets balanced outside strings and comments) with only whitespace or comments after them, and the last one closing on the line the walk is at. All seven walkers (gates 16, 6, 25, 17, 61, 57 and the gate 3 caller-identity arm) use it. Refs ConductionNL/dossiq#5151 Assisted-by: ClaudeCode:claude-opus-5-5
This branch has not been deployed
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.
Seven gates walk up from a method declaration to its docblock and skip PHP attributes on the way by line prefix (
#[, in some also]or)]). That only recognises a one-line attribute. A multi-line attribute, several stacked ones, or a closing line with a trailing comment stops the walk, and an existing docblock reads as missing.dossiq#5151 reported this as a gate 16 false red on
#[McpTool(...)]. On current main, gate 16 does not produce that finding: #811 already steps over one multi-line attribute, and runningcheck_spec_coverage.pyfrom main on the dossiq branch gives# count=0. The lane ran its local diff check against thevendor/copy,conduction/hydra-gatesv1.16.1 (7 Sep), which predates #811. The gap is real all the same. Gate 16 still stopped on attributes stacked on one line and on comments inside or after an attribute, and the other six walkers had no handling at all.What changes
scripts/lib/php_attributes.py.attribute_block_start(lines, end)finds the nearest#[line at or aboveend. It accepts the span only when, read as PHP, it is one or more complete attributes followed by nothing but whitespace or comments, with the last attribute closing on lineend. "Complete" means brackets and parentheses are balanced, with strings (escapes included) and//,#and/* */comments skipped. Anything else returns None, and the caller's walk stops as before.check_spec_coverage, gate 6check_orphan_auth, gate 25check_contract_coverage(both the docblock walk and the auth preamble), gate 17detect-redundant-controllers, gate 61check_listener_placement, gate 57check_orphaned_write_capability, and the gate 3 caller-identity armcheck_caller_identity_exempt.]and)]prefix skips are gone: those lines are now judged structurally.Verified
test_check_spec_coverage.py:#[McpTool(...)]with@specpasses, and without@specstill fails;)]on its own line;)] #[NoCSRFRequired]on one line;//,#and/* */comments;@spec.test_php_attributes.pyruns every walker over the same four shapes, plus a no-docblock control for each. Its reader controls cover an array close, an unclosed attribute, a one-line/** @var int[] */below an attribute, and code after a close.test_php_attributes14,test_check_spec_coverage90,test_check_contract_coverage23,test_check_orphaned_write_capability72,test_check_listener_placement50,test_check_orphan_auth29,test_detect_redundant_controllers10,test_check_stub_run_body20,test_checker_patterns_match_documented_shapes13, andtest_exclusion_reason{,_adjacent}. All exit 0.test_gate16_spec_coverage_scope,test_gate_3_contract_param,test_gate_3_bodiless_declaration,test_gate_3_external_contract_and_tabs,test_gate_3_14_comment_evidence,test_gate_crashed_checker_is_not_a_finding,test_gate_1_11_honest_verdicts,test_gate_or_objectservice_surface.Not handled: an attribute whose closing line is also the declaration line (
)] public function f()), and attributes longer than 200 lines. In both cases the walk stops as it did before.AI disclosure: prepared with Claude Code (Opus 5.5).
🤖 Generated with Claude Code