Skip to content

Replace 2,443 lines of hand-rolled doc guards with declarative consistency checking #485

Description

@BaseInfinity

The problem, measured

tests/test-doc-consistency.sh is 2,443 lines and 170 test functions. A large fraction encode one pattern: "this value must be stated consistently across the shipped files."

Written out by hand, per value, per file. Examples currently in the tree:

  • test_ai_setup_lanes_reviewer_is_gpt56
  • test_readme_reviewer_is_gpt56
  • test_wizard_doc_reviewer_is_gpt56
  • test_skill_files_reviewer_is_gpt56
  • test_agents_md_reviewer_is_gpt56
  • test_claude_md_reviewer_is_gpt56

Six functions, one fact. The same shape repeats for Sonnet 5's default effort, Opus 1M framing, model-pin recommendations, and now driver and reviewer effort.

Why this is worth fixing, with tonight's evidence

Changing one value — the Opus 5 driver effort default from xhigh to high/medium — took three cross-model review rounds and produced nine separate contradictions across shipped files. Every round followed the same script: fix the files I remembered, add or update an anchor guard, declare it done, reviewer finds more.

The reviewer's diagnosis was exact: "The guard passes because it does not cover this file."

That is not carelessness that better attention fixes. A guard enumerating locations cannot detect a location nobody enumerated. The ninth instance was found only after the guard was widened to scan all shipped files for the assertion shape rather than checking a list of anchors — and it found one that two independent reviewers had missed.

Same class of defect as ROADMAP #495 (the reviewer-effort denylist arms race) and #490 (tests asserting text rather than behaviour). Three symptoms, one cause: the check is written per-incident instead of per-property.

Proposed shape

A declarative manifest of shipped facts plus one generic checker. Roughly:

- fact: reviewer_model
  must_say: ["GPT-5.6", "Sol"]
  must_not_say: ["GPT-5.5", "GPT-5.4"]
  scope: shipped            # resolved from `npm pack --dry-run`, not `files`
  except: [historical-citation-markers]

- fact: driver_effort_default
  must_say: ["`high`", "`medium`"]
  must_not_assert: "Opus 5 .{0,40}`xhigh`"
  allow_qualified: ["escalat", "planner", "not the default"]

Adding a new invariant becomes a data change, not thirty lines of bash. Changing a value becomes editing one row and watching every offending file fail at once, rather than discovering them across three review rounds.

Requirements, drawn from what actually bit us

  1. Scope must be derived, not listed. npm pack --dry-run, not package.json's files — README ships despite being absent from files, and that omission directly caused a missed contradiction tonight.
  2. Must distinguish assertion from mention. Documenting a change necessarily mentions the old value. xhigh appearing is fine; "Opus 5 defaults to xhigh" is not. Historical citations (the GPT-5.4 benchmark audit) must survive untouched — there are already guards specifically protecting them.
  3. Must fail loudly on unknown constructs rather than silently skipping, per the lesson in AGENTS.md Code Review Rule 2.
  4. Must be mutation-tested. Reintroduce each invariant's violation and confirm it fails. Non-negotiable given this repo's history of vacuous guards.

Explicitly NOT proposed

Deleting the existing 170 tests wholesale. Many encode genuinely bespoke logic — byte ceilings, drift between skill copies, workflow structure — that does not fit this pattern. Migrate only the value-consistency subset, and count it first rather than trusting this issue's estimate.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimpact:repo-onlyOutside package.json files (npm pack --dry-run) — reaches only us

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions