Repository navigation
Conversation
Contributor
Production Digest-Pinning AuditAll 42 services digest-pinned. Run 2026-08-29 06:44:49 PDT — 0 finding(s). |
jpr5
added a commit
that referenced
this pull request
Jul 26, 2026
…6156) > **Scope, stated up front.** This PR fixes **one** of the ways a genuinely-red > showcase cell can render as something other than red: the cold-load `signal` > polarity. It does **not** eliminate the symptom. **Nine further masking > mechanisms remain** and are enumerated, with measured counts, under > [What this PR does NOT fix](#what-this-pr-does-not-fix). Please read that > section before treating a green dashboard as evidence of a green fleet. ## The bug Absence of evidence about *why* a cell failed was erasing the fact that it failed. `classifyRung` opened its red branch with: ```ts if (!raw.signalKnown) { return { ...base, contribution: "NO_DATA", rawStatus: null }; } ``` `signalKnown` is `false` when the dashboard's bulk fetch projected the `signal` blob away. So a **genuinely RED rung whose infra-vs-product attribution was merely PENDING got classified `NO_DATA` and painted gray** — the muted "no live probe data" treatment — while the depth strip beside it, built from the raw fold, correctly rendered `1P ✗`. One model object simultaneously said `d5.status === "red"` and `chipColor === "gray"`. Two things make that polarity wrong: 1. **`signalKnown === false` never meant "known to have no signal."** PocketBase omits the `signal` key *only* under a `fields=` projection; a row that genuinely has no signal arrives as `null`, and `null !== undefined`. The flag is pure provenance: "this row came from a projected fetch." It was never evidence the failure was infra. 2. **The guess was wrong on the overwhelming majority.** Of the non-green rows in production, **94.2% are product-class and 5.8% infra-class** (measured today against prod PocketBase using the classifier's own imported `signalHasInfraErrorClass` predicate: 3082 rows, 359 red, 21 infra-class — `driver-error` 11, `abort` 10 — 338 product-class). Graying every unattributed red lost 338 real failures to suppress 21 false alarms. A masked red is never investigated; a false alarm is looked at once and closed. This was **not** a first-paint race. The gray state is a fully-rendered, confident-looking wrong answer that persists until the probe's next sweep rewrites that specific row and the SSE delta redelivers it with `signal`, and it recurs on **every** reload, because the projection strips `signal` unconditionally. **Worst case for the routine per-cell dimensions is ~60 min**, from the hourly `e2e-demos` / `starter_smoke` / `d6-all-pills-e2e` crons in `harness/config/probes/*.yml`; drift dimensions are effectively unbounded. *(An earlier revision of this body claimed "~29 min observed, ~14 min mean". Both were withdrawn during review: "~29 min" was derived from the `*/30` tier and missed the hourly tier entirely, and "~14 min mean" had no derivable basis. Do not cite them.)* ## Measured effect PR #6169's exhaustive sweep — **279,936 rung combinations** (7 status rows × 6 row variants), the same map fed to the pre-fix and post-fix engines and diffed field-by-field — puts the direction of this change beyond argument: - **74,256 cells change**, and **every one moves toward *more* red.** - **Zero** flips toward less red: no `red→gray`, no `red→green`, no `amber→green` anywhere in the diff. - INV2–INV6 hold across the full sweep on the branch engine (0 violations). Red-green on **live production data** (local `next dev` wired to prod PocketBase, driven with Playwright, screenshots visually inspected — DOM measurements alone are not trusted for visual verification; both captures back-to-back on the same underlying rows, only the code changing): | Band | before | after | |---|---|---| | green | 632 | **632 — unchanged, no green regression** | | amber | 0 | 0 | | **red** | **0** | **51** | | no data | 76 | **25** | `0 red → 51 red`, `76 → 25 no data` — 51 recovered, arithmetic closes. Red on **first paint**, no gray plateau. ## The fix — two parts ### (a) Flip the fail-safe polarity — `cell-model.contribution.ts` A red rung with unknown infra-ness now classifies `FAIL_FRESH`. Graying a red requires **positive infra evidence**: `hasNonInfraRed` is false only when every contributing red row's blob actually carries an `INFRA_ERROR_CLASSES` attribution, and signal-provenance is retained as an explicit second precondition so a missing blob can never be read as an infra attribution even if `signalHasInfraErrorClass` is loosened later. ```ts if (fold.redSignalKnown && !fold.hasNonInfraRed) { return { ...base, contribution: "INFRA_RED_FRESH", rawStatus }; } ``` `redSignalKnown` is derived inside `foldFamily`'s **red-row** bookkeeping, not family-wide, so a projected-away GREEN sibling cannot suppress a legitimate infra gray. (The original family-wide flag made `INFRA_RED_FRESH` effectively **unreachable in the browser for every multi-row family** — D4, any multi-pill D5/D6; only single-key D3 was unaffected, which is why every pre-existing fixture missed it. Fixed by round-1 unit G1.) This is the durable fail-safe: any future projection or fetch regression now degrades toward **over-reporting** failure rather than silently hiding it. ### (b) Make first paint correct — `useLiveStatus.ts` The supplemental `signal` fetch is widened from the comm-error aggregates to a **union**: the existing clause OR `state != "green"`. ``` before: filter=(dimension = "d6" || … || dimension = "d5-single-pill-e2e") && key !~ "%/%" after: filter=((dimension = "d6" || … || dimension = "d5-single-pill-e2e") && key !~ "%/%") || (state != "green") ``` The existing fetch was not a viable vehicle as-is: it excluded these rows twice over — dimension `d5` is absent from `FLEET_COMM_AGGREGATE_DIMENSIONS` entirely, *and* its `key !~ "%/%"` predicate excludes every per-cell ladder-rung key. Relaxing only the `%/%` predicate would still have missed them. **Why widen the existing fetch rather than add a second one:** it reuses the freshness guard (`supplementalRowIsOlder`) and the chimera-avoidance merge verbatim — that merge already reasons carefully about a newer bulk row vs an older signal-bearing twin, and duplicating it would be the risky part. It also keeps first paint at one extra request instead of two. **Why scope by STATE, not by key:** signal-provenance is consulted **only** in `classifyRung`'s red branch — green and degraded paths never touch it — so only non-green rows can change a chip verdict. `!= "green"` rather than an explicit red/degraded list is deliberate: it also catches an out-of-vocabulary state, which `rankOfState` ranks **worst** — so the rows that matter most can never fall outside the fetch. The comm-error clause is kept as an independent disjunct, not replaced: a **green** aggregate row can still carry an active comm-error blob. The fetch is page-capped at `MAX_INITIAL_FETCH_PAGES = 20`, projected to `STATUS_LIST_FIELDS,signal`, and non-fatal at the fetch site — truncation is handled **asymmetrically**: supplemental truncation degrades (warn, use what arrived), bulk truncation throws. (Round-1 unit FETCH; the fetch was originally unbounded, and its rejection propagated to `setRows([])`, so an *enrichment* failure blanked the whole matrix.) **Rejected: suppressing the chip while pending.** A blank or spinning chip for up to an hour on a large slice of the matrix hides reds exactly as effectively as a gray one, while additionally looking broken. ### What each part buys Real engine over all 3082 production rows, three wires built from the identical row set *(green / amber / red / gray over the 708 catalog cells the band counts)*: | Wire | pre-fix engine | post-fix engine | |---|---|---| | FULL (server / `/api/matrix`) | 596 / 37 / 51 / 24 | 596 / 37 / 51 / 24 | | COLD, pre-fix projection | **596 / 0 / 0 / 112** | 596 / 37 / 51 / 24 | | COLD, post-fix projection | 596 / 0 / 49 / 63 | 596 / 37 / 51 / 24 | - The pre-fix browser wire collapsed **88 cells** (51 red + 37 amber) into gray. The entire red *and* amber population was zeroed, because the `!signalKnown` early return preempted `FAIL_FRESH`, `FIRST_STRIKE_FRESH` **and** `INFRA_RED_FRESH` alike. - **(b) alone is not sufficient**: it recovers 49 of 51 reds and **zero** of the 37 ambers, leaving 39 cells still mis-painted. - **(a) is what delivers correctness** — with it, all three wires equal server truth exactly. - **(b) is what keeps (a) from having to guess.** Today (a)-alone happens to cost 0 false-positive cells, because no cell's verdict-determining rung is currently a pure infra red. That is luck, not a guarantee: prod holds 21 infra-classed red rows. (b) supplies the actual evidence so those stay correctly gray, and it also feeds `decodeCellCommError` for non-green per-cell rows. ## Value test — per cell, all 6 (≥3 required) Every affected cell verified individually, not inferred from a shared symptom. Live DOM on the real surface, plus the real engine driven offline over all 3082 production rows through faithful replicas of the pre- and post-fix browser wire: | Cell (`d5:<slug>/multimodal`) | PB row | Server truth | Cold PRE | Cold POST | Live chip PRE | Live chip POST | Flipped | |---|---|---|---|---|---|---|---| | `agno` | red, fc 1817 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | | `crewai-crews` | red, fc 1716 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | | `llamaindex` | red, fc 2005 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | | `mastra` | red, fc 1806 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | | `ms-agent-python` | red, fc 1710 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | | `built-in-agent` | red, fc 1803 | red | **gray** | red | gray `D4` + `1P ✗` | **red `D4`** | ✅ | 6/6 flip. All six are `errorClass: conversation-error` — a real probe conversation failure, not in `INFRA_ERROR_CLASSES`, so `FAIL_FRESH` is the correct classification. (Prod figures; `built-in-agent` is green on staging, so staging shows 5.) **Depth distribution is byte-identical across the pair** (`D6:632 D5:0 D4:71 D3:0 D0:5` both times). The fix changes only the *colour*, never the depth — the `D4` label on these chips was always correct, so this must not be mis-validated by looking for a depth change. ## Tally-site audit Every tally is downstream of `chipColor`, so all self-correct — none needed refactoring. All verified on the live surface post-fix: | Site | Mechanism | Pre-fix | Post-fix | Verified | |---|---|---|---|---| | `feature-grid.tsx` `computeColumnTally` | gray-skip | `✗ 0` | `✗ 8` (Agno) | ✅ header DOM | | `feature-grid.tsx` `computeColumnTallyDetail` | gray-skip | empty list | 8 features incl. **Attachments** | ✅ panel opened via `tally-trigger-red` | | `page-stats.ts` `computeHealthStats` | `case "gray": noData++` | `0 red / 76 no data` | `51 red / 25 no data` | ✅ band DOM + screenshot | | `page-stats.ts` `computeDepthDistribution` | — (no gray gating at all) | `D4:71` | `D4:71` | ✅ unaffected | | `page-stats.ts` `computeD6Stats` | `d6Effective` | `null` → gray | `"red"` → red | ✅ golden fixture | **No other `chipColor` consumer changes behaviour.** `d0-gone-predicate.ts` gates the outage alerter on `chipColor === "red"`, but `d0-gone-monitor` reads *full rows with `signal`*, so provenance is always known there — as it is for `/api/matrix`. The polarity flip is reachable **only** where rows are projected, i.e. exclusively the browser cold-load path. ## A test asserted the buggy behaviour `api-matrix-equivalence.test.ts` asserted: ```ts expect(serverChip).toBe("red"); expect(coldLoadChip).toBe("gray"); expect(serverChip).not.toBe(coldLoadChip); ``` commented as "the state the browser converges to after its supplemental `signal` fetch … the more accurate answer." That comment is factually wrong — the supplemental fetch resolved in ~1 s and structurally excluded those rows twice over — and the assertion pinned the defect as intended behaviour. **This is why CI never caught it.** Read in full, it is asserting the defect, not an adjacent legitimate case: the fixture is a genuine product red (`errorDesc: "assertion failed: wrong answer"`, no infra class) with `signal: undefined` on the red rung. Inverted to assert **red on both paths**, with the fail-safe direction explained inline. Same for the harness's `§7 I5` case (`cell-model-v2.test.ts`) and `classifyRung`'s unit case. Four golden-master fixtures (`pos-d{3,4,5,6}-red-signal-unknown`) re-frozen. Negative controls added so the flip can't over-reach: an infra-classed red **still** grays (positive evidence present), and `§7 I4` (infra-only red → gray, `isRegression` false) still passes untouched. ## The structural lever: coherence invariant INV7 `cell-model.coherence.test.ts` asserted INV1–INV6, all of which relate `chipColor` only to the other **chip-side** outputs. **None inspected the `d3`/`d4`/`d5`/`d6` depth pills.** So the engine could return one object saying both `d5.status === "red"` and `chipColor === "gray"` with every invariant intact — which is exactly what happened, on every cold load. INV7: **a gray chip above a red depth pill requires positive infra evidence on every contributing red row.** Red-greened against the old polarity — it fails on 3 fixtures with a legible message: ``` pos-d5-red-signal-unknown: INV7 gray chip over a red pill requires POSITIVE infra evidence on every red row — d5:acme/agentic-chat has none (signal STRIPPED (pending)). A red whose cause is merely unknown must render red, not gray. ``` It closes the gap in the **only** safe direction: by fixing the chip upward, never by muting the strip. Deriving the pills from the classified contributions — the superficially cleaner unification — would render `1P ✗` as `1P ?` on cold load and destroy the only on-page element that was telling the truth, converting a visible inconsistency into an invisible failure. INV7's own limitations are disclosed under [Known limitations of the guards themselves](#known-limitations-of-the-guards-themselves). --- # Review-round fixes folded in Three full 12-reviewer review rounds were run against this branch. Round 1 contributed five units plus an integration fix; round 2 contributed four more. The loop was **deliberately stopped** after round 3 by explicit decision rather than running a fourth; round 3's findings are catalogued (132 items in `DEFERRED-r3.md`) and routed to the follow-up epic, not silently dropped. ## Round 1 — five units | # | Commit | Concern | Surface | |---|---|---|---| | G1 | `2a68282d` | Signal-provenance was derived family-wide but gated a red-row-scoped predicate. Precondition moved into `foldFamily` as `redSignalKnown`; `RawRung.signalKnown` **removed entirely** with all its plumbing. | production + tests | | A5 | `ebd7ac68` | The autocancel fake servers ignored `filter`/`fields`, so the supplemental fetch's leftover-append silently repaired a dropped bulk page — three pagination guards passed under every mutation. Servers rebuilt to evaluate the query. | test-only | | FETCH | `f5178765` | The supplemental fetch was unbounded (`for(;;)`), unprojected, and its rejection propagated to `setRows([])`. Now capped, projected, and non-fatal at the fetch site. | production + tests | | INV7 | `3dea9f64` | INV7 was quantified over the whole live map rather than the cell's contributing keys, and had no `isStaleCell` carve-out — it failed two classes of legitimate rendering. Scoped, exempted, plus an anti-vacuity guard. | test-only | | DOCS | `2797618c` | Stale/unanchored numeric claims (row counts, byte estimates, re-delivery window) corrected against production and given their source queries. | comments only | | — | `938be2ac` | **Integration fix.** A5 and FETCH disagreed about how a supplemental request is *identified*; all three fake servers misclassified it as a bulk page and the whole autocancel suite failed 3/3. Both dashboard suites now key on `signal` being IN the projection. | test-only | ## Round 2 — the four integrated units Integrated in order Q2 → Q1 → Q3 → Q4. Every guard was re-mutated **after** integration and reproduced its pre-integration result; no guard was disarmed by the merge. | # | Commit(s) | Concern | What it proved | Surface | |---|---|---|---|---| | **Q2** | `b8b75b7d` | The dashboard's `useLiveStatus` test doubles carried **three divergent implementations** of the same PocketBase query evaluator, and the nominally-shared one was the weakest. Collapsed to exactly one, every semantic a measured observation from a real PocketBase v0.22.21 server. Deleted autocancel's 380-line private copy. `evaluatePbList` **cannot throw**, so a parse error can no longer send NO response and hang the hook to a 20 s `waitFor` death. | Six mutations (short page dropped in wave merge, boundary logic removed, merge order reversed, supplemental filter broken, supplemental filter widened to `""`, bulk filter selects nothing) each reproduced their pre-integration RED count exactly — 3/1/2/6/5/6 failures. The consolidated evaluator is strictly stronger, not merely shorter. | test-only (−488 lines net in the doubles) | | **Q1** | `75fdfb3a` + `ed10b61f` | `truncated` meant "cap exhausted", so a **complete** read that happened to end exactly on the cap page was reported as truncated — the bulk caller threw, burned its reconnects and landed on a blank dashboard behind an offline banner, on every retry and every reload. `truncated` now means exactly "there are rows we did not read", proven by ONE lookahead read of page cap+1 whose rows are discarded and only whose emptiness is load-bearing. Algorithm hoisted to an exported `paginateStatusPages(readPage)`. | Lowering the cap 20→10 and 20→5 each produces **10 failed / 6 passed**, where the pre-fix code was **6/6 GREEN** — i.e. the guard was previously disarmed. A complete 10,000-row dataset renders `live`, `truncated === false`, seeded red cell still `chipColor: "red"`, page set exactly `[1..21]`; 10,001 rows still throws with `status: "error"` and "exceeded" in the message. | production + tests | | **Q3** | `49dea099` | INV7 false-failed on the ordinary I1 ladder-gap shape ("no `e2e:` row + red `chat:<slug>`"). Added a carve-out keyed on `ladderGapDepth`, **one-directional** (a gap *above* the red excuses nothing) and never firing without a witness rung — plus a two-sided canary that fails loudly the moment the underlying gap-break is fixed. | Deleting the `isStaleCell` exemption fails exactly the U8 force-gray case (the exemption is load-bearing, not decorative). Changing the engine's gap-break `break` → `continue` fires the **two-sided canary** with its intended message (`expected 'red' to be 'gray'`) — so the allowance cannot go on silently excusing a shape the engine no longer produces. Gapless and gap-above-red incoherence still FAIL; the legitimate gap shape still PASSES. | test-only | | **Q4** | `b04330ab` | Three explicitly load-bearing family folds were invisible at golden-master level — `maxNonInfraRedFailCount`'s MAX, `allRedSoftClass`'s EVERY quantifier, and `redSignalKnown`'s RED-ROW scope — because no fixture anywhere carried two *differing* red rows. 5 new fixtures, baseline 56→61, 140 insertions / 0 deletions. | Each of three mutations now fails via **exactly one** fixture: `Math.max`→`Math.min` ⇒ `hetero-d4-red-failcount-max`; `every`→`any` ⇒ `hetero-starter-mixed-soft-hard`; `redSignalKnown` red-row→family scope ⇒ `hetero-d4-green-stripped-infra-red`. Precise attribution, not a shotgun. | test-only | One merge conflict, in `useLiveStatus.supplemental-bounds.test.tsx`: Q2 deleted the file-local `classifyRequest` helper on the same lines where Q1 added its new `PAGES_THROUGH_LOOKAHEAD` constant. Resolved by keeping **both** intents rather than taking a side. Baseline golden-master key count is **61**, and the completeness check (`has exactly one baseline entry per fixture (no stale/missing)`) runs, so a fixture added without a baseline entry fails rather than being skipped. --- # What this PR does NOT fix **This PR does not fully eliminate the original symptom.** It fixes the `signal`-polarity masking mechanism and makes the cold load correct. A genuinely-red cell can still render **gray, green, or amber** by nine other routes. All nine were found by review of this branch and are catalogued, not speculative. ### Quantified by the #6169 sweep (279,936 combinations) | Mechanism | Rung combinations | |---|---| | **M1** — ladder gap-break: `scanWorst` folds the FIRST `ABSENT`/`STUB` rung as `ABSENT` and **`break`s**, so a fresh non-infra RED on a rung *above* the gap is never folded and paints gray | **17,088** | | **M2** — D6 outside the `scanWorst` walk: a red D6 never reaches the chip | **2,048** | | **M3** — gap not below the red: the remaining gray-over-red shapes | **192** | | | **19,328 total, 0 unexplained** | M1 is highly reachable in practice: `chat:<slug>` / `tools:<slug>` are integration-scoped, so one red `chat:` row plus an unemitted `e2e:<slug>/<featureId>` row (new feature, rotation slot, D3 driver never ran) is a gray chip over a red D4 pill. `combine.ts` is deliberately untouched here — fixing any of M1–M3 re-verdicts cells across the matrix and therefore needs its own PR with a golden-master **baseline re-freeze** and a **live value test**. Q3's INV7 carve-out is silent about M1 **on purpose and only about that**, and its two-sided canary is the tripwire that forces the carve-out to be deleted the moment M1 is actually fixed. ### Found in round 3, not quantified by the sweep 4. **Prototype-chain property lookups invert the anti-masking guard.** `STATE_RANK` / `rankOfState`, `WORST_STATE_RANK` / `worstStateRank`, `firstStrikeConfig[kind]` and `CATALOG_TO_D5_KEY` are plain object literals read without an own-property guard, so a runtime value colliding with an `Object.prototype` member (`constructor`, `toString`, `valueOf`, …) resolves to an inherited function that the `??` fallback then never replaces. For `rankOfState` the out-of-vocabulary guard **inverts** — an unknown state, which the code deliberately ranks worst, instead classifies as an infra red and grays; `worstStateRank` silently swallows the row entirely. `CATALOG_TO_D5_KEY` is unguarded at four further sites in `cell-model.ts`, where the consequence is a **whole-matrix render crash**. Fix is `Object.prototype.hasOwnProperty.call` (or a prototype-free table) at each site. 5. **Wave truncation bypasses the fail-loud throw entirely.** In the fan-out merge, a short page inside a wave causes every page issued *after* it in the same wave to be discarded — sound for a stable collection, but the pages resolve concurrently against a table the harness writes continuously. The discard produces no log, no warning, no counter, no `degraded` flip, and **`truncated` stays `false`** because it is only ever set by the cap lookahead. So the bulk caller's deliberate "a truncated BULK read cannot degrade gracefully … throw" posture fires only for cap exhaustion, never for this class of loss. The missing rows render as *absent*, which `buildCellModel` resolves to `ABSENT` / `NO_DATA` and paints gray — the exact polarity this PR exists to remove. `INITIAL_FANOUT_BATCH` is documented as "purely a WIRE-EFFICIENCY knob" but is load-bearing for correctness: at a larger batch the loss is `INITIAL_FANOUT_BATCH - 1` pages. 6. **`INITIAL_PAGE_SIZE` above the server clamp grays ~6/7 of the matrix.** Termination is the client-side comparison `first.length === INITIAL_PAGE_SIZE`, correct only because PocketBase clamps `perPage` to 500 server-side. Raise the constant — the obvious "fewer round-trips" tuning, which the surrounding comment invites — and every page returns 500, i.e. *short*, so the loop stops after page 1 and returns ~500 of ~3100 rows with `truncated: false`. The bulk caller sees a complete read, never throws, and ~6/7 of the matrix renders no-data gray with no warning and no banner. The `truncated` contract cannot catch it because the read genuinely never hit the cap. 7. **An empty bulk page 1 publishes `live` with 0 rows.** `paginateStatusPages` returns `{rows: [], truncated: false}` for an empty collection and `connect()` then does `setRows([])` + `setStatus("live")` + `setError(null)` with no empty-collection guard. Every cell renders no-data gray behind a healthy "live" indicator. Untested — the smallest fixture anywhere in these files is 3 rows. The server-side analogue is already a known deferred item. 8. **First-strike de-amplification fires at `fail_count === 0`, painting a genuine red AMBER.** The gate is `maxNonInfraRedFailCount < threshold` with `threshold` 2, so `fail_count` of **0** de-amplifies exactly like 1 → `FIRST_STRIKE_FRESH` → amber, i.e. "transient, not yet actionable". The threshold's semantics are valid only if a red row's `fail_count` is always ≥ 1, which is asserted as a *producer* property and enforced nowhere on the read side; out-of-vocabulary states (the harness can persist `"error"` as a no-data marker, which `rankOfState` ranks above red) and back-filled or externally-written rows both reach the classifier at 0. A `fail_count` of 0 on a red row is not positive evidence of a first strike. The golden master cannot see it: every red-bearing fixture uses `fail_count: opts.failCount ?? (isRed ? 1 : 0)`, so no fixture puts a red row at 0. 9. **An infra-red or `degraded` D1/D2 over a green ladder paints chip=green, achieved=6.** `combine.ts`'s §F gate fires only on `contribution === "FAIL_FRESH"` in both the achieved-depth walk and `computeChip` step 1; `INFRA_RED_FRESH` and `DEGRADED` fall through as non-gating, so the cell keeps its green ladder verdict with `d6Effective: "green"`. Measured on the branch engine: `D1 infra-red (driver-error) + green D2 → chip=green ach=6 reg=false d6Eff=green`, and the same for `D1 degraded`. **Mutation-proven invisible to the golden master:** patching *both* §F gate sites to also fire on `INFRA_RED_FRESH` and `DEGRADED` — a materially different verdict for every column whose health probe is failing — leaves **all 61 baseline entries byte-identical**. `health:<slug>` / `agent:<slug>` are integration-scoped, so this is whole-column. The polarity flip closed the `signal: undefined` hole here and left the `driver-error` / `abort` hole wide open — and `driver-error` / `abort` on a health probe is precisely what an unreachable container or a cancelled sweep produces. # Known limitations of the guards themselves Disclosed rather than omitted. These are properties of this PR's own tests. - **INV7's Q3 carve-out does not cover the M2 shape.** It is keyed on `ladderGapDepth` and excuses only a gap strictly *below* the shallowest red pill, which is M1. The D6-outside-the-walk shape (M2, 2,048 combos) is a different mechanism and is not addressed by the carve-out. - **The starter-axis INV7 canary short-circuits and proves nothing.** `assertChipStripCoherent` returns immediately on `m.chipColor !== "gray" || redDepth === null`. The hard-red starter cell the test builds has `chipColor === "red"`, so the function returns on the **first** disjunct — not on the strip condition the comments claim. The call would pass identically if a starter cell *did* expose a red depth strip. The canary role is actually carried by the four `lvl.exists === false` / `lvl.status === null` assertions beside it; the `assertChipStripCoherent` call adds nothing. Compounding it, `stripReadsRed` — the identifier the comments reason about — does not exist anywhere in the repo. - **The five INV7 "teeth" assert `/INV7/`, which the drift-guard message also matches.** `assertChipStripCoherent` raises two structurally different failures and both messages contain the literal `INV7`: the keyspace-drift guard, and the real coherence failure. Every teeth test asserts only `.toThrow(/INV7/)`. So if `contributingKeys` ever drifts from the engine keyspace — `collectAgentLadder` gains a rung, `CATALOG_TO_D5_KEY` fan-out changes shape, a `keyFor` segment changes — `redRows` goes empty, the drift guard fires, and **all five teeth still pass** while INV7 has gone vacuous over the entire fixture matrix. That is precisely the state the drift guard was written to make impossible; it is silenced inside the only tests that reach it. The fix is to assert the specific message (`/requires POSITIVE infra evidence/`) and pin the drift message in its own case. - **The test double cannot express absent-vs-null projection provenance.** `applyPbFields` silently drops projection tokens it does not model, so the fake cannot distinguish a key *omitted by a `fields=` projection* from a key present with value `null` — which is the single distinction `redSignalKnown` rests on. Fixtures therefore cannot validate the provenance semantics the fix is built on; that validation lives only in the live red-green capture above. # Follow-ups - **Epic: "A red must render red" — a single enforcement point for the showcase cell-model read model**, on Notion under CopilotKit *Plans / Proposals*: https://app.notion.com/p/3a83aa38185281b99f7bfdd1d0f46bb9 — carries M1–M3 and the round-3 mechanisms above toward one enforcement point rather than nine point-fixes. - **`DEFERRED-r3.md` — 132 catalogued items** from review round 3 (comment accuracy, test-double conformance, coverage gaps, altitude). Nothing in round 3 was discarded; it was catalogued and routed. # Quality gate Re-run at head `b04330ab` in a clean detached worktree. - **`[email protected] --check`**: clean — "All matched files use the correct format" (16 changed TS/TSX files) - **`[email protected]`** (repo `.oxlintrc.json`): **5 warnings, 0 errors.** 4 of the 5 reproduce verbatim on the `origin/main` versions of the same files (`unicorn(consistent-function-scoping)` on `c`, `eslint(no-shadow)` on `rows`, `unicorn(no-array-reverse)`, `typescript-eslint(consistent-type-imports)`). The one net-new against `origin/main` is a second `unicorn(consistent-function-scoping)` warning, on the test-local helper `lvl` in `cell-model.coherence.test.ts`. Zero errors; the repo's `oxlint` CI job is green. - **`tsc --noEmit`**: **0 errors** in `shell-dashboard`; `harness` clean under `tsconfig.build.json`. `harness`'s `tsc --noEmit` reports one pre-existing error, `frontend-matrix.test.ts` resolving `../../../shell/src/data/frontend-catalog.json` — a stale path in a file byte-unchanged from `origin/main`. - **`shell-dashboard` tests** (measured locally at `b04330ab`): **71 files / 1407 passed / 1 skipped / 0 failed.** Scoped to `src/`; `tests/runtime-env-switch.spike.test.ts` was deliberately not run (it spawns `next build` plus two `next start` invocations and is not a unit test). - **`harness` tests** (measured locally at `b04330ab`): **3659 passed / 18 skipped / 3 failed** — the same three pre-existing D5 fixture-registry-drift failures, in files **byte-unchanged from `origin/main`** and driven entirely by inputs none of this PR's 17 files touch: - `frontend showcase matrix > plans every runnable catalog cell without loss or duplication` — `expected 664 to have a length of 660` - `d5-mapping-drift > dashboard CATALOG_TO_D5_KEY structurally mirrors harness REGISTRY_TO_D5` — the drift regex cannot locate `CATALOG_TO_D5_KEY` in `shell-dashboard/src/lib/live-status.ts` (a 675-byte re-export shim on `main`, not modified here) - `D5_REPRESENTATIVES > covers every D5FeatureType that has a registered script` — missing `browser-use-smoke` Those three are now **explicitly quarantined** by the `test / unit-showcase` workflow that landed on `main` in `7282ecddfb` (`showcase/harness/vitest.quarantine.json`), and that workflow's **quarantine ratchet** re-runs each one to confirm it *still* fails — so they neither hide nor block. At this PR's head the ratchet passes: `Quarantine ratchet OK: all 3 quarantined file(s) still fail.` - Diff hygiene: no lockfiles, no generated `src/data/*.json`. ## CI provenance — this is the PR's first honest CI `main` has been **merged in** at `7282ecddfb` (merge commit `12ea621a`, textually clean, zero conflicts; the 13 commits above are unrewritten). This matters for more than being up to date: the `harness unit suite` and `shell-dashboard unit suite` jobs **did not exist** at `b04330ab`, because the workflow that enables them landed on `main` afterwards and GitHub runs `pull_request` workflows from the PR head. The earlier "17 pass" therefore ran **none** of the ~5,000 tests covering this PR's own subject matter (`cell-model/*` and `useLiveStatus*`). - CI at this head (`12ea621a`): **21 pass / 0 pending / 0 fail** across 24 registered rows. - Both new jobs run and both pass — `shell-dashboard unit suite` **70 files / 1404 passed / 1 skipped**, `harness unit suite` green, quarantine ratchet OK. - The **Q1–Q4 guard battery (16 re-proofs)** was re-run at the merge head and reproduced its pre-merge numbers exactly, so nothing was disarmed by the merge: Q1 cap→10 and cap→5 each **10 failed / 6 passed** (unmutated **16/16 green**); Q2 M1–M6 = **3 / 1 / 2 / 6 / 5 / 6** (M4 flips the supplemental cap test, M6 the bulk cap test, M5 red in both worlds by design); Q3 `isStaleCell` deletion = **1 failure** (the U8 force-gray case) and the engine `break`→`continue` fires the two-sided canary with `expected 'red' to be 'gray'`; Q4 each of the three fold mutations = **1 failed / 61 passed** via exactly one fixture (`hetero-d4-red-failcount-max`, `hetero-starter-mixed-soft-hard`, `hetero-d4-green-stripped-infra-red`), baseline key count **61**, completeness check present. # Review guidance **Surface: 17 files, +4880 / −382.** Most of that volume is tests, fixtures, and the regenerated golden-master baseline. Only three files carry production behaviour: `cell-model.contribution.ts`, `cell-model.ts`, and `useLiveStatus.ts`. **The four round-2 units are separable commits** — `b8b75b7d` (Q2), `75fdfb3a` + `ed10b61f` (Q1), `49dea099` (Q3), `b04330ab` (Q4) — and round 1's are too, so this can be read unit by unit rather than as one diff. **Highest-value review targets, in order:** 1. **`cell-model.contribution.ts` — the gate.** `if (fold.redSignalKnown && !fold.hasNonInfraRed)`. This is the whole polarity decision. Worth checking: that `redSignalKnown` really is red-row-scoped inside `foldFamily` (a family-wide derivation is what made `INFRA_RED_FRESH` unreachable in the browser), and that the two conjuncts are genuinely independent evidence rather than one restated. 2. **`useLiveStatus.ts` — `truncated` semantics.** Q1 redefined `truncated` from "cap exhausted" to "there are rows we did not read", proven by one lookahead read of page cap+1 whose rows are discarded and only whose emptiness is load-bearing. Worth checking: the asymmetry (bulk throws, supplemental warns) is applied at the right call sites, and that the lookahead genuinely cannot be confused with a data page. Note limitation 5 above — this contract does **not** cover wave-level loss. Everything else is fixtures, doubles, and the coherence suite; the disclosed weaknesses in those are listed under *Known limitations of the guards themselves* rather than left for a reviewer to rediscover.
…llowlist Commits the one-off diagnostic that produced the highest-severity finding of PR #6156's round-2 review (slot 1-A #1) as a permanent guard. The diagnostic reconstructed both engines in scratch dirs and diffed them field-by-field; that form depends on `origin/main` at a moment in time. This is the committable form: the invariant plus a shape-exact allowlist, one engine, no cross-revision diff. INV7 promoted from six fixtures to the whole domain — the 6^7 = 279,936 cross-product of the seven status rows an agent-axis cell is derived from (7 slots x {absent, green, greenStale, redFresh, redInfra, redStripped}) — asserting that no combination renders a red depth pill under a non-committal chip unless every contributing red row carries positive INFRA_ERROR_CLASSES attribution. Reproduces slot 1-A's measurement exactly: 19,328 of 279,936, in the same eight red-pill buckets (pinned separately as SLOT_1A_RED_PILL_BUCKETS). Two tables, not one, because the residue is not one mechanism: - KNOWN_I1_GAP_BREAK_SHAPES (7 shapes, 17,088) — EXCUSED as invariant-I1 debt. `scanWorst` breaks at the first ABSENT rung, so a red above the gap is never folded and the chip provably never read it. Round-2 partition bucket (d4). - QUARANTINED_NON_GAP_MASKING (6 entries, 2,240) — NOT excused. 2,048 are a non-infra red D6 sitting outside `scanWorst`'s [D3,D4,D5] walk; 192 have their gap at or above the red. The chip read a verdict and still hid a red; contiguity excuses nothing here. Separate table, separate wording, separate follow-ups, so the I1 note cannot be read as covering them. The gap predicate mirrors `ladderGapDepth` from cell-model.coherence.test.ts @ 49bf40943f: a rung is a gap when no row exists for any of its keys (equivalent to `classifyRung`'s ABSENT), NOT the strip's `status === null`. Keying off the strip mis-files the 192 non-gap combinations as excused — measured, not assumed. When both land, the shared helper should be imported and this copy deleted; the header says so. Two-sided by construction, and mutation-proven against the real engine: - a shape in no table fails ("NEW masking shape") — proven by deleting an entry: reported as 864 + 96 unlisted combinations; - an allowlisted shape that stops masking fails ("RATCHET ... OVER-BROAD"), so fixing the gap-break forces the table to shrink rather than leaving stale cover — proven by inflating an entry 2880 -> 2881; - a quarantined shape that stops masking fails ("QUARANTINE SHRANK") — proven by inflating an entry 64 -> 65. In-suite teeth cover the same three directions, including that an emulated (d4) fix clears all seven allowlisted shapes while leaving the quarantine intact. Exhaustive, not sampled: the full sweep runs ~2.1 s, so no covering array is needed. The LiveStatusMap is built once and mutated one key per step in mixed-radix reflected Gray-code order (Knuth 7.2.1.1 Algorithm H); a control test re-runs the whole domain rebuilding a fresh map per combination and asserts an identical histogram. Deterministic: fixed `now` literal, pure engine, no randomness, no I/O, no wall-clock. The domain identity is asserted too — 6^7 distinct tuples visited exactly once, every (slot, variant) pair 6^6 times, every step a single-slot delta — so the sweep cannot silently degenerate into a subset. Product logic is untouched: this is a new test file and nothing else. NOTE: gates nothing until PR #6168 lands the harness/shell-dashboard unit suites in CI (they were excluded twice over, by `paths-ignore: showcase/**` and by `--projects='packages/**'`). Until then it is a local + cr-loop pre-audit instrument.
BenTaylorDev
force-pushed
the
test/showcase-red-masking-invariant
branch
from
August 29, 2026 13:44
5bfd718 to
20fd711
Compare
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Commits the one-off diagnostic that produced the highest-severity finding of PR #6156's round-2 review (slot 1-A #1) as a permanent, two-sided guard. One new test file; no product logic touched (
combine.ts,scanWorst, the coherence invariant, and the equivalence fixtures/baseline are all unchanged).That diagnostic reconstructed both engines (branch +
origin/main) in scratch dirs and diffed them field-by-field. That form is not committable — it depends onorigin/mainat a moment in time. The committable form is the invariant plus a shape-exact allowlist: one engine, no cross-revision diff.The invariant. No combination of status rows may render a RED depth pill under a chip that makes no failure claim (
gray, or the cleangreen) unless every red row the cell contributes from carries positiveINFRA_ERROR_CLASSESattribution. That is INV7 — including its U8 all-stale carve-out — quantified over the full 6^7 = 279,936 cross-product of the seven status rows an agent-axis cell is derived from × six row variants (absent,green,greenStale,redFresh,redInfra,redStripped), instead of over six hand-written fixtures.It reproduces slot 1-A's measurement exactly: 19,328 of 279,936, in the same eight red-pill buckets (pinned separately as
SLOT_1A_RED_PILL_BUCKETS, so the historical number stays verifiable).Two tables, because the residue is not one mechanism
KNOWN_I1_GAP_BREAK_SHAPES(7 shapes)QUARANTINED_NON_GAP_MASKING(6 entries)scanWorstfolds the first ABSENT rung of["D3","D4","D5"]as ABSENT andbreaks, so a red above the gap is never folded; the chip provably never read it, so demanding infra evidence is a false failure. Reversing it is a design change to documented invariant I1 — round-2 partition bucket (d4), needing its own golden-master re-freeze and ≥3-cell live value test.Reconciled with the concurrent Q3 work (
49bf40943f, INV7's ladder-gap carve-out): the gap predicate here mirrors itsladderGapDepth— a rung is a gap when no row exists for any of its keys (equivalent toclassifyRung's ABSENT), deliberately not the strip'sstatus === null. That distinction is load-bearing and was measured, not assumed: keying off the strip mis-files the 192 M3 combinations as excused gap-breaks. The header names the symbol and commit and says to import the shared helper and delete this copy once both land, so a second divergent formulation does not calcify.Two-sided, and mutation-proven against the real engine
red-D5-onlyentryNEW masking shape M1_GAP_BELOW_RED::d5|gap=D3 × 864+…d5|gap=D4 × 96RATCHET (allowlist is now OVER-BROAD): red-D4-only / M1_GAP_BELOW_RED::d4|gap=D3 masked 2881 … but only 2880 nowQUARANTINE SHRANK: red-D6-only / M2_D6_OUTSIDE_WALK::d6|gap=none …The ratchet is the point: an allowlist that silently keeps excusing a fixed condition becomes permanent cover. In-suite teeth cover the same three directions, including that an emulated (d4) fix clears all seven allowlisted shapes (reporting each by name) while leaving the quarantine counts untouched — proving the two tables are independent.
Runtime and determinism
LiveStatusMapis built once and mutated one key per step in mixed-radix reflected Gray-code order (Knuth 7.2.1.1 Algorithm H). Not taken on trust: a control test re-runs the whole domain rebuilding a fresh map per combination and asserts an identical histogram.nowliteral, pure engine, no randomness, no I/O, no wall-clock read. Explicit 120 s timeouts on sweep tests so a slower runner cannot make a correct test flake.Prerequisite: this gates nothing until #6168 lands
No CI job runs the showcase harness suite at all today — the harness tests were excluded twice over, by
paths-ignore: showcase/**and by--projects='packages/**'. #6168 ("run the harness and shell-dashboard unit suites in CI") establishes the gap was worse than assumed: 3,646 harness tests and 1,331 dashboard tests ran nowhere. Until #6168 merges this file is a local +cr-looppre-audit instrument; after it, the invariant actually enforces. Worth committing either way — the next reviewer inherits the measurement instead of rebuilding two engines in scratch dirs.Verification
vitest run src/shared/→ 210 passed (7 files), including the untouched existing coherence suite.oxfmt --checkclean,oxlint0 warnings / 0 errors,tsc --noEmitno errors in the new file (3 pre-existing unrelated module-resolution errors elsewhere in the harness).showcase/harness/tests/runtime-env-switch.spike.test.tshangs a bare vitest run (~25 min at 0% CPU); excluded in CI via ci(showcase): run the harness and shell-dashboard unit suites in CI #6168.