Skip to content

fix(detector): has_header_comment steps over the unit's own prototype; rejects trailing-comment tails - #8256

Merged
squid-shepherd[bot] merged 15 commits into
mainfrom
fix/header-comment-misses
Nov 11, 2026
Merged

squid-shepherd[bot] merged 15 commits into
mainfrom
fix/header-comment-misses

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Three precision/recall fixes to has_header_comment (#8240), from the curl hand audit in temporal-crucible#118 (comment-extraction Wave A):

  1. The unit's own prototype is stepped over (once). curl documents UNITTEST functions as doc comment, then forward declaration, then definition, and the walk stopped at the prototype's ;. A ; line is skipped only when it ends a declaration of this unit's name, within 3 lines. Another function's prototype still ends the walk.
  2. A blank line inside an open /* ... */ continues the block. A */ seen below with its /* not yet reached means the blank line is inside the comment. /* Clear the bitset ... + blank line + @unittest 3213 */ was cut down to the one-word tail.
  3. A trailing comment's continuation is not a header. When the line above the block leaves a /* open (#define X (...) /* Room for ... + names. */), the block continues that comment. A closed trailing comment (} /* end of a */) does not block a real header below it.

Measured

curl (pinned 04bfe8fbbf, 4,413 C functions outside tests/docs): 1,196 -> 1,223. All 31 changes were read:

  • 29 gained: all the UNITTEST idiom with a real doc comment.
  • 2 lost: both trailing-comment tails (proto2num under a #define, stub_gss_set_neg_mechs under an #ifdef ... /* MIT Kerberos 1.8+ ...).

Golden: only Has Header Comment changes (148 values, all 0 -> 1):

Verification

  • tests/core_engine/test_detector.py: 4 new header tests (own prototype stepped over, another function's prototype is not, open trailing-comment tail rejected, closed trailing comment does not block, blank line inside the block). 330 passed with test_galaxyscope.py, test_record_keeper.py, test_jcl_positional_comments.py.
  • ruff_audit.py --ci: no new findings; format clean.
  • Bless: golden-lock.sh python tests/tools/crucible_check.py --update --yes.

🤖 Generated with Claude Code

squid-protocol and others added 10 commits November 10, 2026 17:46
…divider false positives

Same /**(?!\*) and (?<!/)///(?!/) guard #8200 put on c/cpp: apex, dart,
groovy, java, javascript, kotlin, objective-c, php, scala, solidity, swift,
typescript, yacc. A /***** box border or //// divider is not a doc block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ount

(?!\*) also rejected Magento-style '/***' docblocks (found on the golden:
Mysql.php's doc count went up as their @var tags counted alone). Reject
only banner shapes: /**** (2+ extra stars) and one-line '/*** x ***/'
boxes. Applied to all 15 /** languages, c/cpp included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#8240 was blessed before #8245 merged, so main's goldens never had both:
with jcl's positional comments, 119 jcl steps now read Has Header Comment
0 -> 1. Plus this PR's own GLTFLoader.js banner drift.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t end in C-family

On curl 39 of 48 dead_code hits were prose: '/* for offsetof() */',
'/* if a request ... (on a file) */', '/* return the position after
%time{} */'. In c/cpp/java/javascript/typescript, if/for/while must be
followed by '(' (their conditions always are); in c/cpp/java a commented
return must end in ';' or return a call directly (#7207's
'// return foo(x)'). curl: 48 -> 9 hits, both real commented-out
statements kept, the rest are commented prototypes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n's stale jcl header drift)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…; rejects trailing-comment tails

From the curl hand audit (temporal-crucible#118): curl documents
UNITTEST functions as comment, forward declaration, definition, and the
walk stopped at the prototype's ';'; a blank line inside a /* */ block cut
the block short; and the wrapped tail of a #define's trailing comment read
as a header. curl C: 1,196 -> 1,223 header comments (29 gained, all the
UNITTEST idiom; 2 lost, both trailing-comment tails).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…header; plus main's stale jcl drift)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol
squid-protocol marked this pull request as ready for review November 11, 2026 01:42
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 5 commits November 10, 2026 21:37
…x/dead-code-control-keyword-shape

# Conflicts:
#	tests/golden_master_audit/12_scan_output_snapshots/gpu_json.json
#	tests/golden_master_zero_dep_audit/12_scan_output_snapshots/gpu_json.json
…-keyword-shape

# Conflicts:
#	tests/golden_master_audit/12_scan_output_snapshots/gpu_json.json
#	tests/golden_master_zero_dep_audit/12_scan_output_snapshots/gpu_json.json
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 11, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

Merged main after #8244 and #8255. Re-bless is a no-op; the golden diff vs main is now only this PR's 29 Has Header Comment gains (16 TS overloads, 12 livecode, 1 cpython) — the 119 JCL rows noted in the description came in with #8244.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 11, 2026 04:09
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit e2a140f into main Nov 11, 2026
66 checks passed
@squid-shepherd
squid-shepherd Bot deleted the fix/header-comment-misses branch November 11, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant