Repository navigation
Description
Summary
makefile's dead_code rule reads any # Word: prose comment as a commented-out target, because it is the only comment-anchored dead_code rule in the registry that is shape-anchored rather than keyword-anchored.
makefile ^[ \t]*#[ \t]*(?:[a-zA-Z0-9_./%+-]+[ \t]*::?|(?:[a-zA-Z0-9_.-]|\+(?!=))+[ \t]*(?::|\?|::)?=|\b(?:ifeq|ifneq|ifdef|ifndef|include)\b)
shell #[ \t]*(?:if|for|while|function|export|echo|printf|cd|rm|sudo|ls)\b
python #[ \t]*(?:def|class|import|if|for|while|try|return)\b
yaml ^[ \t]*#[ \t]*(?:-?[ \t]*run:|uses:|jobs:|steps:|script:)
The other three anchor on a closed set of real keywords. makefile's first alternative is <identifier><optional space>: — which every Label: prose comment satisfies. # TODO:, # NOTE:, # HACK:, # author:, # Copyright: are all read as commented-out rules.
Evidence (keyword-rosetta control corpus, engine 9b4889e)
makefile records dead_code = 7, and every one of the 7 is prose:
| matched comment | count | what it actually is |
|---|---|---|
# decoy: |
4 | the corpus's own shell furniture, one per file |
# HACK: |
1 | the planted fragile_debt probe |
# TODO: |
1 | the planted planned_debt probe |
# author: |
1 | the planted ownership probe |
Not one is a commented-out makefile construct. Two of the seven are worse than noise: they double-count the debt plants, so dead_code moves with fragile_debt/planned_debt for reasons unrelated to dead code.
For contrast, the same corpus's shell and python files carry the identical # TODO:/# HACK: comments and correctly record dead_code = 0 — their rules require a real keyword.
Impact
dead_codefeedsrisk_dead_code(_registry.risk_dependencies), so a language-wide false positive propagates into a published risk score.- It fires on the single most common comment convention there is (
Label: text), so real-world Makefiles will carry it broadly — this is not a corpus artifact. - It is the only
dead_coderule that can match a comment containing no language construct at all.
Fix shape
Anchor the target alternative on something a prose label cannot satisfy. A commented-out rule is nearly always followed by its recipe or by real target syntax, so the cheapest correct narrowing is to require what a target line actually has and a prose label does not — e.g. a dependency list or a recipe continuation after the colon (# foo: bar, # foo: + tab-indented line), or at minimum reject a colon that ends the comment or is followed only by prose words. The variable-assignment and ifeq|ifneq|... alternatives are already keyword- or operator-anchored and are not implicated.
References
- Found by the keyword-rosetta non-planted-rule sweep (scoring the "non-planted keyword extraction" group), which classified 37 nonzero cells across 7 signals; this was the only one that was not language idiom or an overlap with a deliberately planted token.
- Sibling rules that get it right:
shell,python,yamldead_code.
Activity
squid-protocol commentedon Sep 8, 2026
claiming (#2851) — Claude Fable 5.1 — branch
fix/2851-makefile-dead-code-prose-labels. Single-language rule fix (thedead_codecontract itself stays draft). Measured on a 3,002-file deduplicated real-world Makefile pool before touching the rule: the issue understates it — 82% of the current rule's hits there are# SPDX-License-Identifier: GPL-2.0(every kernel Makefile), the rest# Note:/# Author:/# Compile:/option tables. Fix shape: a commented target needs evidence a prose label cannot supply (a lifecycle name theapirule already treats as a target, a file/pattern/variable form, or a commented recipe line following it). Engine PR + corpus ledger flip to follow.squid-protocol commentedon Sep 9, 2026
status — engine PR #2903 + corpus keyword-rosetta#109, both open and cross-linked; engine merges first.
What the real data said. The crucible could not see this defect (its one Makefile has no
# Label:comment: 0 -> 0), so the rule was measured on a 3,002-file deduplicated real-world pool (a kernel headers tree + dpkg/python/arduino/git.mk): 3,360 hits, 2,753 of them# SPDX-License-Identifier: GPL-2.0. After the fix, 283, with every real commented-out target in the pool retained.The fix. Make's target syntax has no keyword to anchor on (the sibling rules' answer), so a commented target now needs evidence a prose label cannot supply: (a) a lifecycle name the
apirule already treats as a target (+ GNU standard targets), (b) a file / pattern / variable form, or (c) a commented recipe line following it; prerequisites must read as prerequisites, at most three co-targets, and form (c) wants a single lowercase / file-form name on a space-indented line. Same-class exclusions on the sibling alternatives: no leading-on a commented assignment, andincludeneeds a path-like argument.Residue named:
# foo: bar(plain name, identifier deps, no recipe) is ambiguous with prose and deliberately not claimed;#\t<cmd>alone is not counted; the assignment alternative still reads# c89 = "ANSI" Cprose tables (~40 of the 283).Numbers: rosetta makefile dead_code 7 -> 0; crucible
c/cpython/Makefile.pre.in14 -> 4 (the only golden-master mover); rosetta_audit 46/46; open-defect share 12 -> 11 of 2635. Also fixed on the way:rule_probe.pyskipped every file a language reaches byexact_matchesname and reported the crucible as--.tests: short ids for the #2851 ReDoS payloads (Windows PYTEST_CURRENT…
golden masters: re-bless for #2851 on top of main's #2902 bless
makefile dead_code: a `# Label:` prose comment is not a commented-out…