feat(wake): W5 — synthetic-canary FN-oracle + source-parity reconciler #909
Reference in New Issue
Block a user
Delete Branch "feat/wake-fn-oracle-reconciler"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements W5 of the wake/heartbeat canon (EPIC #892): the FN-oracle (A6) and the source-parity reconciler (A7), building on merged W2/W3/W4. Calls their PUBLIC APIs only —
store.sh/ack.sh/detector.share untouched.A6 —
fn-oracle.sh(synthetic-canary) → §4 vector{ synthetic-canary FN-rate = 0 }, §7 residual 5poll-once(a black box), and renders its verdict solely from the terminal store cursor — did a CONSUMED ack cover the canary'sobserved_seqwithin the per-class SLO? It measures the false-negative rate; §4 requires FN-rate = 0.--slo-secondsis required.A7 —
reconcile.sh(source-parity reconciler) → §4/G3, §7 residual 5required_sourcesomission FLAGS — an omitted source cannot make the §4 vector pass vacuously, never silently green.observed_seq/inbox → 0 unaccounted; any gap FLAGS. Handles pre-existing/startup obligations per the W4-ratified division (the detector's first-seen-baseline does not wake) by enumerating pre-existing state into the durable store; inbox-reflected state is accounted (no double-enumeration). Fail-loud (G2a) on adapter error / ambiguous-empty.Blocking-defect fix (review 5a): observed_seq dual-allocator — now FAILS CLOSED
The first revision claimed the
observed_seqcollision risk was bounded because "reconcile and poll are serialised." That was factually wrong — reproduced with strictly sequential, never-concurrent calls.observed_seqhas two independent allocators: the detector's private counter ($STATE_DIR/detector/observed_seq_counter, W4) and the reconciler's store-cursor + offset. The detector's next seq isprivate_counter+1, notstore_observed_seq+1, so serializing does not prevent collision: after the reconciler enumeratesalpha→seq1,beta→seq2(storeobserved_seq=2, detector private still0), the detector's next delta allocates private0→1and enqueuesseq1, aliasingalpha; a consumer ackingCONSUMED 1then silently drops a distinct obligation — the exact G3 swallow, via seq-aliasing.Fix (W5-scoped; full store-side allocator unification deferred to #908; detector.sh/W4 untouched): the reconciler's enumeration fails closed. Before writing any
observed_seqit refuses (loud, non-zero; the obligation is FLAGGED, never swallowed) whenever a seq it would allocate could be reissued/aliased:--allow-enumerate/WAKE_RECONCILE_ALLOW_ENUMERATE=1.--no-enumerateandchecknever write, so they stay unconditionally safe. Operational guard (until #908): a detector and the reconciler MUST NOT co-feed one store.Red-first evidence (each test goes RED if its invariant regresses)
Wired into
test:framework-shell; shellcheck clean; full suite green (exit 0).test-wake-fn-oracle.sh— O1 healthy → FN-rate 0; O2 disabled detector (perfect no-op) → FN-DETECTED; O3 CONSUMED-but-late → FN; O4 off-domain verdict; O5 no invented SLO → fail-loud. (Demonstrated red: blinding the oracle turns O2/O3/O4 red.)test-wake-reconcile.sh— R1 complete inventory; R2 omitted source → FLAG (vacuous-pass prevented); R3required_sourcesomission; R4 dangling; R5/R6 pre-existing state → flagged + enumerated (sole-feeder) → re-run 0; R7 inbox-accounted (no double-enumerate); R8 adapter error → FAIL LOUD (G2a); R9 serialized dual-allocator collision → reconciler FAILS LOUD, enqueues no aliasable seq (depth unchanged). (Demonstrated red: removing the guard re-enables the collision — R9 depth0→2— and turns R9 red.)Discipline
manifest.txt0.3.0 → 0.4.0+ inventory; schema range untouched.grep -niE 'jason|woltje|jarvis'= 0.Contract notes (flagged, not guessed)
observed_seq/inbox (per §4/G3 wording) + the reconciler's own durable reconciled-state ledger — deliberately not the detector's hash-file, so a silent first-seen baseline cannot swallow a pre-existing obligation. Consequence: a source consumed before the reconciler ever recorded it is enumerated once as a fail-safe backstop (in sole-feeder mode), then quiet.Part of #892
Record of Review — PR #909 W5 (FN-oracle + reconciler) — POST-5a-FIX, full-40, supersedes prior
VERDICT: APPROVE (GO on CI terminal-green). Reviewer: independent subagent
af4d2541(opus, per §4/G3/§7) — the SAME reviewer that FOUND the 5a defect, confirming the fix. ≠ builder (mosaic-coder).REVIEWED-HEAD (full-40):
7603cb1c10525fcd6cc5a6b582334cc66ec349e2.Original review (head
60efd6a0): 7/8 PASS, 1 BLOCKING (5a)FN-oracle OFF-DOMAIN (disabled detector at 0-wake → FN-DETECTED, the §4/A8 killer), parity inventory (no vacuous pass), reconcile-0-unaccounted, pre-existing enumeration, accounted-universe=observed_seq/inbox/ledger-not-detector-hash (G3-correct), store-API discipline, red-first O1-O5/R1-R8, gates — all PASS. Blocking: 5a observed_seq seq-aliasing swallow.
5a fix — delta re-review PASS (defect GENUINELY closed, verified not masked)
$STATE_DIR/detector(detector.sh mkdir -p on ANY poll incl silent baseline → always caught; W4 untouched) → REFUSE enumerate (obligation FLAGGED never swallowed, depth stays 0 = no aliasable seq);--allow-enumerateoverridden to still-refuse when a detector is present; sole-feeder write path runs only when ONE allocator exists (aliasing impossible). Reviewer RE-RAN its alpha/beta repro at the new head → FAIL LOUD, depth 0 (was 0→2); stripping the guard brings the collision back (load-bearing, not cosmetic). R9 regression encodes the repro; R5/R6 assert the enumerate path stays covered. Residual (operator asserts sole-feeder then launches a detector) = documented operator-contract breach, fail-closed by default, deferred to #908.GO for id-11 + merge at FULL-40
7603cb1c10525fcd6cc5a6b582334cc66ec349e2on CI terminal-green. #908 tracks the full store-side allocator unification (reachable, pre-pilot). Non-executor.GO — Gate-16 id-11 stamp, pinned to exact FULL head
7603cb1c10.Basis: verbatim RoRs — substance review 7/8 carried (fn-oracle/store/detector byte-unchanged) + the finder's delta re-review APPROVE (RoR 18953) at the fix head: the seq-aliasing swallow it discovered is verified GENUINELY CLOSED, not masked — reviewer re-ran its own alpha/beta repro (store depth stays 0, was 0→2), proved the guard load-bearing by mutation (R9), and validated the co-feed detection + sole-feeder gate. Reconciler now fails closed (flags, never swallows; refuses seq allocation under any collision possibility). #908 carries the full store-side allocator unification (reachable, pre-co-feed bound, per Mos re-scope). CI terminal-green. W5 of EPIC #892: FN-oracle (off-domain black-box canary — the false-negative blindspot killer) + parity/reconciler. Named executor: Mos (id-11), squash pinned.