feat(dynamodb): TableId, TableClass, OnDemandThroughput; fix deletion-protection error (#1457)

* fix(dynamodb): Limit caps scanned items and index scans carry full cursor

Scan Limit now bounds items read (not matched), returning a cursor when items
remain. Index scans build a LastEvaluatedKey that includes the index key
attributes alongside the base table key, so paging across tied index sort keys
walks every item exactly once. Closes 2 conformance failures.

* feat(dynamodb): TableId, TableClass, OnDemandThroughput; fix deletion-protection error

Generate a stable TableId per table; parse and round-trip TableClass
(TableClassSummary) and OnDemandThroughput on Create/UpdateTable. DeleteTable
under deletion protection now returns ValidationException (protected against
deletion) matching AWS. Closes 7 conformance failures.

* test(dynamodb): expect ValidationException for deletion-protected DeleteTable

This change makes DeleteTable on a deletion-protected table return a
ValidationException to match AWS, so update deletionProtectionEnabled,
which still asserted ResourceInUseException.

Verified against moto/AWS DDB parity: DeletionProtectedException is a
ValidationException.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-06-19 20:22:07 -05:00
1 parent 8e23e740e7
commit cc70efbad2
5 files changed
+123 -28

No files matched your search

@@ -2194,7 +2194,8 @@ given()
.statusCode(200)
.body("Table.DeletionProtectionEnabled", equalTo(true));
// DeleteTable is blocked
// DeleteTable is blocked. AWS returns a ValidationException (not
// ResourceInUseException) when deletion protection is enabled.
given()
.header("X-Amz-Target", "DynamoDB_20120810.DeleteTable")
.contentType(DYNAMODB_CONTENT_TYPE)
@@ -2204,7 +2205,7 @@ given()
.when().post("/")
.then()
.statusCode(400)
.body("__type", equalTo("ResourceInUseException"));
.body("__type", equalTo("ValidationException"));
// UpdateTable to disable deletion protection
given()