Commit 22bce81
committed
fix(bridge): toWireRecord no longer assigns undefined to session_id/phase/plugin
Caught by live-cockpit audit: 6 of 7 continuous-loop scenarios
(emu/lich/naga/gorgon synthetic events, djinn.drift.observed, runtime.metrics,
plus pech.ledger.appended via the loop) were silently swallowed at the
TS-side schema-validate-before-emit gate.
Root cause: toWireRecord checks
if (record.session_id === undefined && event.session_id !== '')
to copy session_id off the envelope. When event.session_id is undefined
(no explicit publisher-supplied id), the comparison
undefined !== ''
evaluates TRUE, so the line writes
record.session_id = undefined
into the in-memory record. JSON.stringify drops undefined on the wire,
BUT validateEvent runs against the in-memory record BEFORE
serialization and rejects with "expected type string, got undefined
at /session_id" — bridge logs warning and drops event.
Fix: tighten all three convenience-copy guards to require a NON-EMPTY
STRING source value before assignment. Same pattern applied to
phase + plugin for symmetry. Direct probe verifies all 8 representative
synthetic event types now make it onto stdout where 0 did before.
No new top-level deps. TS tests still 394/0.1 parent d551efa commit 22bce81
1 file changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
70 | 83 | | |
71 | 84 | | |
72 | | - | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | | - | |
| 88 | + | |
76 | 89 | | |
77 | 90 | | |
78 | 91 | | |
| |||
0 commit comments