Skip to content

Fix redundant ConditionExpression parentheses validation#9847

Merged
bpandola merged 1 commit intogetmoto:masterfrom
SergioChan:fix-dynamodb-redundant-parentheses
Mar 11, 2026
Merged

Fix redundant ConditionExpression parentheses validation#9847
bpandola merged 1 commit intogetmoto:masterfrom
SergioChan:fix-dynamodb-redundant-parentheses

Conversation

@SergioChan
Copy link
Contributor

Summary

  • reject redundant boolean-group parentheses in DynamoDB condition expressions when the grouped clause does not change precedence (for example a OR (b AND c))
  • raise InvalidConditionExpression with AWS-aligned message The expression has redundant parentheses;
  • add regression coverage for both the rejected redundant case and an allowed precedence-changing case (a AND (b OR c))

Testing

  • python -m pytest tests/test_dynamodb/test_dynamodb_condition_expressions.py -k "redundant_parentheses or allows_required_parentheses"
  • python -m pytest tests/test_dynamodb/test_dynamodb_condition_expressions.py

Related

Fixes #9574

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (c7b3d3c) to head (bd93d0a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9847   +/-   ##
=======================================
  Coverage   93.12%   93.12%           
=======================================
  Files        1308     1308           
  Lines      118884   118900   +16     
=======================================
+ Hits       110706   110723   +17     
+ Misses       8178     8177    -1     
Flag Coverage Δ
servertests 28.89% <88.23%> (+<0.01%) ⬆️
unittests 93.09% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@bpandola bpandola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergioChan Thanks. Nice work.

@bpandola bpandola merged commit b01bd65 into getmoto:master Mar 11, 2026
134 of 136 checks passed
@bpandola bpandola added this to the 5.2 milestone Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamodb doesn't catch redundant parenthesis error on condition expression

2 participants