feat(host): exports return fault and the host-error envelope dies#217
Open
mfw78 wants to merge 2 commits into
Open
feat(host): exports return fault and the host-error envelope dies#217mfw78 wants to merge 2 commits into
mfw78 wants to merge 2 commits into
Conversation
Module exports (init/on-event/evaluate) now return result<_, fault>. Module identity is the supervisor's business, so the domain self-naming and message-prefix duplication in modules die: the supervisor derives its error metric label and log kind from the fault label via HostFault, dropping the per-dispatch format debug allocation. host-error and host-error-kind are deleted from types.wit and every mirror: the runtime host constructors, both guest SDKs, both SDK test crates, and the module glue. From<ChainError> for Fault folds a chain error into the shared vocabulary so a strategy aggregating store and chain calls returns one fault. ADR-0011 records the per-interface error model. All module wasms rebuild; the supervisor e2e suite runs for real.
Sweep the prose docs to match the shipped host-error teardown: WIT snippets, Rust code samples, mapping tables, and mermaid sources now describe per-interface typed errors (chain-error, cow-api-error) over the shared fault vocabulary instead of the deleted host-error / host-error-kind envelope. Module exports return result<_, fault>, and identity, local-store, remote-store and messaging report fault directly. ADR-0011 stays the record of the change; ADR-0009 gains a superseded note pointing at it, and the migration guide now presents fault as the 0.2 error destination that other chapters link to.
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 #211; part of the typed-fault train stacked on the epic-80 stack, merges in stack order.
init,on-event, andevaluatenow returnresult<_, fault>and thehost-errorenvelope is gone from the wire, both SDKs, and every module.Changes
host-errorandhost-error-kindfromtypes.wit;event-module.witandquery-module.witswitch their exports toresult<_, fault>.nexum-runtime:host/error.rsdrops the unusedunimplemented/internal_errorconstructors and addsfault_label/fault_message; the supervisor derives its metric label and logkind/messagefrom the fault label instead of aformat!("{:?}")allocation on the oldHostError;DispatchOutcome::HostErrorbecomesDispatchOutcome::Fault.nexum-sdk: removedHostError/HostErrorKindand theirFromimpls, addedFrom<ChainError> for Fault(theRpccase folds toFault::Internal, preserving the node code, message, and revert bytes) andsdk_fault_into_witin the bindgen macro, replacingconvert_err/sdk_err_into_wit.fault;flaky-bombloses itsstore_faultshim entirely.docs/adr/0011-per-interface-typed-errors.mdand swept the fulldocs/prose tree (overview chapters, migration guide, tutorial, diagrams, operations, production, qa-signoff, and the linker-extension-seam design note) to describe the fault model instead of the retired envelope, annotating ADR-0009 as superseded in part.Test plan
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-features(200nexum-runtimeunit tests plus all crate suites and doctests, 0 failed, 0 skipped)RUSTFLAGS="-D warnings", both in the scratch target and in-tree, so the supervisor e2e and harness tests ran for real (noSKIP:notes)rg 'host-error|HostError|host_error' docs/returns matches only inside ADR-0011 (the record of the change) and ADR-0009 (its historical body, now flagged superseded)Notes for reviewer
The
shepherd_module_errors_totalerror_kindlabel value changes shape: it was Debug-cased (for exampleInvalidInput) and is now the snake_case fault vocabulary (invalid_input). Anything scraping that label needs updating alongside this merge.fault_label/fault_messageare implemented runtime-local rather than pulling innexum-sdk'sHostFault, since the runtime does not and should not depend on the guest SDK; the label deliberately mirrors theHostFaultsnake_case vocabulary so the two stay readable side by side.Module faults drop the old
code/data/domainfields and message prefixes per the fault spec, so thebalance-trackerwarn-log test now asserts on"rpc down"rather than the numeric"503"code.Two follow-ups are intentionally out of scope: the diagram
.mmdsources are updated but the committed.pngrenders are stale (regeneration needsmermaid-cli, unavailable in this environment), anddocs/production.mdcarries roughly thirty pre-existing em-dashes unrelated to this change that still want a house-style pass.AI Assistance: Claude Code (Opus 4.8 implementation and adversarial review, Sonnet 5 PR authoring) used for the full change.