Repository navigation
fix(workflow)!: return errors for invalid tuple input counts - #800
Merged
Merged
Conversation
Return InputCountMismatch instead of panicking when a decoded graph input list has the wrong length. Preserve codec failures as error sources and allow graph nodes to accept GraphCodec errors independently of the backend codec error type. Add regression coverage for public decoding and node execution, including valid wire bytes, handler isolation, and codec error sources. BREAKING CHANGE: GraphCodec for 2-12 element tuples now uses GraphFlowError for encode and decode, and codec errors must implement Into<BoxDynError>. Original codec errors remain accessible through the error source chain. Fixes apalis-dev#799
geofmureithi
approved these changes
Oct 30, 2026
Member
|
@RivTian thanks for your contribution as always. |
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.
Description
Fixes #799.
When an outer graph input payload decodes successfully but contains the wrong number of tuple elements,
GraphCodec::decodecurrently panics. The same input also makesGraphNodeService::callpanic synchronously throughNodeInput::Single.This change returns the existing
GraphFlowError::InputCountMismatch { expected, actual }before decoding elements. Invalid input never reaches the handler. Codec failures retain their original source, and successful encoded bytes and element order are unchanged. Node registration accepts graph-input errors independently of backend codec errors.Compatibility: for 2–12 element tuples, both
GraphCodec::encodeanddecodenow returnGraphFlowError, and codec errors must implementInto<BoxDynError>. Callers that previously downcast node errors directly to a codec error must follow the source chain. These changes are documented in rustdoc and the changelog.Type of Change
Testing
cargo fmtandcargo clippyThe regression tests failed at runtime against the original implementation at their no-panic assertions. The retained suite now passes all 24 tests, covering 2- and 12-element tuples, synchronous and asynchronous node execution, handler call counts, exact wire bytes, codec error sources, and all three node registration APIs. A
NodeInput::FanIncontrol exercises its separate serde decoding path.Local validation passed:
Checklist
Additional Notes
Validation used macOS arm64 and Rust 1.96.0. No dependency, lockfile, or CI workflow changes are included.