Second half of the shelved 2026-08-20 cleanliness batch. Same rule as #230: one
commit per item, corpus per commit, because the corpus is their only real net.
Highest confidence-per-line item in the whole audit.
parsers/config_parser.rs:54-108 fragment_json is a byte-for-byte copy of
split_at_top_level_pattern (:110-163) sitting six lines below it, differing
only in that it spells JSON_TOP_LEVEL_KEY where the generic takes pattern.
Diffed line by line: 55-58 = 111-114, 60-66 = 116-121, 68-70 = 123-125,
72-102 = 127-157 (31 lines identical), 104-107 = 159-162. It reduces to one
call. Then fragment_yaml/fragment_toml/fragment_json are three 3-line
wrappers with one call site each — inline them into the match at :37-42.
−63 on a 193-line file. Found independently by two agents.
| item |
Δ |
tree_sitter_strategy.rs:30-778 LANG_CONFIGS — 749 lines, 76 entries, 39 unique shapes (cpp's 8 node types re-typed for 10 extensions, bash x4, six languages x3). extension: &str -> extensions: &[&str]; first-occurrence order preserved so find_lang_config is unchanged |
−346 |
the 7-parameter walker: try_container_split/handle_definition_node/extract_definitions/recurse_children thread the same 7 values — 47 declaration lines + 84 argument lines. A struct Walk<'a> makes every call one line |
−110 |
LANGUAGE_CACHE (:941-1068) — 39 of its 128 lines are blank separators; de-blanking is free |
−78 |
config_parser.rs clone (above) |
−63 |
smaller: shared make_fragment, a children() iterator, decorated_definition_kind/unwrap_decorated sharing one loop, file_extension_lower defined 3x |
−114 |
config/weights.rs:182-366 LANG_WEIGHTS — 18 entries as 10-line struct literals while the same file already uses EdgeWeightConfig::new(0.50, 0.70) one-liners for 130+ entries 160 lines above |
−159 |
config/edge_weights.rs — 14x (struct + impl Default + Lazy) -> const |
−100 |
Two traps, both established by the adversarial round, both cheap to trip.
config/ -> const is only safe for edge_weights.rs and weights.rs.
Eight other config modules read env vars inside the initializer; turning
those into consts silently removes a documented Tier-3 override, and one of
them is cited in CHANGELOG.md:196 behind a published measurement. The "4
dead env knobs" from the first-round audit fall in this category and should
not be deleted.
- Deriving
LANG_CONFIGS extensions from languages.rs:EXTENSION_TO_LANGUAGE
is Q-class, not a bigger win: it newly routes .php3/.php4/.php5/.php7/.phps
to php and .bst/.dtx to latex. NODE_TYPE_KEYWORDS (:780-900) is already
the right shape — leave it.
Also do not touch config/category_weights.rs in this pass: its 10 all-1.0
fields look like dead identity code, but paper/v2 names that surface as its
highest-leverage open item, so deleting it removes a declared research lever
rather than dead weight.
Protocol: ANALYSIS_code_cleanliness_refactoring.md §3, §5, R2.2 rows 10-11,
29-30, and R3 for the env-in-initializer refutation.
Second half of the shelved 2026-08-20 cleanliness batch. Same rule as #230: one
commit per item, corpus per commit, because the corpus is their only real net.
Highest confidence-per-line item in the whole audit.
parsers/config_parser.rs:54-108fragment_jsonis a byte-for-byte copy ofsplit_at_top_level_pattern(:110-163) sitting six lines below it, differingonly in that it spells
JSON_TOP_LEVEL_KEYwhere the generic takespattern.Diffed line by line: 55-58 = 111-114, 60-66 = 116-121, 68-70 = 123-125,
72-102 = 127-157 (31 lines identical), 104-107 = 159-162. It reduces to one
call. Then
fragment_yaml/fragment_toml/fragment_jsonare three 3-linewrappers with one call site each — inline them into the match at
:37-42.−63 on a 193-line file. Found independently by two agents.
tree_sitter_strategy.rs:30-778LANG_CONFIGS— 749 lines, 76 entries, 39 unique shapes (cpp's 8 node types re-typed for 10 extensions,bashx4, six languages x3).extension: &str->extensions: &[&str]; first-occurrence order preserved sofind_lang_configis unchangedtry_container_split/handle_definition_node/extract_definitions/recurse_childrenthread the same 7 values — 47 declaration lines + 84 argument lines. Astruct Walk<'a>makes every call one lineLANGUAGE_CACHE(:941-1068) — 39 of its 128 lines are blank separators; de-blanking is freeconfig_parser.rsclone (above)make_fragment, achildren()iterator,decorated_definition_kind/unwrap_decoratedsharing one loop,file_extension_lowerdefined 3xconfig/weights.rs:182-366LANG_WEIGHTS— 18 entries as 10-line struct literals while the same file already usesEdgeWeightConfig::new(0.50, 0.70)one-liners for 130+ entries 160 lines aboveconfig/edge_weights.rs— 14x (struct +impl Default+Lazy) ->constTwo traps, both established by the adversarial round, both cheap to trip.
config/->constis only safe foredge_weights.rsandweights.rs.Eight other config modules read env vars inside the initializer; turning
those into consts silently removes a documented Tier-3 override, and one of
them is cited in
CHANGELOG.md:196behind a published measurement. The "4dead env knobs" from the first-round audit fall in this category and should
not be deleted.
LANG_CONFIGSextensions fromlanguages.rs:EXTENSION_TO_LANGUAGEis Q-class, not a bigger win: it newly routes
.php3/.php4/.php5/.php7/.phpsto php and
.bst/.dtxto latex.NODE_TYPE_KEYWORDS(:780-900) is alreadythe right shape — leave it.
Also do not touch
config/category_weights.rsin this pass: its 10 all-1.0fields look like dead identity code, but
paper/v2names that surface as itshighest-leverage open item, so deleting it removes a declared research lever
rather than dead weight.
Protocol:
ANALYSIS_code_cleanliness_refactoring.md§3, §5, R2.2 rows 10-11,29-30, and R3 for the env-in-initializer refutation.