Source: BAD CODE™ journal (.claude/bad_code.md), original entry 2026-06-28, re-verified 2026-08-04.
Status change since the original entry
The 2026-06-28 audit logged xtask/src/main.rs as a 3052-line single file (637 production + ~2400 inline test lines) and recommended splitting both halves. The production half was done; main.rs is now 262 lines with logic in contract_check.rs, goldens.rs, lawpack_goldens.rs, provider_*.rs, release_prep.rs, release_dates.rs, and util.rs.
The test half was not. Current line counts:
| File |
Lines |
xtask/src/tests.rs |
4167 |
xtask/src/lawpack_goldens.rs |
1759 |
xtask/src/goldens.rs |
923 |
xtask/src/main.rs |
262 |
The monolith moved rather than dissolved, and it grew by ~1700 lines.
Smell
One tests.rs covers grammars, TextMate, VS Code manifests, release policy, schema shapes, topic graph, link checks, provider fixtures, and release-date reconciliation. Adding a test means scrolling past unrelated concerns, and the file is a merge-conflict magnet — observed directly on 2026-08-04, where two independent branches both edited it and conflicted.
It also makes review harder in a specific way: tests.rs mixes real-repo assertions with synthetic temp-repo fixtures that reuse the same literal strings. A blanket edit to one can silently corrupt the other.
Recommended mitigation
Move tests into xtask/tests/*.rs integration files or per-module #[cfg(test)] blocks, grouped by the module under test. Keep cargo xtask verify behaviour identical. Consider splitting lawpack_goldens.rs at the same time.
Verification
wc -l xtask/src/*.rs at 528dc312.
Source: BAD CODE™ journal (
.claude/bad_code.md), original entry 2026-06-28, re-verified 2026-08-04.Status change since the original entry
The 2026-06-28 audit logged
xtask/src/main.rsas a 3052-line single file (637 production + ~2400 inline test lines) and recommended splitting both halves. The production half was done;main.rsis now 262 lines with logic incontract_check.rs,goldens.rs,lawpack_goldens.rs,provider_*.rs,release_prep.rs,release_dates.rs, andutil.rs.The test half was not. Current line counts:
xtask/src/tests.rsxtask/src/lawpack_goldens.rsxtask/src/goldens.rsxtask/src/main.rsThe monolith moved rather than dissolved, and it grew by ~1700 lines.
Smell
One
tests.rscovers grammars, TextMate, VS Code manifests, release policy, schema shapes, topic graph, link checks, provider fixtures, and release-date reconciliation. Adding a test means scrolling past unrelated concerns, and the file is a merge-conflict magnet — observed directly on 2026-08-04, where two independent branches both edited it and conflicted.It also makes review harder in a specific way:
tests.rsmixes real-repo assertions with synthetic temp-repo fixtures that reuse the same literal strings. A blanket edit to one can silently corrupt the other.Recommended mitigation
Move tests into
xtask/tests/*.rsintegration files or per-module#[cfg(test)]blocks, grouped by the module under test. Keepcargo xtask verifybehaviour identical. Consider splittinglawpack_goldens.rsat the same time.Verification
wc -l xtask/src/*.rsat528dc312.