Skip to content

fix(comments): scope C-family docstrings, attribute function comment signals, and guard C/C++ doc banners - #8200

Merged
squid-shepherd[bot] merged 5 commits into
mainfrom
fix/comment-extraction-pipeline
Nov 10, 2026
Merged

squid-shepherd[bot] merged 5 commits into
mainfrom
fix/comment-extraction-pipeline

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR stacks three fixes addressing comment-extraction accuracy discovered during the temporal-crucible comment-extraction assessment:

  1. fix(detector): scope docstring harvest-above prefixes and attribute comment signals to function hit_vector (1e6ae21a8)

    • In _extract_documentation_tether (gitgalaxy/core/detector.py), scope the harvest-above comment prefixes for standard_block and recursive_block languages to ("//", "/*", "*", "///") (plus "#" for php) and above_suffixes = ("*/",). Previously, "#" was included globally, causing C/C++/Objective-C/C# preprocessor directives (#include, #ifdef, #endif, #define) immediately above a function signature to be harvested as its docstring.
    • In splice (gitgalaxy/core/detector.py), run the 6 comment-surface rules (dead_code, doc, ownership, planned_debt, fragile_debt, spec_exposure) against positional_comment_stream and attribute line-matched hits within [start_line, end_line] (or [start_line - _DOC_ANCHOR_LINES_ABOVE, end_line] for doc) into each function's hit_vector after _calculate_block_metrics computes keyword_density (preserving 100% function archetype neutrality).
  2. fix(c): guard doc rule against ASCII star-banner and slash-divider false positives (3295a1fa1)

    • In gitgalaxy/standards/language_standards/languages/c.py, tighten the doc rule pattern from /\*\* to /\*\*(?!\*) and /// to (?<!/)///(?!/) so ASCII box borders (/***********...) and slash dividers (////...) do not register as Doxygen documentation comments.
  3. fix(cpp): guard doc rule against ASCII star-banner and slash-divider false positives (c54e1f498)

    • In gitgalaxy/standards/language_standards/languages/cpp.py, apply the same /\*\*(?!\*) and (?<!/)///(?!/) lookaround guards to the C++ doc rule.

Golden Master Bless Scope

  • c (hit_vector[doc]): Removed 38 false-positive doc hits across 6 files caused by /******... ASCII banner comments:
    • c/sqlite/lemon.c: 23 -> 0
    • c/cpython/dictobject.c: 5 -> 0
    • c/cpython/gc.c: 2 -> 0
    • c/cpython/object.c: 1 -> 0
    • c/micropython/compile.c: 2 -> 0
    • c/micropython/objtype.c: 5 -> 0
  • cpp (hit_vector[doc]): Removed 52 false-positive doc hits across 13 cpp/godot/*.{cpp,h} files caused by /******... section banners:
    • cpp/godot/editor_node.cpp: 4 -> 0
    • cpp/godot/editor_node.h: 4 -> 0
    • cpp/godot/gdscript_vm.cpp: 4 -> 0
    • cpp/godot/main.cpp: 10 -> 6
    • cpp/godot/main.h: 4 -> 0
    • cpp/godot/node.cpp: 9 -> 1
    • cpp/godot/node.h: 8 -> 4
    • cpp/godot/object.cpp: 4 -> 0
    • cpp/godot/object.h: 10 -> 6
    • cpp/godot/rendering_server_default.cpp: 4 -> 0
    • cpp/godot/rendering_server_default.h: 4 -> 0
    • cpp/godot/variant.cpp: 4 -> 0
    • cpp/godot/variant.h: 4 -> 0
  • function_data (graph_sqlite & gpu_json): Function-level comment signal columns (state_graveyard, def_doc, def_ownership, state_planned_debt, state_fragile_debt, def_spec_exposure) are now populated from positional_comment_stream instead of remaining unconditionally 0, and C-family docstring fields no longer include #include/#ifdef/#endif lines.

Verification

  • pytest tests/core_engine/test_detector.py tests/extraction/languages/test_c_strict.py tests/extraction/languages/test_cpp_strict.py
  • python3 ../keyword-rosetta/tools/verify_language.py c (88/88 assertions passed)
  • python3 ../keyword-rosetta/tools/verify_language.py cpp (88/88 assertions passed)
  • python3 tests/tools/audit_check.py (all 5 gates passed: ruff, mypy, dead-key, doc-refs, ast-accuracy)
  • python3 tests/tools/crucible_check.py (0 diffs)

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

The function-grain comment pass calls re.finditer on the stream outside the
doc pass's try, so a stubbed Prism (test_galaxyscope's worker tests) crashed
the whole splice. Fixes test_worker_amplifies_active_hemorrhage_post_hoc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 10, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 10, 2026 22:45
@squid-shepherd
squid-shepherd Bot merged commit 313ca6a into main Nov 10, 2026
72 checks passed
@squid-shepherd
squid-shepherd Bot deleted the fix/comment-extraction-pipeline branch November 10, 2026 22:45
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

squid-protocol added a commit that referenced this pull request Nov 10, 2026
…comments count

Found on a real curl scan: 93 C docstrings still carried '#endif /* X */'
lines (they end in */, so the #8200 prefix scope let them through); now 0.
A two-word explanation ('/* Compress 512 bits */') is a header comment;
one-word banners still are not. Golden drift: 923 Has Header Comment
flips and 3 C function docstrings (cpython dictobject.c/object.c,
gnucobol numeric.c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 11, 2026
jcl contributed a blank positional stream ('moot: no doc rule'), but the
stream now also feeds the function-grain comment rules (#8200) and header
comments (#8240): every jcl step read as uncommented. Keep each //* comment
statement at its line (JES3 verbs excluded, as _strip_jcl_comments does).

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 11, 2026
…cumented (#8240)

* fix(detector): scope docstring harvest-above prefixes and attribute comment signals to function hit_vector

* fix(c): guard doc rule against ASCII star-banner and slash-divider false positives

* fix(cpp): guard doc rule against ASCII star-banner and slash-divider false positives

* test(golden): re-bless snapshots after rebase onto main

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

* feat(detector): has_header_comment, the non-scored companion to is_documented

Traditional C documents functions with plain /* ... */ blocks, which
is_documented (Doxygen-anchored, D3) never sees: on language-crucible's C
files it marks 1 of 1,732 functions. has_header_comment records any
explanatory comment block directly above a unit (license headers,
dividers, one-word banners and commented-out code rejected) as its own
function_data column. It is not a risk_documentation input; contract §8
says why and what it measures.

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

* test(golden): bless the per-function Has Header Comment field

Only change: the new key in 5. Function Analysis (both fixtures identical
with it removed); true on 10,357 of 52,763 units.

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

* fix(detector): read a non-str positional comment stream as empty

The function-grain comment pass calls re.finditer on the stream outside the
doc pass's try, so a stubbed Prism (test_galaxyscope's worker tests) crashed
the whole splice. Fixes test_worker_amplifies_active_hemorrhage_post_hoc.

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

* fix(detector): stop C docstring harvest at directives; 2-word header comments count

Found on a real curl scan: 93 C docstrings still carried '#endif /* X */'
lines (they end in */, so the #8200 prefix scope let them through); now 0.
A two-word explanation ('/* Compress 512 bits */') is a header comment;
one-word banners still are not. Golden drift: 923 Has Header Comment
flips and 3 C function docstrings (cpython dictobject.c/object.c,
gnucobol numeric.c).

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

* test(golden): re-bless graph snapshot after merging main

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

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 11, 2026
…locks (#8244)

* fix(doc): guard 13 languages' doc rule against star-banner and slash-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]>

* fix(doc): narrow the banner guard so /*** + newline docblocks still count

(?!\*) 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]>

* test(golden): bless the banner guard (threejs GLTFLoader.js: 67 -> 58 doc blocks)

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

* style: ruff format the widened doc rules (patterns unchanged)

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

* test(golden): re-bless after merging main (#8240 + #8245 together)

#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]>

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
squid-protocol added a commit that referenced this pull request Nov 11, 2026
…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]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 11, 2026
…t end in C-family (#8255)

* fix(doc): guard 13 languages' doc rule against star-banner and slash-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]>

* fix(doc): narrow the banner guard so /*** + newline docblocks still count

(?!\*) 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]>

* test(golden): bless the banner guard (threejs GLTFLoader.js: 67 -> 58 doc blocks)

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

* style: ruff format the widened doc rules (patterns unchanged)

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

* test(golden): re-bless after merging main (#8240 + #8245 together)

#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]>

* fix(dead_code): control keywords need '(' and return needs a statement 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]>

* test(golden): bless the dead_code shape fix (3 corpus files; plus main's stale jcl header drift)

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

* test(golden): re-bless after merging #8244 (derived gpu digest only)

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

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
squid-shepherd Bot pushed a commit that referenced this pull request Nov 11, 2026
…; rejects trailing-comment tails (#8256)

* fix(doc): guard 13 languages' doc rule against star-banner and slash-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]>

* fix(doc): narrow the banner guard so /*** + newline docblocks still count

(?!\*) 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]>

* test(golden): bless the banner guard (threejs GLTFLoader.js: 67 -> 58 doc blocks)

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

* style: ruff format the widened doc rules (patterns unchanged)

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

* test(golden): re-bless after merging main (#8240 + #8245 together)

#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]>

* fix(dead_code): control keywords need '(' and return needs a statement 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]>

* test(golden): bless the dead_code shape fix (3 corpus files; plus main's stale jcl header drift)

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

* fix(detector): has_header_comment steps over the unit's own prototype; 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]>

* test(golden): bless the header-comment fixes (29 corpus units gain a header; plus main's stale jcl drift)

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

* test(golden): re-bless after merging #8244 (derived gpu digest only)

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

---------

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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