Skip to content

v1.26.0 — check 46 doc 02 vs the code, audit 2-5x faster

Choose a tag to compare

@CesarRivasP CesarRivasP released this 07 Nov 00:06
· 17 commits to main since this release
71eeac3

What

Check 46 — doc 02 code blocks vs the tree ([script + human], candidates only, runs once the set is implementing or shipped). A fenced block in a doc whose id starts with 02 that names exactly one repo file (fence info string, or one backticked path on the line above) is compared, on normal form, with that file at the branch the set names (tracking.branch / shipped_in, untracked files from disk). Candidate when its lines no longer appear in it as a contiguous run.

  • Real case: the code gained a guard that the doc never got; whoever rebuilt from the doc reintroduced the bug. Lines in order inside a compact region with a few lines inserted stay a candidate.
  • Doc 02 stays paste-ready: blocks are never replaced by anchors.
  • Skipped: diff/patch, untagged or text/log/console fences, blocks whose line above opens with antes:/before:, the before-part of a block with // antes … // después.
  • Not stale: a block matching, as one contiguous run, another file changes[] declares (the line above named the source of a move); an excerpt of keys in a data/config file. In code, lines present but reordered or spread ARE a candidate.
  • Comment prefixes follow the language (# is code in C/CSS/Rust, -- outside SQL/Lua); a comment that elides (// … body identical to X) splits the block.

Speed — GitTree reads through one git cat-file --batch process; the datum regex is built per doc from the values present; YAML uses the C loader with a pure-parser re-parse on error so line:col messages are unchanged; check 21's id-in-prose regex became a token set. tests/test_perf.py generates a 312 KB / 16-doc / 100-file-on-branch set in a tmp repo, runs the old paths (FEATURE_SPEC_SLOW=1) and the new ones, and asserts byte-identical text, --json and --doc-index, plus identical reports for four broken YAMLs.

Measured

  • Generated set: 54.4 s → 9.6 s (×5.7).
  • Real sets, --json identical between paths: 4.18 → 0.85 s, 3.88 → 1.41 s, 4.12 → 2.53 s, 2.97 → 1.77 s.
  • Check 46 on real sets: 19 → 6 candidates on an implementing set after the false positives found there; 0 on the set of the real case.

Review

Second-model review (Claude Opus) of check 46: five false negatives — a plain comment starting with "before"/"current" switched a block off; the excerpt rule hid reordered and removed lines in code; the changes[] alternative accepted a spread excerpt of an unrelated file; "old"/"current" inside a path or mid-sentence counted as a pre-change marker; #, --, * were dropped as comments in C, CSS, Rust. All fixed; each is a case in tests/fixtures/doc02-code-drift that the previous code missed.

Verification

test_audit.py 356/356 across 71 fixtures; test_perf.py identical on every path; ship, facts, triage, render, sync, new, rotate green.

Release: v1.26.0 (README row and clone pin bumped). Merge with a merge commit.