Ticket #230: nativeFirst shadow mode — verification
- Date: 2026-11-11
- Branch:
ticket/230-shadow-mode - Base:
integration/native-firstat5eac805 - Issues: #230, parent #209/#227
- Unit gate:
npm run verify(strict typecheck + full test suite) - Live gate:
npm run test:live:native-first
Behavior
nativeFirst: "shadow" now runs the #215/#216 turn semantics into an invisible, in-memory sink:
- inbox/text/execution events create shadow turns and text parts using the same deterministic turn, user-message, and assistant-message identities;
- the pure #219 planner computes the routes that would be admitted, but no ledger is opened, no peer turn is created, and no refusal is posted;
- no durable message or turn is written, no patch/stream frame is published, and no Work card appears;
- at settlement the sink reads the native transcript once to compare the shadow final text with the visible path, then records a bounded comparison row and clears the in-memory turn/session state.
off and on are unchanged: off ingests nothing, on is the cutover path.
Comparison record
native.shadow.compare carries IDs, channel kind, text length and stableHash digest pairs, shadow/expected phase, visible-turn presence, planned user/final route counts, visible route count, the routing delta, and match booleans. The routing delta is data: the visible pre-cutover path cannot route a native turn, so a planned delta does not read as a mismatch. It never carries message text, prompt text, file bytes, or paths. In-memory comparison history is bounded to 32 rows and exposed as diagnostic.native.shadow.last; it is cleared on service stop/restart.
Verification
| Command | Result |
|---|---|
npm run verify | Pass — strict typecheck; 1810 tests passed, 0 failed, 0 skipped |
npm run test:live:native-first | Pass — main 65/65 checks, restart 16/16 checks, 0 gaps; shadow comparison rows logged |
The live restart phase now prompts a $Name mention and observes shadow.ingested: true, visiblePathUnchanged: true, comparisonRows: true, mentionPrompt: true, and a routing delta equal to the planned routes for the shadow fixture. The scenario fails on any recorded shadow gap and fails if the service logs carry the shadow prompt marker.
Safety
- Shadow mode cannot publish durable entity changes by construction: it never calls a store writer, scheduler, or router.
- Shadow state is cleared on settle, mode change, service stop, and restart.
- Service prompt content never appears in shadow logs or diagnostic rows.