Skip to content

fix(dead_code): control keywords need '(' and return needs a statement end in C-family - #8255

Merged
squid-shepherd[bot] merged 11 commits into
mainfrom
fix/dead-code-control-keyword-shape
Nov 11, 2026
Merged

squid-shepherd[bot] merged 11 commits into
mainfrom
fix/dead-code-control-keyword-shape

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

dead_code (commented-out code, state_graveyard) was mostly prose on real C. On curl (temporal-crucible#118, comment-extraction Wave A), 39 of its 48 hits were prose:

  • #include <stddef.h> /* for offsetof() */ include notes (33),
  • /* if a "head"-like request is being made (on a file) */,
  • /* return the position after %time{} */.

The cause is the keyword arm of commented_keyword_statement: "keyword, then anything, then a (...) group or {} at the end of the line" reads as statement-shaped.

Fix. Two opt-in keyword classes in the shared helper:

Measured

curl (pinned 04bfe8fbbf, C outside tests/docs): 48 -> 9 hits.

  • Both real commented-out statements are kept: /* while(*p) */, /* j = ERR_R_ASN1_LIB; */.
  • The other 7 are commented prototypes (/* int send(int, char *, int, int); */).
  • All 39 prose hits are gone.

Golden (language-crucible): three files move, and every dropped match is prose:

  • c/micropython/compile.c 5 -> 2: // if both exist, the tuple is above ..., // return its name (the 'f' in "def f(...):").
  • typescript/typescript_compiler/checker.ts 91 -> 86: // if the parameter is used covariantly ..., // for error recovery purposes. ....
  • cpp/godot/rendering_server_default.h 1 -> 0: //if editor is redrawing when it shouldn't, ....

Downstream of those three, these move: Commented Logic Exposure, the directory averages, the hits/risks digests and the LLM brief. File-cluster distances move in the third decimal (state_graveyard is a file-brain feature); no file changes archetype.

Also in this bless: 68 jcl files' Has Header Comment (0 -> 1). That is main's stale golden, not this PR. #8240 was blessed before #8245 merged, so main never had the two together. #8244 carries the same correction; whichever merges second re-blesses.

Should the rule go?

No. It feeds a risk score (Commented Logic Exposure), cognitive load and the file archetype brain, and its recall on real commented-out code is fine. The failure was this one loose shape. temporal-crucible's COM-H3 stays on hold until a re-measure with this fix on main.

Verification

  • test_c_family_dead_code_shape_7207.py now also pins the curl prose cases (negatives) and /* while(*p) */, /* j = ERR_R_ASN1_LIB; */ (positives). The long-line ReDoS test passes.
  • c/cpp/java/javascript/typescript test_<lang>.py + _strict.py and every test file that mentions dead_code: 6,813 passed.
  • keyword-rosetta/tools/verify_language.py c, cpp, java, javascript, typescript: PASS.
  • ruff_audit.py --ci: no new findings; format clean.
  • Bless: golden-lock.sh python tests/tools/crucible_check.py --update --yes.

Size

7 source/test files plus golden parts (over the 5-file guideline): the shared helper, its five callers and one test.

🤖 Generated with Claude Code

squid-protocol and others added 8 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]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 3 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. Re-bless is a no-op; the golden diff vs main is now only this PR's three files (micropython compile.c, checker.ts, godot rendering_server_default.h) — the 119-file JCL drift 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 03:26
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit 295f1e8 into main Nov 11, 2026
70 checks passed
@squid-shepherd
squid-shepherd Bot deleted the fix/dead-code-control-keyword-shape branch November 11, 2026 04:02
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