fix(dynamodb): SET complex RHS into nested paths#673
Merged
vieiralucas merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
- Split SET's RHS evaluation (if_not_exists, list_append, arithmetic, plain
value) out of the three apply_set_* helpers and into a single
evaluate_set_rhs that returns Option<Value>. The caller decides where to
write: item.insert (top-level), assign_list_index (indexed), or
assign_nested_path (dotted). Before: dotted LHS short-circuited to plain
resolve_value, so `SET a.b = a.b + :d` / `list_append(a.b, :l)` /
`if_not_exists(a.b, :v)` all fell through to None and errored.
- resolve_ref_or_path replaces resolve_value as the single SET-side operand
resolver; it handles value refs (:x) and document paths (top-level,
#name, dotted) by chaining resolve_projection_path with
resolve_nested_path.
- Unignore update_set_nested_path_complex_rhs and expand it to cover
arithmetic (+ and -), list_append, and both if_not_exists branches
(skip-when-present, write-when-missing) through a dotted LHS.
- Remove the now-obsolete update_set_nested_path_complex_rhs_errors_cleanly
guard: its assertion ("dotted complex RHS must error") directly
contradicts the positive test that now passes ("dotted arithmetic yields
count = 8").
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
resolve_value, soSET a.b = a.b + :d,SET a.b = list_append(a.b, :list), andSET a.b = if_not_exists(a.b, :v)all fell through toNoneand errored withValidationException. Real DynamoDB allows every SET RHS shape against every SET LHS, including dotted paths.apply_set_*helpers into a singleevaluate_set_rhsthat returnsOption<Value>. The caller then picks a destination:item.insert(top-level),assign_list_index(indexed), orassign_nested_path(dotted).resolve_ref_or_pathreplacesresolve_valueas the single SET-side operand resolver: handles value refs (:x) and document paths (top-level,#name, dotted) by chainingresolve_projection_pathwithresolve_nested_path.update_set_nested_path_complex_rhsand expand it to cover arithmetic (+/-),list_append, and bothif_not_existsbranches (skip-when-present, write-when-missing) through a dotted LHS.update_set_nested_path_complex_rhs_errors_cleanlyguard: its assertion ("dotted complex RHS must error") directly contradicts the positive test that now passes ("dotted arithmetic yieldscount = 8"). The positive test is strictly stronger coverage; silent-drop prevention is still locked in by the untouchedupdate_set_nested_path_errors_on_missing_parentand byevaluate_arithmetic_rhsreturningValidationExceptionon type mismatches.Last of the 4 PRs (#670, #671, #672 already merged) that together close every
#[ignore]inexpression_corpus_tests.rs.Test plan
cargo test -p fakecloud-dynamodb --lib(216 pass, 0 ignored — full corpus green)cargo test -p fakecloud-e2e --test dynamodb(46 pass)cargo clippy -p fakecloud-dynamodb --all-targets -- -D warningscargo fmt --allSummary by cubic
Enables complex
SETRHS on nested/dotted paths in DynamoDB updates (arithmetic,list_append,if_not_exists), fixing previousValidationExceptionerrors and matching real DynamoDB behavior.Bug Fixes
SET a.b = a.b +/- :d,SET a.b = list_append(a.b, :l), andSET a.b = if_not_exists(a.b, :v)now work with dotted paths and#nameplaceholders.:x) or document paths (top-level,#name, dotted).if_not_existswhen the target already has a value; structural path errors still surface.Refactors
evaluate_set_rhsto compute RHS once and returnOption<Value>; callers route to top-level insert, list index, or nested path.resolve_valuewithresolve_ref_or_pathby chainingresolve_projection_pathandresolve_nested_path.Written for commit dd528ed. Summary will update on new commits.