fix: flat error wire#285
Draft
decrypto21 wants to merge 2 commits into
Draft
Conversation
Error responses and subscription interrupts carry the flat domain error on
the wire — [version][Err][domain bytes] for responses, [version][domain
bytes] for interrupts — matching the Ok arm's hoisted version tag and the
shape every deployed host and the 0.3.x client line speak. Framework-level
CallError variants (Denied, Unsupported, MalformedFrame, HostFailure) fold
into the method's domain catch-all with their reason preserved; the codegen
resolves each method's catch-all constructor (Unknown { reason },
Unknown(GenericError), or a unit Internal) from the extracted enum variants
and fails loudly for error enums that have none.
Natural end of a subscription stream no longer emits an empty interrupt
frame; only an explicit interrupt carries a terminal frame.
The generated TS client decodes the same flat shape, and the handshake
codec in client.ts matches. The scale.ts CallError codec is gone from the
public surface: CallError never appears on the wire.
Differential conformance probes (truapi-server dispatcher vs the novasama
host-container at triangle-js-sdks 592dc4b) now produce byte-identical
error frames for the same domain error, and the published @parity/truapi
0.3.2 codecs decode the core's frames correctly (previously
Domain(PartialPayment) silently decoded as InsufficientFunds).
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.
DRAFT - do not merge. Gate: the release-direction decision (restore flat vs the #259 versioned tier) and this reverts published releases. Tracked as the reference/core-side (D4) divergence in #271.
What
Error responses and subscription interrupts now carry the flat domain error on the wire, matching the Ok arm's hoisted version tag and the shape every deployed host and the 0.3.x client line already speak:
Framework-level CallError variants (Denied, Unsupported, MalformedFrame, HostFailure) fold into the method's domain catch-all. The codegen resolves each method's catch-all constructor from the extracted enum variants and fails loudly for error enums that have none. The reason is preserved where the catch-all carries one (Unknown { reason } or Unknown(GenericError)); a unit catch-all (e.g. CoinPaymentError::Internal) has nowhere to carry it, so the reason is dropped and the framework variants collapse onto that one discriminant - documented at the fold site and on the variant.
@parity/truapi 0.4.0 (#279), 0.4.1 (#284), and @parity/truapi-host 0.1.0 (#278) shipped a richer, tiered CallError shape. Clients on the flat 0.3.x decoder read the new tagged variants positionally and silently mis-map them - no crash, wrong meaning. Executed byte-evidence:
PartialPayment{…} → decoded as InsufficientFunds
Denied{reason} → decoded as InvalidSource
The fleet is safe only because product-sdk-host pins @parity/truapi: ^0.3.2 - the caret caps below 0.4.x. The misread goes live on the first bump past 0.3.x (or when host-api-test-sdk#40 adopts 0.1.0) - and 0.4.1 bundling the Firefox iframe fix (#283) now gives a concrete reason to bump.
Evidence
Re-ran the differential probe against this commit and the fixed novasama host:
Scope
The scratch differential-probe crate (rust/crates/probe/), the Cargo.lock bump, and the pub mod dispatcher visibility tweak are local-only and deliberately not part of this PR.
Relates to #271 (D4)