Skip to content

Commit 1e49e34

Browse files
committed
test(ci): derive AGENTS.md's live numbers instead of trusting a hand-fixed literal
v0.5.26 corrected two stale numbers in AGENTS.md by hand and left them exactly as rot-prone as before -- the [C32] lesson applied to the file that teaches it. Two of these figures had ALREADY rotted (919-chain, 47 = 28+19), so this is the second measured instance, not a hypothetical. test/ci/agents-numbers.test.js derives each live figure from the one committed source that owns it and requires it inside the single line whose label names it: engine version <-> scenarios <-> tests <-> validator checks freeze-record-4.2.6.json + negative-tests.json + state-snapshot.json, with 649 parsed out of the record's own cycleEvidence.nodeValidator rather than retyped freeze pin count and its release/quarantine split the record's sha256 map SelfTest count counted from selftest.tap's 'ok ' lines, not from prose payout i18n dictionary size docs/GOVERNANCE-DASHBOARD.html It also cross-checks the record's cycleEvidence against the artifacts, so the reviewer-facing claim cannot outrun the bytes. 14 negative controls, each red, covering BOTH directions -- the doc rotting (stale count, stale split, a chain trimmed to 2 of 4 values, a duplicate line planted beside the fresh one, an anchor renamed away) and the source rotting so the doc becomes the liar (snapshot count, engine version, a dropped quarantine pin, a record claiming 24 self-test checks against 21 'ok' lines, 19 scenarios against 16). Two more delete the array key and every 'ok' line to prove the guard refuses to derive 0 rather than assert a confident false number -- the [C30] zero-denominator trap, caught live here when a wrong key name made the first draft try to state 0. Also: a cited invariant turned out not to exist. AGENTS.md told two sessions that a hand-edit 'silently breaks the 637/637 node pairing'. Nothing derives or checks 637. The only enforced pairing is test/p2/governance-dashboard-i18n.test.js over PAYOUT_GATE_I18N (11 keys), and the full coreguard-gate41-visual{,-en}.html pair is unverified by machine -- the AR file carries 278 data-i18n attributes, the EN sister carries zero and holds literal English, so no dictionary exists to pair. Both citations corrected and that pair is now labelled unguarded instead of falsely guaranteed. Measured: 1187/1187, 834 files, 0 violations, docs-node 94/55/20.
1 parent 89d25bd commit 1e49e34

4 files changed

Lines changed: 200 additions & 10 deletions

File tree

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ title to jump.
8282
- [C1] **Multi-line plain scalar with `": "` kills the whole workflow (zero jobs)**: a `run:` value written as a plain (non-block) multi-line YAML scalar containing a JS literal like `console.error('health check failed: ...')` — the `": "` inside a plain scalar is unparseable → GitHub marks the run `failure` with **zero jobs built**. That zero-jobs conclusion IS the signature of an unparseable workflow file (not a failing step). Fix: any multi-line `run:` must be a real block scalar (`run: |` on its own line). Trap within the trap: a string-matching "validator" whose `||` fallback jumped to a fake parser reported PASS — only a real YAML parser or GitHub itself building the job proves the file parses (cost a push + a red run). Now enforced mechanically: `test/ci/workflow-yaml-contract.test.js` parses every `.github/workflows` file and the composite action with the real `yaml` parser (dev dep) plus an Actions schema walk — an unparseable or schema-deviant file fails the push locally with file+line naming, before GitHub ever sees it. Runs inside `npm run prepush` too (scripts/pre-push-check.mjs), the mechanical pre-push checklist built from the YAML/workflow lessons: workflows-parse [C1] · freeze-integrity [C2] · pin-eol-cover [C3] · no-skip-ci (the skip-token vortex) · repin-reachable (the rebase rewrite trap) · remote-fresh (the bot race, with the autostash remedy named).
8383
- [C2] **Commit-anchored verification (4.2.6+)**: `validate-freeze.mjs` hashes `git show <gitCommit>:<path>` blobs, not disk bytes. Disk mode (`--disk`) is triage-only, prints "not evidence". Records without `gitCommit` fail COMMIT-UNANCHORED (historical included — correct). Editing a file whose bytes exist only in a future commit requires a **two-phase re-anchor**: commit phase 1, then point `gitCommit`/`postCommitRePins` at that hash in phase 2. Release entries are platform-dir relative; quarantine entries repo-root relative; repo-root files outside the platform dir use `../` prefixes (stripped by `treePath`/`repoRelPath` — the honesty test must mirror this or bare-name pins hash the wrong file).
8484
- [C3] **`git show HEAD:file` ≠ disk ≠ fresh-clone disk**: a pinned file outside every `-text` rule in `.gitattributes` is silently CRLF-rewritten on ANY fresh clone when `core.autocrlf=true` is set (system default on Windows) — the main working tree can hold LF bytes while a reviewer's pristine clone drifts and fails `--disk`. Always prove "clean-clone" claims from an actual fresh clone/`git -c core.autocrlf=false clone`, not from the dev disk. Any file newly pinned in a freeze record (including `../docs/…` — root-level pins outside the three `-text` trees) must be added to `.gitattributes` **and** the RC manifest must be rebuilt from a pristine `autocrlf=false` checkout (`scripts/build-rc-manifest.mjs` reads the disk, so generating on an autocrlf machine pins CRLF hashes that blobs don't match).
85-
- [C4] **Bilingual dashboard i18n architecture (the pattern that works)**: three defects killed the first attempt — (1) swapping only the first text node left Arabic tails around inline children (`.ltr`, badges); (2) the resolver `L()` was scoped inside an IIFE that ran after the views' initial render → `L is not defined` + dead toggle; (3) attr swaps targeted markup markers that didn't exist. The working design: **hoisted global `L()` prelude** at script top reading live language from `window.cgLang` at call time; **full `innerHTML` swap** per `[data-i18n]` element (text + inline children together, no tails); **views re-render on a `cg41:lang` CustomEvent**; dynamic strings stored as `{ar,en}` pairs resolved through `L()`; attrs applied by unique selectors, not markers. Dictionary generated by structural pairing (637/637 nodes) against the EN sister — never hand-maintained.
85+
- [C4] **Bilingual dashboard i18n architecture (the pattern that works)**: three defects killed the first attempt — (1) swapping only the first text node left Arabic tails around inline children (`.ltr`, badges); (2) the resolver `L()` was scoped inside an IIFE that ran after the views' initial render → `L is not defined` + dead toggle; (3) attr swaps targeted markup markers that didn't exist. The working design: **hoisted global `L()` prelude** at script top reading live language from `window.cgLang` at call time; **full `innerHTML` swap** per `[data-i18n]` element (text + inline children together, no tails); **views re-render on a `cg41:lang` CustomEvent**; dynamic strings stored as `{ar,en}` pairs resolved through `L()`; attrs applied by unique selectors, not markers. Dictionary generated by structural pairing (637/637 nodes — **that cycle's figure, historical**: nothing derives or checks it today, and the full-dashboard pairing is not machine-enforced; see the Files-That-Change-Together entry) against the EN sister — never hand-maintained.
8686
- [C5] **i18n dictionary generation trap**: naive text-node pairing undercounts mixed-content elements; generate the dict by lockstep DOM-walk pairing (tag+index paths, EN `printhead` subtree dropped first) and capture full `innerHTML` per element. Verify coverage honestly: every Arabic run in the raw body must land in exactly one slot, and the EN side must contain zero Arabic chars.
8787
- [C6] **Async render loops in review/verification UI**: the classic bug is `if (stateA !== stateB) render()` inside a promise `.then` — inverts to a permanent re-render loop. Fix: capture `target` state at render start, apply with `target` (not live state), and only re-render if live state differs from target. Cost a session to debug in the visual explainer.
8888
- [C7] **postCommitRePins honesty discipline**: every re-pin entry must be honest vs its declared commit — the test catches duplicate/stale entries for the same file (a real CI failure, run 35398048308). Never leave superseded re-pin entries behind. The contract tests read the expected PASS count from the record itself, never hardcoded literals — a frozen `46/46` breaks on every honest pin addition.
@@ -120,9 +120,9 @@ title to jump.
120120
- [C33] A prose restatement of a machine rule loses a branch, and a correct-but-incomplete summary survives review when a wrong one would not: the L1 chain rule has THREE outcomes — no authority `UNKNOWN/NO_CHAIN_EVIDENCE`, authority asked and does not know the hash `MISMATCH/TX_NOT_FOUND`, evidence too malformed to ask with `UNKNOWN/EVIDENCE_INCONSISTENT` — and all four reviewer-facing surfaces compressed it to two ("a format-valid receipt nobody confirmed is UNKNOWN"). Every compressed version was TRUE, which is why it passed review: the branch it dropped is `MISMATCH`, the system's strongest signal, so the summary hid a real contradiction behind its weakest verdict. A one-line rule in the README is a CLAIM about the machine and belongs to the same binding discipline as a number in STATUS.md, so `test/ci/receipt-semantics-doc.test.js` derives the three codes from `verifyReceipt()` at run time and requires each surface to state all three · **in the same paragraph, not the same document**, because the codes occur in several passages and a document-wide substring check stays green when the rule itself is gutted (the [C32] defect recurring inside the guard written to close it). Its controls include a CODE-side mutation (flip the asked-and-contradicted return to `UNKNOWN`), because a doc binding that only inspects docs cannot tell a correct rule from a stale one.
121121
## Files That Change Together
122122

123-
- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 1180 ↔ 649 — the npm test number tracks the latest measured count; every literal here is a measured number, so a green run that disagrees means the number below is stale, not that the run is wrong).
123+
- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 1187 ↔ 649 — the npm test number tracks the latest measured count; every literal here is a measured number, so a green run that disagrees means the number below is stale, not that the run is wrong).
124124
- `freeze-record-4.2.6.json` ↔ any file it pins ↔ `.gitattributes` tree list ↔ README pin-count claim (now 49 = 30+19; README.md's own pin is inside the record it links from). Take the split from the record itself, never from a remembered literal — the "47 = 28+19" figure that stood here for several cycles was two pins stale, and `test/verifier-c/validate-freeze.test.mjs` had the same class of rot frozen into its own header comment (it advertised `46/46` while the record held 49; the assertions were already deriving the number, only the documentation lied). The dashboard's `#payout` section is bilingual per the AGENTS.md i18n pattern: its `test/p2/governance-dashboard-i18n.test.js` contract keeps the EN markup defaults and the AR dictionary structurally paired — edit one side only and the pairing check fails by name.
125-
- Bilingual dashboard pair ↔ AGENTS.md i18n pattern above ↔ the EN mirror (`coreguard-gate41-visual-en.html`) — regenerate the dictionary by structural pairing after ANY structural edit to either file; hand-edits to one side silently break the 637/637 node pairing.
125+
- Bilingual dashboard pair ↔ AGENTS.md i18n pattern above ↔ the EN mirror (`coreguard-gate41-visual-en.html`) — regenerate the dictionary by structural pairing after ANY structural edit to either file. **Correction to an invariant that does not exist: the "637/637 node pairing" cited here for several cycles is dead** — no file, test, or script in the tree derives or checks 637, and the pairing is NOT machine-enforced for the full dashboard. What is actually enforced today is narrow and real: `test/p2/governance-dashboard-i18n.test.js` binds the `PAYOUT_GATE_I18N` dictionary in `docs/GOVERNANCE-DASHBOARD.html` to that section's `data-i18n` markup (**11 keys**, every key present exactly once, no unused keys, EN/AR inline-tag sequences equal, tags balanced, AR values carrying Arabic). The full `coreguard-gate41-visual.html` / `-en.html` pair is unguarded in the pairing sense: the AR file carries 278 `data-i18n` attributes and the EN sister carries **zero** (it holds literal English), so no dictionary exists to pair and nothing would notice a one-sided hand-edit. Treat that pair as **unverified by machine** until a structural-pairing contract lands, and do not cite 637 as a live guarantee.
126126
- `verification/cg-assurance-verify.ps1` self-test count (21) ↔ `selftest.tap` frozen bytes ↔ README/STATUS claims (21/21).
127127
- Commercial surfaces ⇄ snapshot ⇄ `docs/verification-and-integration-platform-2026-09-26.md` §12 ⇄ `docs/commercial-packaging-2026-09-26.md` ⇄ `docs/conformance-report.json` ⇄ `docs/adoption-dashboard.md`: `packages/webhook` (CG-WH/1 receiver) + `packages/x402` (X402/1 gated harness) + `examples/platform-quickstart` + `scripts/ladder/conformance.mjs --write` (CG-CR/1) + `test/integrations/platform-surfaces.test.mjs`. The x402 gate and the CG-CR/1 report both sit in the same push as the snapshot: the report's `badgeIssuerCount` is 0 and the dashboard's revenue is $0, and a price change or an issued badge MUST land with the number, never before it. The packaging doc is machine-checked for cited paths and for any `$` amount other than $0.
128128

0 commit comments

Comments
 (0)