Skip to content

fix(runtime): typed-fault train follow-ups#218

Open
mfw78 wants to merge 2 commits into
feat/fault-teardownfrom
fix/fault-train-followups
Open

fix(runtime): typed-fault train follow-ups#218
mfw78 wants to merge 2 commits into
feat/fault-teardownfrom
fix/fault-train-followups

Conversation

@mfw78

@mfw78 mfw78 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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 deleted HostError/host-error/host-error-kind repo-wide, moved chain, cow-api, generic-interfaces and module-exports onto typed errors over the shared Fault vocabulary, 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 on request_batch (crates/nexum-runtime/src/host/impls/chain.rs) stating that the outer ChainError is reserved for a whole-batch failure, which this host never produces, versus a per-entry RpcResult::Err. Comment-only, no behaviour change.
  • fix(cow-sdk): crates/shepherd-sdk/src/cow/app_data.rs folds a length-capped, char-boundary-safe, ellipsised prefix of the raw orderbook response body into the Fault::Internal shape-error message via a new truncate_for_log helper, restoring the diagnostic the old data: Some(response) field used to carry. Updated the renamed test and added a new oversized-body truncation test.

Dispositions of the remaining follow-ups

  • Already done in feat/fault-teardown: the From/TryFrom wit-bindgen adapter, consumer migration off HostError, the 0.2 error-model docs reconciliation, migrating chain/cow-api/exports onto typed errors, retiring the HostError bridge, the prose rewrite across docs/00-08 and the migration guide, and the ADR-0009 superseded note pointing at ADR-0011.
  • Confirmed non-issue: the duplicated_attributes clippy lint flagged against nexum-sdk does not surface under the pinned 1.94 toolchain; the crate is clean under -D warnings.
  • Moot: cow-api docs, ADRs and .mmd diagram sources carry no stale host-error references and no rendered .png files exist to regenerate.
  • Deferred, out of scope for this PR: richer fault cases for the remote-store, identity and messaging backends, which have not landed yet and still report Unsupported placeholders; and wiring retry_after_ms from an alloy backoff hint, which is blocked because RpcErrorExt::backoff_hint is pub(crate) in alloy-transport and TransportErrorKind::HttpError does not carry response headers, so there is no Retry-After value to read without reimplementing alloy's private parsing. That gap also blocks a RetryAction::Backoff producer, since there is no populated retry_after_ms to derive one from. Optional backoff/URL fields in payload-free logs are accepted as-is.

Test plan

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test -p shepherd-sdk --all-features (28 unit tests, 3 doctests)
  • No WIT, boot or dispatch paths touched, so no e2e wasm build required; the nexum-runtime change 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-teardown or still genuinely deferred (and why). The alloy backoff_hint limitation is worth a second look if anyone knows of a public alternative; absent that, treat the RetryAction::Backoff producer 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.

mfw78 added 2 commits July 6, 2026 03:56
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.
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