fix(dynamodb): align size() type semantics with AWS#672
Merged
vieiralucas merged 1 commit intomainfrom Apr 22, 2026
Merged
Conversation
- attribute_size returned string-length for N-type attributes, which made
size(count_n) = :10 evaluate to true with count_n = 10 because "10".len() == 2
is... not 10. That's not AWS behavior: size() is defined only for S, B, SS,
NS, BS, L, and M. On N, BOOL, or NULL it is a type mismatch.
- Drop the N and BOOL/NULL branches of attribute_size so size() returns None
on those types, which surfaces as false in FilterExpression (AWS's silent
filter-out on type mismatch).
- Unignore filter_functions_with_sdk_space_before_paren: switch `count` from
N("10") to S("1234567890") so size() still returns 10 and exercises both
the `size(X)` and `size (X)` spacings.
- Add filter_size_on_numeric_is_invalid to lock the type-mismatch semantics
(size on N, BOOL, and missing attributes all evaluate to false).
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Apr 22, 2026
Merged
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
attribute_sizereturned string-length for N-type attributes, sosize(count) = :tenwithcount = N("10")and:ten = N("10")evaluated to false ("10".len() == 2, not 10). That isn't AWS behavior:size()is defined only for S, B, SS, NS, BS, L, and M; on N, BOOL, or NULL it's a type mismatch that silently filters the row out in FilterExpression context.attribute_sizeso size() returnsNoneon those types, which flows tofalsein the filter evaluator.filter_functions_with_sdk_space_before_paren: switchcountfromN("10")toS("1234567890")so size() still returns 10 and exercises both thesize(X)andsize (X)spacings.filter_size_on_numeric_is_invalidlocking the new semantics (size on N, BOOL, and a missing attribute all evaluate to false).Test plan
cargo test -p fakecloud-dynamodb --libcargo test -p fakecloud-e2e --test dynamodbcargo clippy -p fakecloud-dynamodb --all-targets -- -D warningscargo fmt --allSummary by cubic
Fixes DynamoDB
size()evaluation to match AWS: it’s only valid for S, B, SS, NS, BS, L, and M. On N, BOOL, or NULL it now evaluates to false in filters, avoiding incorrect matches.attribute_sizesosize()returnsNonefor those types.filter_functions_with_sdk_space_before_paren; switchedcounttoS("1234567890")to keepsize()= 10 for bothsize(X)andsize (X).filter_size_on_numeric_is_invalidto assert false forsize()on N, BOOL, and missing attributes.Written for commit 3fef3f6. Summary will update on new commits.