fix(wake): #924 route dead-letter quarantine alarm via WAKE_ALARM_SINK_CMD with per-observed_seq dedup (G2a) #929
Reference in New Issue
Block a user
Delete Branch "fix/wake-924-deadletter-alarm"
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?
Closes #924
Part of #892
Defect (G2a silent-degradation)
PR #920's per-entry drain QUARANTINE dead-letters a render-refused digest entry and raises its fail-loud alarm to stderr/journal-LOCAL only. A dead-lettered entry is STORE-ACCOUNTED (§2.3), so the reconciler never re-flags it — journal-local visibility means an unattended operator can permanently miss a real obligation: the entry is quarantined (not delivered), store-accounted (not re-flagged), and only visible in a local journal nobody is watching.
Fix
digest.sh's_quarantine_entrynow ALSO routes the same per-entry alarm throughWAKE_ALARM_SINK_CMD— reusing beacon.sh's (W6/#910) exact pluggable off-host alarm-sink adapter contract verbatim:sh -c "$WAKE_ALARM_SINK_CMD"with the alarm payload (JSON, namingobserved_seq) on stdin. The operator's adapter command resolves its target by-name internally; digest.sh inlines no endpoint/secret. This is in addition to, never instead of, the existing stderr diagnostic (kept unchanged).Fail-closed (mirrors beacon.sh's
_fire_alarm): an unconfigured (unset) or unreachable (non-zero exit)WAKE_ALARM_SINK_CMDproduces a LOUD stderr diagnostic naming the silent-no-alarm-host hazard — never a silent no-alarm. This failure is intentionally a per-entry diagnostic, not a whole-render exit-code failure: one bad/missing alarm target must never wedge delivery of the rest of the cumulative-state drain (#920's core no-head-of-line-blocking property is preserved).Dedup
Entries carry no per-entry
wake_id(that field is the per-render ack copy-run id minted bysign.sh); the entry's durable identity is its store-allocatedobserved_seq(#908's sole monotonic allocator — stable for the life of the entry). A durable alarmed-set file underSTATE_DIR(dead-letter-alarmed.set, oneobserved_seqper line, atomic-written via the existing_atomic_writeprimitive) records whichobserved_seqs have already been routed off-host, so:observed_seq) is not yet in the set, so it still routes its own one alarm.Red-first
Extends
test-wake-digest-quarantine.shwith groups Q6-Q9 (kept alongside the pre-existing #920 Q1-Q5 invariants, which remain green throughout):WAKE_ALARM_SINK_CMD(payload namesobserved_seq), AND the stderr diagnostic still fires.WAKE_ALARM_SINK_CMDunconfigured OR unreachable → FAIL LOUD diagnostic naming the hazard, never silent no-alarm; render still exits 0 (per-entry, not whole-drain).Proven RED against the pre-fix (stderr-only)
digest.shviagit stash(Q6-Q9 all fail: 0 alarms ever captured, no off-host fail-closed diagnostic exists), then GREEN after the fix, with Q1-Q5 unaffected throughout.Gates
.shfiles.verify-sanitized.sh: PASS (no operator identity/host leakage).pnpm run test:framework-shell: rc=0 normal AND withopensslmasked off PATH (command -v opensslempty) — the digest-quarantine harness has no openssl dependency.manifest.txtto0.6.6+ inventory blurb.Files changed
packages/mosaic/framework/tools/wake/digest.sh— the fix (only file with behavior changes;beacon.sh,store.sh,reconcile.shunchanged, adapter contract reused not modified).packages/mosaic/framework/tools/wake/test-wake-digest-quarantine.sh— Q6-Q9.packages/mosaic/framework/tools/wake/manifest.txt— version bump + changelog + inventory.fix(wake): #924 route dead-letter quarantine alarm via WAKE_ALARM_SINK_CMD with per-wake_id dedup (G2a)to fix(wake): #924 route dead-letter quarantine alarm via WAKE_ALARM_SINK_CMD with per-observed_seq dedup (G2a)Record of Review — PR #929 (issue #924): dead-letter quarantine alarm → off-host sink + dedup (G2a) — FINAL, CI-GREEN
VERDICT: APPROVE — GO. REVIEWED-HEAD (full-40):
74da62b336f0fb42e06e64147ff9230206649964. CI: TERMINAL-GREEN (pipeline 2077).Review basis
Independent reviewer
aae3edad(opus, ≠ buildermosaic-coder) — APPROVE, all 6 criteria PASS, criteria 2/3/4 independently REPRODUCED:74da62b3…; mergeable; id2 ≠ commit-authormosaic-coder; bodyCloses #924+Part of #892; delta = only digest.sh, manifest.txt, test-wake-digest-quarantine.sh; manifest 0.6.5→0.6.6._dlq_route_alarmuses beacon.shs exactWAKE_ALARM_SINK_CMDadapter (payload on stdin, target by-name, no framework-inlined endpoint — firewall clean); kept IN ADDITION to stderr. Reviewer repro: sink received 1 alarm naming observed_seq + stderr fired; unconfigured→FAIL LOUD (silent-no-alarm named), failing→FAIL LOUD (UNREACHABLE)._dlq_*usereturnNOTexit(deliberate correct adaptation vs beacon.shs exit). Mixed-feed repro (bad + 2 clean, sink=false): render rc=0, both clean siblings delivered, bad excluded+dead-lettered, FAIL LOUD fired, alarmed.set left UNMARKED (failed route retries, not falsely deduped). #920 no-head-of-line-block property holds.$STATE_DIR/dead-letter-alarmed.set(atomic, one seq/line, mode 0600). Repro: 6 fresh-process drains (=restarts) of the same dead-lettered entry → EXACTLY 1 off-host alarm (stderr fires each — local leg not deduped); new distinct seq → its own 1 alarm. observed_seq = #908 sole-allocator unique+durable per-obligation id → sound key._quarantine_entry+ new_dlq_*helpers touched; scrub/exit-4/two-tier unchanged; alarmed.set separate from dead-letter.jsonl.Non-blocking follow-ups
(1) PR title said "wake_id" (code correctly uses observed_seq) — CORRECTED in-place. (2)
_dlq_alarm_offhostis check-then-act without a lock → two concurrent renders on one STATE_DIR could double-route; UNREACHABLE in the per-host single-instance deployment (digest drains single-instance via the detector daemon flock) — non-blocking, noted for if concurrent renders ever become possible.6-check — GO
74da62b336f0fb42e06e64147ff9230206649964✓ · 3. reviewer(aae3edad)≠builder durable RoR ✓ · 4. reviewed==CI==merge-head all74da62b3✓ · 5. bodyCloses #924+Part of #892✓ · 6. queue-guard at merge.GO for id-11 + squash-merge at FULL-40
74da62b336f0fb42e06e64147ff9230206649964. Closes #924 (G2a: dead-letter obligations now reach an off-host alarm, deduped per observed_seq). Non-executor.GO — Gate-16 id-11 stamp, pinned to exact FULL head
74da62b336.Basis: verbatim FINAL RoR (comment 19213) — independent review APPROVE 6/6 with the load-bearing interaction reproduced: the sink-routing fail-closes PER-ENTRY (return-not-exit) so #920's no-head-of-line guarantee survives even an alarm-path failure; dedup keys on observed_seq (the durable store identity — MS-LEAD's in-place title correction was right) and held exactly-once across six drains and restarts. Closes #924 — the G2a silent-miss is fixed: a dead-lettered obligation now reaches an off-host alarm exactly once, never vanishing into a journal. Part of #892. Named executor: Mos (id-11), squash pinned.