Skip to content

ci(docs-truth): machine-check R-15 gate status agreement between the contract and the Core Migration Ledger #933

Description

@qnbs

Problem (validated recurrence)

R-15 gate status is maintained by hand in three places that have to agree:

  1. docs/native/R15-SECURE-STORAGE-CONTRACT.md header status line (§0);
  2. the contract's §21 closing status sentence;
  3. docs/native/CORE-MIGRATION-LEDGER.md row 10, both its R15_GATE* tokens and its prose.

Reviewers caught contradictions between them in four consecutive PRs: #917 (cubic), #928 (cubic), #929 (Codex + cubic) and #930 (CodeRabbit + cubic). A typical case: the ledger said "Gates 3–7 not admitted" next to "Gate 3 slice 3A implemented". Every instance cost a correction wave. Learning record: #780 (comment of 2026-10-01).

Root cause

There is no single machine-readable source of gate status, and nothing deterministic compares the three statements. Agreement depends on reviewers noticing.

Scope

  • One canonical, machine-readable R-15 gate status block in the binding contract (one token per gate: NOT_ADMITTED, PARTIAL, IMPLEMENTED_HEADLESS, …).
  • A pure scanR15GateStatusTruth in scripts/check-doc-metrics.mjs (the existing docs:check, which already runs in CI and ci:prepush) that fails when:
    • the ledger's R15_GATE* tokens differ from the contract block (missing, extra or different values);
    • current, non-historical prose in the contract header, §21 or ledger row 10 calls a gate range "not admitted" or "unadmitted" while the block marks a gate in that range as partial or implemented.
  • Unit tests in tests/unit/checkDocMetrics.test.ts for agreement, token mismatch, a missing gate, the range contradiction, and historical sections being ignored.
  • Bring the docs to the canonical state in the same PR.

Non-goals

Acceptance

  • pnpm docs:check fails on each seeded contradiction and passes on the reconciled docs.
  • Unit tests cover every failure mode.
  • The guard runs through the existing docs:check CI path, so no workflow change is needed.
  • Exact-head review/CI converges, followed by resulting-main proof.

Owners

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions