Skip to content

fix: host container terminal frames#228

Draft
decrypto21 wants to merge 2 commits into
mainfrom
fix/host-container-terminal-frames
Draft

fix: host container terminal frames#228
decrypto21 wants to merge 2 commits into
mainfrom
fix/host-container-terminal-frames

Conversation

@decrypto21

Copy link
Copy Markdown
Contributor

DRAFT - do not merge. Gate: paired with the truapi flat-restore as one conformance change.

What
The container previously left the product side hanging whenever a fault occurred before or during a handler - a synchronous throw, a rejected promise, an unsupported version tag, or an undecodable payload produced no response frame at all. This mirrors the old truapi D1 silence, on the novasama side (tracked as D5 in truapi#271).

Every served request now answers the method's catch-all error frame, and every subscription its default interrupt, on all fault paths:

Handler throw / reject - wrapped so the terminal error/interrupt is sent with the thrown reason instead of hanging.
Undecodable payload (bad version tag or malformed bytes) - the decode-fault guard reads the frame header, confirms the payload really is undecodable, and answers a typed terminal frame instead of dropping silently. A plausible-but-unsupported version tag is reported as an unsupported version; arbitrary malformed bytes (including an out-of-range leading byte) as a bad message format.
Subscription start throw / bad start - answers the default interrupt.
This extends the guarantee the framework already gave for not-implemented (makeNotImplementedSlot) and permission-denied (the permission-gated slots) to the throw/decode paths.

Evidence
Executed against main before the fix (592dc4b), createContainer sent no frame on R3 (handler throw), R4 (unsupported version), R8 (undecodable payload), S3 (subscription start throw), and S4 (bad subscription start) - the caller hung until its own timeout.

With this fix, all six fault paths answer typed terminal frames. Verified standalone:

29/29 vitest (11 new in createContainer.spec.ts, incl. the malformed-vs-unsupported-version case)
typecheck clean, lint 0 errors

The container previously left the product side hanging whenever a fault
occurred before or during a handler: a synchronous throw, a rejected
promise, an unsupported version tag, or an undecodable payload produced
no response frame at all. This mirrors the old truapi D1 silence, on the
novasama side (tracked as D5).

Every served request now answers the method's catch-all error frame and
every subscription its default interrupt on all fault paths:

- Handler throw/reject: wrapped so the terminal error/interrupt is sent
  with the thrown reason instead of hanging.
- Undecodable payload (bad version tag or malformed bytes): the transport
  drops these before any handler runs, so a decode-fault guard reads the
  frame header, confirms the payload really is undecodable, and answers
  the catch-all terminal frame. Unknown action ids keep the existing drop
  behavior (no response channel exists).
- Chain frames answer through the same catch-all machinery.

createContainer.spec.ts covers all six fault paths for both requests and
subscriptions plus the unchanged not-implemented / domain-error paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant