Skip to content

fix: enforce 32-level attribute nesting depth on writes#123

Merged
pdf-amzn merged 1 commit into
ExtendDB:mainfrom
yesyayen:fix/update-item-nesting-depth-validation
May 29, 2026
Merged

fix: enforce 32-level attribute nesting depth on writes#123
pdf-amzn merged 1 commit into
ExtendDB:mainfrom
yesyayen:fix/update-item-nesting-depth-validation

Conversation

@yesyayen
Copy link
Copy Markdown
Contributor

What

DynamoDB rejects items whose Map or List values exceed 32 total nesting levels (31 wrappers above a scalar) with ValidationException ("Nesting Levels have exceeded supported limits"), per https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Constraints.html.

The cap applies to values that get stored as item attributes:

  • PutItem.Item,
  • UpdateItem.AttributeUpdates.<n>.Value,
  • UpdateItem.UpdateExpression SET targets resolved through ExpressionAttributeValues,
  • BatchWriteItem.PutRequest.Item,
  • TransactWriteItems.Put.Item, the same SET-via-EAV (ExpressionAttributeValues) path inside TransactWriteItems.Update,
  • ImportTable per-item content

Why

Closes the L-1 Attribute nesting depth tech-debt in docs/technical-debt.md and the Attribute nesting depth (32 levels) entry in docs/dynamodb-limits.md "Unenforced Limits Requiring Tracking".

Testing done

New tests added:

  • 9 unit tests for the depth check in crates/core/src/validation/mod.rs (boundary, mixed Map/List, iterator helper, recursion-coverage on multiple top-level attributes / wide Map / wide List).
  • 5 unit tests for the placeholder walker in crates/core/src/expression/resolver.rs (direct reference, function args, arithmetic, nested function, path-only).
  • 15 pytest cases in tests/test_item_operations.py::TestNestingDepth

Documentation

  • docs/dynamodb-limits.md: flips the Attribute nesting depth row in the Items table from Not enforced to Enforced, points at validate_item_nesting_depth and the call sites, removes the limit from the Unenforced Limits Requiring Tracking checklist, and updates the enforcement-coverage summary (Items: 5/0/1 → 6/0/0; Total: 28/0/18 → 29/0/17).
  • docs/technical-debt.md: removes the L-1 Attribute nesting depth row from Unenforced DynamoDB Limits and renumbers the remaining entries.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy --all-targets --workspace -- -D warnings)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)

Breaking changes

None.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0 and I agree to the Developer Certificate of Origin (DCO). See CONTRIBUTING.md for details.

@pdf-amzn
Copy link
Copy Markdown
Collaborator

please rebase and resolve conflicts

Comment thread crates/engine/src/update_item.rs Outdated
Copy link
Copy Markdown
Collaborator

@jcshepherd jcshepherd left a comment

Choose a reason for hiding this comment

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

Overall looks okay. Please rebase/merge and resolve conflicts, then we can merge.

@yesyayen yesyayen force-pushed the fix/update-item-nesting-depth-validation branch from 08475d6 to 5403445 Compare May 27, 2026 21:29
@yesyayen yesyayen requested a review from jcshepherd May 27, 2026 21:35
@yesyayen yesyayen force-pushed the fix/update-item-nesting-depth-validation branch 2 times, most recently from cbbbbf0 to 3376a42 Compare May 28, 2026 23:57
Comment thread docs/dynamodb-limits.md
The following unenforced limits are tracked in `docs/technical-debt.md`:

1. **Provisioned capacity decrease limit** (27/day) — would require per-table decrease counter with hourly replenishment
2. **Attribute nesting depth** (32 levels) — requires recursive depth check in attribute value validation
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The next time we touch this we should either switch to an unnumbered list or number them all 1. and let the markdown renderer number them, to minimize merge conflicts

Real DynamoDB rejects PutItem / UpdateItem / BatchWriteItem.PutRequest /
TransactWriteItems.Put / ImportTable items whose Map or List values nest
beyond 32 total levels (31 wrappers above a scalar) with
ValidationException. ExtendDB previously accepted them.

Closes the L-1 Attribute nesting depth row in docs/technical-debt.md and
flips docs/dynamodb-limits.md from Not enforced to Enforced.
@pdf-amzn pdf-amzn force-pushed the fix/update-item-nesting-depth-validation branch from 3376a42 to 47191ef Compare May 29, 2026 03:05
@pdf-amzn pdf-amzn merged commit 0448ca0 into ExtendDB:main May 29, 2026
3 checks passed
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.

3 participants