RFC: Subscription Typed Interrupt Payload - #631
Open
johnthecat wants to merge 1 commit into
Open
Conversation
This was referenced Sep 8, 2026
pgherveou
approved these changes
Sep 8, 2026
pgherveou
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, but please let's stop making RFC PR.
Let's just open an RFC issue that we can comment on and make a PR that implement it.
They should be also easier to parse and trimmed of most Claude bloat
Contributor
Author
|
Issues: #664 |
johnthecat
force-pushed
the
rfc/subscription-typed-interrupt-payload
branch
from
September 9, 2026 12:59
8133c08 to
b16b0c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC:
docs/rfcs/subscription-typed-interrupt-payload.md.First of a four-PR stack: Subscription Typed Interrupt Payload (#631) → Worker Lifecycle (#632) → Unified Renderer (#633) → Input Modality (#634). Each later RFC builds on the ones before it, so they merge in order.
Why this RFC exists
A live subscription cannot fail.
Subscription<Item>yields items only, so when the platform stream behindtheme.subscribeerrors, the runtime drops the error and the product's theme freezes. Methods declaredResult<Subscription<Item>, CallError<E>>send a typed_interruptonly at start, and the generated client reports a plain method's failure ascomplete. Host-initiated streams have no way to end with an outcome other than a bare decline byte.The Unified Renderer's
renderstream and the Input Modality'sInput::requestboth need a stream that ends with a typed value, so this comes first.What it defines
Subscription<Item, Interrupt>: a stream ofResult<Item, Interrupt>whose firstErris terminal and travels as the_interruptpayload. It replaces bothSubscription<Item>andResult<Subscription<Item>, CallError<E>>._interruptpayload is a normal end, delivered ascomplete._stopis unchanged. No protocol version bump.CallError<E>for a failure-only end, orResult<(), CallError<E>>when a normal end carries meaning.Subscription::interrupted(value)replacesSubscription::empty().ObservableLike<Item, Reason>and an interrupt decoder for every subscription; a product handler for a host-initiated method returnsSubscription<Item, Interrupt>and its typed error crosses the wire intact.Implementation
Part of this PR. The RFC lands first so the shape can be reviewed on its own.
truapi:Subscription<Item, Interrupt>,Subscription::interrupted, the 16 subscription signatures and their default bodiestruapi-codegen: one subscription kind in rustdoc classification, dispatcher and TS emitters, playground metadata; goldenstruapi-server:subscription_streammapsErrtoSubscriptionOutput::Interrupt; platform stream errors forwarded for theme, locale, chat list and preimage; host-initiated caller returns the declared interrupt type@parity/truapi:createObservabletreats an empty payload ascomplete, product-side host-initiated handlers encode a typed interruptwire_result_shape.rs,subscription.rs,client.test.ts