Skip to content

Commit 21201bc

Browse files
docs(agents): [C26] third recurrence — a nominal permission is not sight; close the 404 by construction, snapshot 1204/1204
- [C26] STATUS paragraph: the guard shipped pages: read and STILL went blind (404 to a proven-scoped token, PINNED BOTH TIMES marker present in the same run log). The closure is architectural: builds-list read (200+[] = honest empty), SITE_REQUIRED turns any 404 into fail-closed deferral, and the workflow contract bites any invocation without it. Lesson recorded. - state synced to 1204/1204 (full suite green, exit 0, measured at fec7680): snapshot gitCommit refreshed, live STATUS row + AGENTS counter + adoption dashboard test-suite column all at 1204. Historical v0.5.29 row untouched. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent ed27d27 commit 21201bc

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎AGENTS.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ title to jump.
110110
- [C26] **The Pages API has a registration gap — pin every settle to the SHA whose build must finish**: timing evidence (DDE Evidence Cycle 14–21 s; bot commits ~15–20 s after content pushes) showed the trend step's `pages-settle` check ran while the CONTENT commit's build was not yet registered in `/pages/builds/latest` — which still reported the PREVIOUS commit's terminal, aged build — so the guard authorized exactly the push that CANCELLED the content build. That is the recurring "bot race" (15+ autostash treatments; [C18]'s three layers never addressed the gap itself). The fix: `PAGES_SETTLE_SHA=<sha>` pins the settle — the guard settles ONLY when the latest build IS that commit's and is terminal+aged. State logic: (1) build absent + SHA on the remote branch (compare `behind`/`identical`) → registration gap → WAIT; (2) build absent + SHA NOT on the remote → pre-push semantics (the push has not landed; nothing alive to cancel) → settle; (3) latest build is a DIFFERENT commit → same two-way probe (pre-push settles immediately; bot side waits). Probe failure degrades conservatively to wait. Callers: `.githooks/pre-push` passes the NEW main tip from the ref line (all-zero/empty ⇒ unpinned legacy behavior — deletion is nothing to settle); the dde.yml trend step pins the CONTENT commit and defers the median without an autostash when the content build cannot settle. CAUTION learned in production: at the settle call site HEAD is STILL the content commit (the median commit is created only after settle succeeds) — pinning `HEAD~1` there silently re-opened the race for two cycles (the wrong SHA answered "not on branch" and short-circuited the guard) until the pages-build list exposed the returning cancelled pattern; verify the pinned identity from the actual ref state, never from an assumption about what HEAD means at that point in the script. Lesson twice over: a timing-derived "age" guard proves only that SOME build finished — identity, not age, is what a cancel races on; and the first settle design conflated the two sides of the wire (pre-push vs bot) until a test froze each side's semantics separately.
111111

112112
**STATUS (second recurrence, root-caused while monitoring two post-fix cycles, 2026-09-27): the fix shipped with a BLIND guard, and the race never actually closed.** `dde.yml` granted its token `contents: write` only, and the Pages builds API answers a bare **404** to a token without `pages: read` — which `readLatest` maps to `{none:true}` → the SHA pin never got a chance to wait for anything: every cycle settled `no-build-yet` at `waitedMs: 0` (both settle calls, printed verbatim in the DDE run log) and the median push landed blind ~15–19 s after the content push, killing its build. The observed signature CHANGED shape, which is why it hid: old world `cancelled` workflow runs + alternation; blind world green runs, medians recorded every cycle, and `errored` on every content SHA. **A settle that reports "no build yet" while the Pages API demonstrably holds builds means the token cannot SEE, not that the queue is empty — treat any `no-build-yet` at `waitedMs: 0` from a caller with settle stakes as blind-guard until the caller's token is proven to read the API.** Fix: `pages: read` in `dde.yml` + `test/ci/workflow-yaml-contract.test.js` fails any pages-settle caller lacking `pages: read` or leaving ANY settle call unpinned (negative-controlled: flipping the permission to `pages: none` and unpinning one call each turned the contract red, by name). The settle pipeline is now TWO HEAD-pinned calls (pre-commit wait + pre-push confirmation) — with restored sight, an UNPINNED first call would see the content build in flight and defer the median EVERY cycle (trend starvation, the mirror failure of the blind push). Whether the cancellation pattern is truly dead is a wire claim only post-fix cycles can prove — do not re-declare victory from the fix diff alone.
113+
114+
**STATUS (third recurrence, closed by construction while monitoring the post-fix cycles, 2026-09-28): the guard gained its eyes and STILL went blind — a nominal permission is not sight.** The next run log proves dde.yml shipped `pages: read` (the "PINNED BOTH TIMES" markers present, the token's scopes printed in Set up job) and the Pages API STILL answered 404 to that very token — a platform-side gap no fix diff can see from inside, so the settle once more reported `no-build-yet` at `waitedMs: 0` while a full local `gh` token read the same endpoint at 200. The closure is therefore architectural, not another grant: `/latest` cannot distinguish "no site yet" from "cannot read" (both bare 404), so `readLatest` moved to the builds **list** (`/pages/builds?per_page=1`), where `200 + []` is an honest empty, and `PAGES_SETTLE_SITE_REQUIRED=1` (on both pinned calls, contract-enforced) turns any 404 into `api-unavailable-no-read` exit 1 — the caller fails its check, tags nothing, pushes no median, and a cancelled content build becomes structurally impossible in BOTH platform worlds, at the sole cost of deferral warnings. Three mutations now carry the lesson: `isTokenReadFailure` (401/403/404 → fail-closed), the truthful-empty list read, and the workflow contract biting any settle invocation without SITE_REQUIRED (negative-controlled by mutation, same battery). Lesson: **a 404 is a claim about the observer, never about the queue — close it by changing what the code can distinguish, not by granting the same permission twice; and the wire proof is exactly two outcomes, a true `settled` from a readable queue or a fail-closed deferral — anything else from this workflow is an unproven token, per the second-recurrence rule above.**
113115
- [C27] **Identity comes from the wire, never from a header — and any verifier that can drift between two channels must be pinned to one**: three separate cycles this period converged on a single failure class, which is the trust architecture investors and integrators are actually buying. (1) **Wire identity**: the E2E proxy topology proved a peer's identity is its SOCKET address — a stranger can forge `X-Forwarded-For: ::1` verbatim (even claiming the allowlisted proxy's own identity) and still gets 403, because allowlist and rate-limit decisions key on the socket, and forwarded headers are LOGGING data, never identity. (2) **Verifier drift**: a settle guard that measured AGE ("some build finished") authorized a cancel that races on IDENTITY ("that commit's build") — fixed by pinning every settle caller to the SHA whose build must finish. Same class in-page: the cross-link contracts statically assert literal hrefs, but the page BUILT them at runtime from a template variable — verifier and source of truth lived on different channels, so the assertion failed until the page source itself was made literal (fix the artifact, never loosen the check). (3) **Why this is the product**: CoreGuard's whole pitch to a funder or an integrating company is that every claim is mechanically checkable and every check is drift-proof — evidence pinned by hash (C2), identity keyed on the wire (this entry), verdicts bound to exact bytes (C12), and contracts that fail the push when prose and code diverge. The general rule: whenever a verifier and the thing it verifies can disagree (two channels, two moments, two transports), pin them to ONE channel and make the artifact carry the proof — and when tempted to relax an assertion to match reality, treat that as the signal that the ARTIFACT is lying, not the test.
114116
- [C28] **Democracy-for-numbers: a count is only authoritative when a clean clone reproduces it, and a measurement read as green can be empty**: this session built the canonical measured-state machinery after the owner mandated real numbers before any campaign. Two traps surfaced. **Trap 1 (disk vs committed tree)**: the boundary audit counted files on the DEV disk — my checkout carried ~252 local untracked/ignored files, so it certified 1016 files while a reviewer clone sees 764; every number claimed from disk writes is not reproducible on another machine. Fix: `scripts/current-state.mjs` reports `filesScanned` from `git ls-files` (same exclusions as the audit) — the count a fresh clone reproduces — while the audit still scans disk for content checks. **Trap 2 (nested `node --test`)**: measuring the docs-node contract by spawning `node --test` from inside a test file made the runner print "recursively within a test file — skipping running files" and exit **0 with no summary**; a check that only looks at exit code reads that as a green, empty measurement (the machine-verification version of a filter miss [AGENTS tooling quirk]). Fix: `delete process.env.NODE_TEST_CONTEXT` in the child env. **Trap 3 (Node 18)**: `import.meta.dirname` is Node ≥20.11; on the 18 leg the whole test file failed to LOAD (not ok at load, not a normal failure) — two red engine legs before the repo idiom `dirname(fileURLToPath(import.meta.url))` was used. The resulting contract: `scripts/run-tests.mjs` enforces the suite pass total against `docs/state-snapshot.json.testsTotal` after every green run (a stale number in any doc = failing build); `test/ci/current-state.test.js` re-measures the fast fields and fails on drift; `gitCommit` in the snapshot is an ANCESTOR pin (rebase-proof), never `== HEAD` — content fields are what CI compares.
115117
- [C29] **Owner mandate: pin the truth to canonical surfaces before any external campaign**: the owner's directive (binding) is that every number a letter or doc states must be machine-measured, reproducible from a fresh clone, and CI-enforced — before Phase A/B outreach material is shared. The People's Court engagement remains an external TECHNICAL SIGNAL (never endorsement/partnership/donation); nothing external is sent without a per-step owner sign-off (P7 §5/§6); results beyond verification (funding, trends, wealth) must never be promised. Campaign language must use only the claimable-facts instrument lines (`docs/owner-decisions-and-claimable-facts-2026-09.md`).
@@ -122,7 +124,7 @@ title to jump.
122124
- [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.
123125
## Files That Change Together
124126

125-
- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 1202 ↔ 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).
127+
- `H1-H8.md` expected numbers ↔ engine version ↔ `npm test` test counts ↔ validator check count (currently 2.1.2 ↔ 16 ↔ 1204 ↔ 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).
126128
- `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.
127129
- 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 derives or checks 637. What is genuinely enforced is narrower and real, in two places. **(1) `docs/GOVERNANCE-DASHBOARD.html`** — `test/p2/governance-dashboard-i18n.test.js` binds the `PAYOUT_GATE_I18N` dictionary 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). **(2) `docs/coreguard-gate41-visual.html`** — `test/p2/gate41-visual-i18n.test.js` pins that page's one runtime dictionary `D = {"nodes": {"<id>": {ar, en}}, "attrs": …}` as a **bijection** against the markup: **277 static `data-i18n` keys ↔ 277 entries**, 0 missing, 0 orphan, every entry carrying a non-empty `ar` and `en`, no `.en` leaking Arabic, and `apply()` itself asserted to still iterate `D.nodes` and select by the iterated key (data can be perfect while the switcher no longer reads it — the [C27] two-channel trap). Two measured facts that look like defects and are **not**: entries 84/93/104 have an `.ar` with no Arabic because they are the bare RTL arrows `←`/`→`, and **29** entries embed a *nested* `data-i18n` inside their own `.ar` value (the outer entry replaces `innerHTML`, so the inner attribute is redundant and order-dependent, yet every inner key also appears in static markup so nothing is orphaned and the page renders correctly) — the count is **pinned, not asserted zero**, because changing it is a deliberate edit to a live investor-facing page. **(3) the EN sister `coreguard-gate41-visual-en.html` itself** — this was the last unguarded piece, and `test/p2/gate41-visual-en-parity.test.js` now closes it. The invariant is **NOT** "the two files are identical" — measured, they are not, and asserting it would be another dead number like 637. The AR page is the *interactive* twin (language switcher); the sister is the *printable* twin (printhead + print button), which is exactly why [C5]'s dictionary walk dropped the EN `printhead` subtree first. So the contract pins (a) **all 277 dictionary `.en` values appear verbatim in the sister** — the cross-file link, 0 absent; (b) **load-bearing element counts are identical** (section 10 · h1 1 · h2 10 · h3 12 · h4 5 · table 4 · thead/tbody 4 · tr 30 · ul 5 · li 10 · a 14 · p 19 · button 3 · ids 34) — a row or heading that exists in one twin only means the sister is a stale snapshot, invisible to any per-file test; (c) the **only** permitted tag differences are `b`/`span`/`div` each **+1** in the sister, pinned as a set and re-checked against the presence of the `printhead` that causes them, so a new divergence cannot hide beside a sanctioned one; (d) the sister **stays dictionary-free** (0 `data-i18n`, 0 `D.nodes`, 0 `L(`) — it is literal English, and a second dictionary would be a second source of truth ([C27]); (e) the sister leaks **no Arabic** in any of its 539 text runs; (f) `lang="ar" dir="rtl"` vs `lang="en" dir="ltr"` — the one attribute pair that *should* differ, and wrong `dir` reverses the whole board's order while every text assertion still passes; (g) the role asymmetry is pinned as fact, so nobody "fixes" it and nobody lets it rot. One consequence worth knowing: **221 of the 277 `.ar` values are already literal Arabic in the static markup**, so the AR page renders with JS disabled — the dictionary is the *switcher's payload*, not its only source of text, and that count is pinned so stripping the literal text (a silent availability regression every dictionary assertion would pass) cannot land unnoticed. 12 negative controls, and the battery reports **coverage, not just a count**: all 8 tests were observed failing (the extractor needs `--test-reporter=tap`, because the default reporter prints glyphs and an ASCII `not ok` filter finds nothing).
128130
- `verification/cg-assurance-verify.ps1` self-test count (21) ↔ `selftest.tap` frozen bytes ↔ README/STATUS claims (21/21).

‎docs/STATUS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ machine-measured, not estimated. Last verified: **2026-09-26**.
88

99
| Item | Value | How verified |
1010
|---|---|---|
11-
| Test suite | **1202 / 1202 pass** | `npm test` — the pass total is machine-pinned: `scripts/run-tests.mjs` enforces it against `docs/state-snapshot.json` after every green run (drift = red), and `test/ci/current-state.test.js` re-measures the fast fields (boundary audit, harness, docs-node) against the committed snapshot. CI-green across engines |
11+
| Test suite | **1204 / 1204 pass** | `npm test` — the pass total is machine-pinned: `scripts/run-tests.mjs` enforces it against `docs/state-snapshot.json` after every green run (drift = red), and `test/ci/current-state.test.js` re-measures the fast fields (boundary audit, harness, docs-node) against the committed snapshot. CI-green across engines |
1212
| Foundry contracts | **34 / 34 pass** | `forge test --match-path "test/contract/*"` (V2: 14 + EvidenceRegistryV3: 20) |
1313
| Adversarial corpus | **73 / 73 pass** | `npm run corpus && npm run benchmark` |
1414
| Execution Integrity Benchmark | **10,000 runs · False Accept 0 · False Reject 0** | `npm run benchmark:10k` |

‎docs/adoption-dashboard.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ default.
5252

5353
| Metric | Value |
5454
|---|---|
55-
| Test suite | 1202 |
55+
| Test suite | 1204 |
5656
| Boundary audit | 836 files / 0 violations |
5757
| Docs-node contract | 94 executed · 55 skip-listed · 20 covered |
5858
| Live-submission harness | PEOPLES_COURT_HARNESS_READY |

‎docs/state-snapshot.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"measuredAtUtc": "2026-09-28T01:32:17Z",
3-
"gitCommit": "f9ced433d06a0bbdc272b50e01907c439e1d9158",
4-
"commitsAheadOfV060": 131,
5-
"testsTotal": 1202,
2+
"measuredAtUtc": "2026-09-28T02:21:06Z",
3+
"gitCommit": "fec76809d7c77409be15300c55b42e2800c34855",
4+
"commitsAheadOfV060": 137,
5+
"testsTotal": 1204,
66
"boundaryAudit": {
77
"filesScanned": 836,
88
"violations": 0,

0 commit comments

Comments
 (0)