Skip to content

test(span-anchor): count #[attr] lines and trailing-comment return types as part of the declaration - #3551

Merged
squid-protocol merged 1 commit into
mainfrom
claude/festive-fermat-kojuy7
Sep 25, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
claude/festive-fermat-kojuy7

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Follow-up to #3547. This fix was pushed to that branch after it had been squash-merged, so it never reached main.

The first CI run of the span-anchor gate listed sample units, and they showed two false positives in span_anchor_audit.py's rule:

  • PHP 8 attributes: #[\Override] lines were read as # hash comments. So #[\Override] public function groupBy(...) counted as mis-anchored (laravel Collection.php).
  • C return types with a trailing comment: int /* Return 1 on mismatch, else 0 */ on the line above cob_read_dict(...) was read as ending a construct, because the line ends in */ (gnucobol fileio.c).

Fix:

  • A line starting with #[ is an attribute, never a comment.
  • Trailing /* … */ and // … comments are stripped before the "ends a previous construct" test. That test now looks only at {, }, , and ;. Pure comment lines are still filler.

Baseline regenerated with span_anchor_audit.py --regenerate: PHP 22.1% → 21.9%, C 0.1% → 0%. Every other language is unchanged: TypeScript 18.1%, JavaScript 0.4%, the rest 0. Both shapes are pinned in test_span_anchor_audit.py.

Type of change

  • Docs, tooling, or CI only

CI checklist

  • pytest tests/tools/test_span_anchor_audit.py: 4 passed, run from /tmp via python -m pytest.
  • ruff format / ruff audit clean.

Verification

$ python tests/tools/span_anchor_audit.py --regenerate --samples 3   -- 50 languages; php 21.9%, typescript 18.1%, javascript 0.4%, others 0
$ python -m pytest tests/tools/test_span_anchor_audit.py            -- 4 passed

graph-accuracy-audit.yml runs on this PR, because it touches the tool and the baseline.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q


Generated by Claude Code

…uct ends

CI's samples showed two false positives: PHP 8 attributes (#[\Override])
read as hash comments, and C return-type lines with a trailing comment
(`int /* Return 1 on mismatch */`) read as ending in */. Baseline
regenerated: php 22.1% -> 21.9%, c 0.1% -> 0%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit f0b435a into main Sep 25, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the claude/festive-fermat-kojuy7 branch September 25, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants