fix(dependency_resolver): map JSON parse errors to InvalidInput variant (#209)#245
Closed
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Closed
fix(dependency_resolver): map JSON parse errors to InvalidInput variant (#209)#245SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Conversation
Fix two CI failures from previous merge
Closes TrueNine#209. `topological_sort(input_json)` previously rolled JSON parse failures into `DependencyResolverError::MissingDependency` with `node_name: "invalid input: …"` and an empty `missing_dependency`. Downstream consumers matching on the serialised `kind` field — the discriminator declared by `#[serde(tag = "kind", rename_all = "camelCase")]` — would treat parse failures as graph problems instead of input-shape problems. Add an `InvalidInput { message: String }` variant and route the serde error there. The `kind` payload now reads `invalidInput`, which the JS-side wrapper (and any future consumer) can branch on cleanly without string-sniffing the `node_name`. The two existing variants and their behaviour are unchanged. Tests in `dependency_resolver.rs` gain `topological_sort_maps_invalid_json_to_invalid_input` (asserts the new variant + `kind: "invalidInput"` payload) and `topological_sort_handles_well_formed_input` (sanity that the happy path still produces a sorted list). 13/13 module tests pass.
Owner
|
Merged into dev via cherry-pick. The PR base was changed from main to dev, which caused conflicts because dev had diverged significantly. All commits have been cherry-picked onto dev and pushed. Thanks for the contributions! |
Owner
|
Thank you for the contribution! All commits have been cherry-picked and merged into the dev branch. 🙏 |
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.
Closes #209.
topological_sort(input_json)previously rolled JSON parse failures intoDependencyResolverError::MissingDependencywithnode_name: "invalid input: …"and an emptymissing_dependency. Downstream consumers matching on the serialisedkindfield — the discriminator declared by#[serde(tag = "kind", rename_all = "camelCase")]— would treat parse failures as graph problems.Add an
InvalidInput { message: String }variant and route the serde error there. Thekindpayload now readsinvalidInput, which the JS-side wrapper (and any future consumer) can branch on cleanly without string-sniffing thenode_name.Tests
topological_sort_maps_invalid_json_to_invalid_input: asserts the new variant fires for invalid JSON and the serialised payload haskind: "invalidInput".topological_sort_handles_well_formed_input: sanity check that the happy path still produces a sorted list.detects_missing_dependency/detects_simple_cycle/ etc. unchanged.Test plan
cargo test --manifest-path sdk/Cargo.toml --lib policy::dependency_resolver— 13/13 pass