fix(runtime): typed-fault train follow-ups#218
Open
mfw78 wants to merge 2 commits into
Open
Conversation
The batch call always returns Ok with one rpc-result per entry; the outer chain-error is reserved for a failure that stops the host producing any results at all. Spell that contract out so SDK consumers match on each entry rather than on the batch call.
A shape-mismatch on the orderbook app_data response previously kept only the serde error text. Fault carries no structured data field, so append a length-capped, char-boundary prefix of the raw body to the internal fault message to keep the response available for diagnostics on this already-unexpected path.
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.
Summary
Closes #206; part of the typed-fault train stacked on the epic-80 stack, merges in stack order.
This follows up on the 15-item list drawn up when the host-error teardown was still in flight.
Most of it turned out to already be done or superseded by the base branch,
feat/fault-teardown, which by the time this branch was cut had deletedHostError/host-error/host-error-kindrepo-wide, moved chain, cow-api, generic-interfaces and module-exports onto typed errors over the sharedFaultvocabulary, and swept the whole prose and diagram tree to match. Two items were genuinely live work; this PR implements them.Changes
docs(host-chain): rustdoc onrequest_batch(crates/nexum-runtime/src/host/impls/chain.rs) stating that the outerChainErroris reserved for a whole-batch failure, which this host never produces, versus a per-entryRpcResult::Err. Comment-only, no behaviour change.fix(cow-sdk):crates/shepherd-sdk/src/cow/app_data.rsfolds a length-capped, char-boundary-safe, ellipsised prefix of the raw orderbook response body into theFault::Internalshape-error message via a newtruncate_for_loghelper, restoring the diagnostic the olddata: Some(response)field used to carry. Updated the renamed test and added a new oversized-body truncation test.Dispositions of the remaining follow-ups
feat/fault-teardown: theFrom/TryFromwit-bindgen adapter, consumer migration offHostError, the 0.2 error-model docs reconciliation, migrating chain/cow-api/exports onto typed errors, retiring theHostErrorbridge, the prose rewrite acrossdocs/00-08and the migration guide, and the ADR-0009 superseded note pointing at ADR-0011.duplicated_attributesclippy lint flagged againstnexum-sdkdoes not surface under the pinned 1.94 toolchain; the crate is clean under-D warnings..mmddiagram sources carry no stalehost-errorreferences and no rendered.pngfiles exist to regenerate.Unsupportedplaceholders; and wiringretry_after_msfrom an alloy backoff hint, which is blocked becauseRpcErrorExt::backoff_hintispub(crate)inalloy-transportandTransportErrorKind::HttpErrordoes not carry response headers, so there is noRetry-Aftervalue to read without reimplementing alloy's private parsing. That gap also blocks aRetryAction::Backoffproducer, since there is no populatedretry_after_msto derive one from. Optional backoff/URL fields in payload-free logs are accepted as-is.Test plan
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test -p shepherd-sdk --all-features(28 unit tests, 3 doctests)nexum-runtimechange is a fenceless rustdoc comment validated by the clippy compile.Notes for reviewer
This is a small, mostly-dispositional PR: two real fixes plus a written-down accounting of why the other thirteen follow-ups are either already covered by
feat/fault-teardownor still genuinely deferred (and why). The alloybackoff_hintlimitation is worth a second look if anyone knows of a public alternative; absent that, treat theRetryAction::Backoffproducer as blocked rather than skipped.AI Assistance: Claude Code (Opus 4.8 implementation and adversarial review, Sonnet 5 PR authoring) used for the full change.