Repository navigation
fix(engine): list batch table faults after the table count clause - #1268
LeeroyHannigan wants to merge 5 commits into
Conversation
A BatchWriteItem with more than 25 tables, or a BatchGetItem with more than 100, got the table count clause alone. DynamoDB lists the table count clause first, then each table with no request or too many. One refusal lists at most 10 clauses, the table count clause among them. DynamoDB listed the tables in a different order from one send to the next. `check_batch_counts` now puts the table count first in the list of failed counts, so one refusal names both. The header counts the clauses that the refusal lists. A request within the table count gets the same answer as before. Measured in us-east-1 on 20 November 2026, each request sent twice, with names of tables that do not exist. Fixes #1233.
…-tables count_error keeps this branch's paths and passes its clauses to validation_refusal, which now writes the header. The comment over CLAUSE keeps this branch's text with the dates of the quoted answers.
One BatchWriteItem of 26 tables named one table by the ARN of another account and gave another table no request. DynamoDB answered with the table count clause, then the clause of the table with no request (measured 2026-11-20). The server reads the ARN in its cross-account check, so only a wire row reaches that path. The new row of test_batch_write_too_many_items names one table by a table ARN in account 000000000000 and expects that answer.
type_fault kept the table count clause only for the strings "true" and "false" where a boolean goes. Over the table count, DynamoDB answered the count clause for a ConsistentRead of "TRUE", "True", "1", "yes", "FALSE" or "0" too. Its echo of each request read the string as a boolean (measured 2026-11-25). Before this change, those requests got a SerializationException, where #1268 gave the count clause. type_fault now keeps the count clause for each string that reads_as_boolean accepts. That function reads BOOLEAN_TEXTS, the list of strings that the Query shape check already uses, and shape_fault_first calls it too. Another string, such as "x", keeps the SerializationException, as DynamoDB answered on 2026-11-21. The unit table and the wire table get rows for "TRUE", "1", "false" and "x". Against DynamoDB, the wire table now accepts a table count clause that quotes the request map, as DynamoDB gave on 2026-11-21 and 2026-11-25. Against ExtendDB it still compares the full text. Refs #1266.
demohan
left a comment
There was a problem hiding this comment.
BatchGetItem's table faults follow the table count clause as on the service at 82e3501, and BatchWriteItem's do not. With 42 shapes sent twice to us-east-1 and to this head and its base on SQLite and PostgreSQL, the two backends agree everywhere; on BatchGetItem (101 or 150 tables with empty ones, tables over 100 keys, an ARN of another account, a short name) this head matches both of the service's answers on every shape, one byte for byte, where the base matched 2 of 14, and the service named a different 9 of 10 tables on each send, as the cap here allows. On BatchWriteItem the service answered all 42 over-count requests in the quoted request-map form, at most two clauses (the quoted count clause, then one map-value clause for every faulty table), and this head matches neither answer on any of the 21 shapes: for 26 tables with 9 empty it gives 10 member-path clauses where the service gives 2. That form comes from #1234, and our review of #1215 asks for the quoted form. The three mutations fail the unit test, all 10 new Python rows fail on a server with the base's early return, fmt, clippy, 934 engine tests, test_batch.py on both backends and the 1.91.1 check are clean, and every CI run at this head was cancelled. Onto main at 222d80a the only conflict is the base's in partiql/request_checks.rs; resolved, it passes 979 engine tests and answers as this head.
I will approve once BatchWriteItem's table faults follow the service's quoted form, and a table ARN of another account answers before the counts in BatchWriteItem.
| .then(|| ("RequestItems".to_owned(), tables.len())) | ||
| .into_iter() | ||
| .chain(tables.iter().filter_map(|&(t, count)| { | ||
| let n = count.filter(|&n| n == 0 || n > limit)?; |
There was a problem hiding this comment.
For BatchWriteItem this lists one member-path clause per faulty table; the service gives the quoted count clause and then a single Map value must satisfy constraint clause covering every faulty table, on all 21 shapes twice. The nine-table cap here fits only the member-path form. BatchGetItem's form here is right.
There was a problem hiding this comment.
5559914, the merge of #1234's new head, gives BatchWriteItem that form. The quoted table count clause comes first, then one Map value must satisfy constraint clause that quotes the whole map for all faulty tables. DynamoDB gave those two clauses on 2 December, both sends, for 26 and 30 tables with an empty table. It gave them for 26 tables with 9 or 10 empty tables, and for an empty table beside a table of 26 too. The cap of nine table clauses stays for BatchGetItem only.
| (OTHER_ACCOUNT + p if i == 13 else p, r) | ||
| for i, (p, r) in enumerate(_writes(26, {5})) | ||
| ], | ||
| [5], |
There was a problem hiding this comment.
This row fails against the service 2 of 2: with a table ARN of another account among 26 BatchWriteItem tables, the service answers Invalid request! All tables in the request must be from a single account. before any count check, and the two-table variants get the same sentence; this head runs the counts first (cross_account.rs:324). BatchGetItem applies the counts first on the service, as here. With the QUOTED escape at line 195 removed, all 7 BatchWriteItem over-count rows fail against the service, twice, so they check nothing about its answer. The body's 871 engine and 36 Python tests are now 934 and 37.
There was a problem hiding this comment.
5559914 removes the row. On 2 December DynamoDB answered Invalid request! All tables in the request must be from a single account. for this request and for two smaller ones, both sends, before any count check. Main runs the counts first too: cross_account::refuse calls check_request_item_counts before it returns that sentence. So this PR did not change the order, and #1548 tracks it. The QUOTED escape is gone, and the body has the counts of this head.
…-tables The base now refuses a BatchWriteItem outside its counts in the quoted request map form, as DynamoDB answered on 25 Nov and 2 Dec 2026. Both branches changed check_batch_counts and its tests. The merge keeps this branch's order, the table count clause first and then the table faults, in each operation's form: - BatchGetItem keeps a member path clause for each table with no keys or more than 100, after the count clause, 10 clauses at most. - BatchWriteItem gets at most two clauses, each quoting the whole request map. The table count clause comes first. Then one Map value clause covers all tables with no request or more than 25. DynamoDB gave these two clauses for 26 and 30 tables with empty tables. It gave them for 26 tables with an empty table and one of 26 requests too. quoted_refusal takes a list of constraints. The wire rows of this branch expect both clauses, checked against DynamoDB with no escape for a quoted answer. The row with a table ARN of another account goes. On 2 Dec DynamoDB answered that request with the single account sentence before any count check, and main and this branch run the counts first.
|
Changes since the last review
What
A BatchWriteItem with more than 25 tables, or a BatchGetItem with more than 100, can also hold a table with no request or too many. The ValidationException now lists the table count clause first, then the table faults, as DynamoDB does. Before this change, ExtendDB answered the table count clause alone.
Value '{<map>}' at 'requestItems' failed to satisfy constraint: Member must have length less than or equal to 25. Then one clause withMap value must satisfy constraint: [Member must have length less than or equal to 25, Member must have length greater than or equal to 1]covers all tables with no request or more than 25.Value at 'RequestItems' failed to satisfy constraint: Member must have length less than or equal to 100, then a clause atRequestItems.<table>.member.Keysfor each table with no key or more than 100, 10 clauses at most in all.In
check_batch_countsincrates/engine/src/request_limits.rs, the table count clause and the table faults are one refusal.quoted_refusaltakes a list of constraints. A request within the table count gets the same answer as on #1234.The base of this PR is #1234, which changes the same functions.
Why
DynamoDB's answers in us-east-1, each request sent twice, on table names that do not exist. Every other table of a request holds one request or one key. The BatchWriteItem rows are from 2 December 2026 at 21:03 UTC. The BatchGetItem rows are from 20 November, and the review of 30 November found the same BatchGetItem answers.
DynamoDB changed the order of the BatchGetItem table clauses from one send to the next. Past 9 failed tables, it named another 9 on each send. ExtendDB names the first 9 in the order of its parsed request map, which is one of DynamoDB's answers.
With this change, ExtendDB gives each row DynamoDB's clauses. In the BatchWriteItem rows, the quoted map lists the tables in name order and prints each request as
WriteRequest, as on #1234.Fixes #1233
Testing done
At 5d597db, whose tree is the tree of 5559914:
cargo test -p extenddb-engine --lib: 979 passed.cargo test -p extenddb-wasm-adapter: 4 passed, theparitycorpus test among them.cargo +1.97.0 fmt --all -- --check, the two clippy commands of.github/workflows/clippy.ymlwith-D warningsonextenddb-core,extenddb-engineandextenddb-server,cargo +1.97.0 clippy -p extenddb-engine --lib --no-default-features -- -D warningsandcargo +1.94.0 check --all-targetson the same crates are clean.python3 -m pytest --collect-only -qcollects 7182 tests intestsand 701 intests/python, with no error.batch_count_refusals_name_each_pathinrequest_limits.rs, andtest_batch_write_too_many_itemsandtest_batch_get_too_many_keysintests/python/test_batch.py.tests/python/test_batch.py,tests/test_batch_operations.pyandtests/test_batch_write_validation_order.pypassed 81 tests on SQLite and 81 on PostgreSQL, 36 of them intest_batch.py.test_batch.pyagainst a server built from fix(engine): name every batch table outside its count limit as DynamoDB does #1234's head: 9 failed and 27 passed. The 9 failures are its new rows.test_batch_write_too_many_itemspasses on each recorded send of 2 December of its 14 rows. It fails when a map leaves out a table, on the member path form and with a wrong number of clauses.Line counts against #1234: production +39 -30, tests +144 -60.
This PR adds no conflict with an open PR. No other open PR changes
request_limits.rsortests/python/test_batch.py. This head merges with each open PR that changes another of its files with no conflict that the PR does not have with main already.Not in this PR:
Invalid request! All tables in the request must be from a single account.before any count check: three shapes on 2 December, both sends each. ExtendDB runs the counts first, here and on main (cross_account::refuseincrates/server/src/authz_resource/cross_account.rs), so this is BatchWriteItem outside its counts with a table ARN of another account answers the count refusal, where DynamoDB answers the single account sentence first #1548. The wire row for this request came from a statement in this body, not from a measurement, and it failed against DynamoDB. 5559914 removes it. A BatchGetItem of 101 tables with such an ARN gets the table count clause on DynamoDB, as on ExtendDB.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
A batch over its table count can also hold a table outside its own count. It gets the table count clause and the table faults in one answer, as the What section says. A client that matches the old text sees the new one. Requests within the table count get the same answers as before.
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.