feat(stepfunctions): real UpdateExpression eval for dynamodb:updateItem#762
Merged
vieiralucas merged 3 commits intomainfrom Apr 25, 2026
Merged
feat(stepfunctions): real UpdateExpression eval for dynamodb:updateItem#762vieiralucas merged 3 commits intomainfrom
vieiralucas merged 3 commits intomainfrom
Conversation
Step Functions Task -> dynamodb:updateItem previously merged Key + the
ExpressionAttributeValues map directly into the existing item, ignoring
the UpdateExpression's clause structure. Counter increments, conditional
set operations, attribute removal, and set deletes all silently failed
or wrote the wrong shape.
The new evaluator parses up to four clauses (SET, REMOVE, ADD, DELETE)
in any order, splitting the body of each on top-level commas (so commas
inside `if_not_exists(a, :b)` don't fragment assignments), and supports:
- SET path = :v, SET path = path + :inc, SET path = path - :dec
- SET path = if_not_exists(path, :default)
- REMOVE path1, path2
- ADD path :n (numeric increment, initializes when absent)
- DELETE path :elements (subtract elements from SS/NS/BS sets, drop the
attribute if the resulting set is empty)
DynamoDB number wire format ({"N":"<str>"}) is preserved on arithmetic.
Nine unit tests cover each clause, mixed-clause expressions, increment,
decrement, if_not_exists in both branches, and set element removal.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-stepfunctions/src/interpreter.rs">
<violation number="1" location="crates/fakecloud-stepfunctions/src/interpreter.rs:1619">
P2: `n as i64` saturates for whole-number f64 values outside the i64 range, silently corrupting the formatted number. Add a range check before the cast.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Cubic flagged saturating cast in format_number — large whole-number f64 values outside i64 range silently truncated. Add MIN/MAX bounds check; fall through to default f64 formatting when out of range.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-stepfunctions/src/interpreter.rs">
<violation number="1" location="crates/fakecloud-stepfunctions/src/interpreter.rs:1618">
P2: The inclusive `f64` bound check still allows `2^63`, which then saturates on `as i64` and formats to an incorrect value.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Cubic flagged inclusive bound: `i64::MAX as f64` rounds up to 2^63 (i64::MAX is 2^63-1, not exactly representable). Casting 2^63 back to i64 saturates. Use `n < i64::MAX as f64` so saturating values fall through to default f64 formatting.
Codecov Report❌ Patch coverage is
📢 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
Key + ExpressionAttributeValuesmerge with a realUpdateExpressionevaluator that parses up to four clauses in any order (SET,REMOVE,ADD,DELETE)SETsupportspath = :v,path = path + :inc,path = path - :dec, andpath = if_not_exists(path, :default)ADDis numeric increment with implicit initialization when the attribute is absentDELETEsubtracts set elements fromSS/NS/BSand drops the attribute when the resulting set is empty{"N":"<str>"}) preserved on arithmetic; comma splitting respects parentheses soif_not_exists(a, :b)doesn't fragment assignmentsTest plan
if_not_existsboth branches, multi-clauseSET ... ADD ... REMOVEsetkeyword + alias attribute names included)cargo clippy --workspace --all-targets -- -D warningscleancargo fmt --checkcleanSummary by cubic
Adds a real DynamoDB
UpdateExpressionevaluator fordynamodb:updateItem, supportingSET,REMOVE,ADD, andDELETE. Fixes incorrect merges so increments, conditional sets, attribute removal, and set deletes follow DynamoDB semantics.New Features
SS/NS/BS; drops the attribute when empty.Keywhen no item exists.Bug Fixes
i64::MAXbound to avoid truncation or saturation on large whole numbers.Written for commit 29b99c0. Summary will update on new commits.