Repository navigation
fix(scan): check AttributesToGet, ScanFilter, ExclusiveStartKey and ExpressionAttributeValues in the service's order - #854
Conversation
…key numbers and nesting Measured against the service on 2026-10-25 at 10:38 and 10:55 UTC, each request sent twice (#564, items 1, 2, 4 and 5): - An empty ScanFilter counts as present for the expression and non-expression parameter mix. ScanFilter {} with a FilterExpression answers the mix text; ScanFilter {} alone is accepted. - AttributesToGet [] answers "1 validation error detected: Value at 'AttributesToGet' failed to satisfy constraint: Member must have length greater than or equal to 1", alone, with a FilterExpression, and with a FilterExpression and a malformed number, so it comes ahead of the number check. - A malformed N in ExclusiveStartKey answers "The parameter cannot be converted to a numeric value: <text>". - An ExpressionAttributeValues value nested 32 or more L levels deep answers "Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit". 31 levels pass. ExtendDB accepted the first two, answered the starting-key schema text for the third, and had no nesting check on Scan. The request-time checks in crates/engine/src/scan_request.rs now make the four checks in the order the module doc lists. M levels count the same as L levels; only L was measured with a valid number at the bottom. Unit tests are in crates/engine/src/scan_request/request_tests.rs. tests/python/test_scan_request_validation.py has 18 rows; it passes on SQLite and PostgreSQL servers built from this branch, and 9 of the 18 fail on a server built from the #563 branch, which this one is stacked on. One row of item 5 stays open. From 63 L levels the service answers "ExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :d" (measured 2026-10-30 at 63, 70, 80, 99 and 100 levels; 32 to 62 levels answer the bare text), and ExtendDB answers SerializationException from the JSON parser, whose recursion limit is 128 levels, 62 of them L wrappers. That is a change to request parsing for every operation, not to the Scan checks, and is filed on its own. Item 3, the legacy AttributeValueList numbers, is #507's. Refs #564
Measured against the service on 2026-10-30 at 12:40 UTC, each request
sent twice, as a raw signed Scan:
- Limit 0 with AttributesToGet [] answers "2 validation errors detected:
Value at 'AttributesToGet' failed to satisfy constraint: Member must
have length greater than or equal to 1; Value at 'Limit' failed to
satisfy constraint: Member must have value greater than or equal to
1". The length constraint is one of the constraints the service
aggregates into one message, listed ahead of Limit. The check reported
the Limit fault alone and never reached the length check.
- AttributesToGet [] with ScanFilter {} and a FilterExpression answers
the length clause alone, so the aggregated constraints come ahead of
the parameter mix.
- A malformed N in ExclusiveStartKey with no filter, and in the index
key of a GSI scan, answers "The parameter cannot be converted to a
numeric value: bob"; with ReturnConsumedCapacity BAD as well, the enum
text alone.
- An L nested 32 levels with Select BAD answers the nesting text, so the
nesting check comes ahead of the Select enum.
The length check joins the range check, and the module doc, the comment
at the top of handle_scan and the tests cite the measured orders. Where
the length clause sits beside a Segment or TotalSegments fault alone,
and its older form, are not measured: the code lists it first in the
newer form, as beside Limit, and last in the older form with the empty
list echoed, as the older form reverses the newer one. Both are in the
unit test of requests the service was not sent.
tests/python/test_scan_request_validation.py has 24 rows: the six new
ones send the measured requests above, and the table gains a GSI for
the index-scan row.
Refs #564
Measured against the service on 2026-10-31 between 23:54 and 23:56 UTC,
each request sent twice, as a raw signed Scan with {"pk": {"N": "bob"},
"sk": {"S": "x"}} as the ExclusiveStartKey:
- Every other check comes ahead of the key's number: the Limit, Segment
and AttributesToGet constraint clauses, the ReturnConsumedCapacity and
Select enum clauses, the Select rule for SPECIFIC_ATTRIBUTES, the
parameter mix, the nesting text, the FilterExpression syntax error and
the unused-value text each answer their own text, and a malformed number
in ExpressionAttributeValues is reported ahead of one in the key. The
check ran at request time, between the value numbers and the nesting
check, so the Select enum, the nesting text, the SPECIFIC_ATTRIBUTES
rule, the filter syntax and the unused value lost to the key's number.
- Inside the key a number fault comes ahead of an empty value or an
unknown type descriptor, in either member order, and a number nested
in the L of an attribute that is not a key attribute counts: {"pk": {},
"sk": {"N": "bob"}} answers The parameter cannot be converted to a
numeric value: bob. The typed deserialization of the body reported the
empty value first, with the deserializer's text.
- A key whose only fault is an empty value answers The provided starting
key is invalid: Supplied AttributeValue is empty, must contain exactly
one of the supported datatypes. The deserializer's text had no prefix.
The handler now takes the key out of the body before the typed
deserialization when its values do not deserialize for a reason other
than a shape fault, and checks the key at its own stage, right before the
key schema: every number in it, in the sorted order of its members, with
the value check's rules and text, then the deserializer's fault with the
service's prefix. A key of the wrong JSON shape stays in the body and is
reported first, as before. Not measured: the key against the table
lookup, the index resolution, the index rules and the Segment pairing,
which the handler checks ahead of it; an unreadable-only key against the
filter syntax and unused-value checks; the prefix on the deserializer's
texts for two type descriptors and for an empty or duplicate set; and
which of two number faults is named when the request lists the members
the other way round (sorted order names bob either way).
The unit test that applied the checks' order to rows the service had not
been sent is renamed: all seven of its rows were sent on 2026-10-31 and
answered as asserted.
request_tests.rs has the measured rows, and
tests/python/test_scan_request_validation.py sends them as raw signed
requests: seven rows for the other checks ahead of the key, the nesting
text, the SPECIFIC_ATTRIBUTES rule and the filter syntax ahead of it,
nine rows for the faults inside the key, and three number texts on an N
hash key. The parser here words the filter syntax error differently from
the service, and the Scan text for the SPECIFIC_ATTRIBUTES rule has no
"1 validation error detected" prefix here, so those two tests assert the
check's place and not the text.
Measured against the service on 2026-11-05, each request sent twice, as a
raw signed Scan: a check of each stage beside each class of key fault, each
key alone, and pairs of faulty members on three tables.
- A key value that is empty, carries an unknown or lower-case type
descriptor or carries two descriptors, at its top or inside an L or M, in
a key member or in another member, is reported after the request
parameter checks (ExpressionAttributeValues or ExpressionAttributeNames
with no expression, ConditionalOperator with no ScanFilter, a ScanFilter
condition's value count, the parameter mix) and ahead of the expression
checks, with the prefix The provided starting key is invalid: on the
empty-value or more-than-one-datatypes text. An unknown descriptor
answered the deserializer's SerializationException; the other shape
faults answered after the expression checks.
- A number that does not parse and the set faults are reported after the
expression and request checks (the filter syntax, an undefined value, the
operand types, the projection syntax, the Select rules, the unused
values, the Segment pairing) and ahead of the table lookup, with no
prefix: The parameter cannot be converted to a numeric value: bob; One or
more parameter values were invalid: An number set may not be empty, An
string set may not be empty, Binary sets should not be empty; Input
collection contains duplicates. for an NS, also for ["1", "1.0"]; Input
collection ["a", "a"] contains duplicates. for an SS. The set texts
carried the key prefix, the NS duplicate text listed the members, and
the key's number came after the table lookup and the index checks.
- A value of ExpressionAttributeValues the deserializer refuses (an empty
value read by the filter) is reported after the key's value faults and
ahead of the table lookup. It was reported ahead of every handler check.
- With faults in two members the service names one of them by the
attribute names and, on some tables, the request's order: {"pk": {},
"sk": {"N": "bob"}} answered the number on 2026-10-31 and {"a": {}, "b":
{"N": "bob"}} the empty value. The code reports a shape fault in any
member ahead of a value fault in any member, then the members in sorted
order, and no test pins which member.
The handler holds back a key or an ExpressionAttributeValues value the
deserializer refuses, checks the key's shape faults between the request
parameter checks and the filter parse, and checks its numbers and sets,
then the held-back value, right before the table lookup. The Segment
pairing, the filter's placeholder and operand checks and the Select COUNT
rule for AttributesToGet move ahead of the key's value stage from after the
table lookup, as the measured rows beside a number in the key need. The
nesting check keeps its request-time place: the service answered the key's
text for a nested value the filter reads beside a key shape fault, and the
nesting text ahead of the Select enum for an unused value, which one order
cannot both give.
Not measured: a BS with duplicates, a number and a duplicate in one NS, a
set member that is not a string, an ExpressionAttributeValues value refused
for a reason other than an empty value, and the nesting check beside a key
shape fault for an unused value.
request_tests.rs has the measured rows, and
tests/python/test_scan_request_validation.py sends them as raw signed
requests: each stage beside each class of key fault, each key alone, the
pairs of faulty members (either member's fault accepted), the Segment
pairing, an undefined filter value, a missing table and an empty
expression value beside the key. The SPECIFIC_ATTRIBUTES rule and the
filter syntax tests assert only the check's place, as the texts differ
from the service's on main.
The service checks a Scan request in one of two orders. A value that is not one AttributeValue is empty, has an unknown or lower-case type descriptor, or has two descriptors. The fault can sit at the top or inside an L or M. A request with such a value in ExpressionAttributeValues, ExclusiveStartKey or a ScanFilter list follows order U. Every other request follows order R. The same test picks the older form of the constraint clauses. Measured against DynamoDB (us-east-1) on 2026-10-31 and 2026-11-05, each request twice. Order R: - The constraint clauses in the newer form, then the ReturnConsumedCapacity enum, which comes ahead of the parameter mix. Then the mix, the numbers in ExpressionAttributeValues and their nesting depth. The nesting check comes ahead of the no-expression check (B4-7, 2026-10-31). - An empty or duplicate set in ExpressionAttributeValues, ahead of the no-expression check. - The request parameter checks: ExpressionAttributeNames with no expression, ExpressionAttributeValues with no expression, ConditionalOperator with no ScanFilter, a ScanFilter condition's value count. Then the Select enum. - The expression checks: the filter syntax, the projection syntax, an undefined value, the operand types and the Select rules. Then the unused values, COUNT with a ProjectionExpression, COUNT with AttributesToGet and the Segment pairing. - The key's number and set faults, then the table and its indexes. Order U: - The constraint clauses in the older form, then the ReturnConsumedCapacity and Select enums. Then the mix and the other request parameter checks. - The key's faults, shape and value together: the first faulty member in the member order below. A shape fault carries the prefix The provided starting key is invalid: on the empty-value or more-than-one text. A number carries the value check's text. - The ExpressionAttributeValues entries the deserializer refuses, read or not, with the text ExpressionAttributeValues contains invalid value: ... for key :e. An unknown descriptor answers the empty-value text there. - The nesting depth, then the expression checks and the table. The member order inside ExclusiveStartKey is fitted to 112 measured rows on five tables. It is the order of a Java HashMap of capacity 4 over the member names. String.hashCode() of the name is spread as h ^ (h >>> 16) and masked to four buckets. The buckets come in ascending order, and the request's order holds inside a bucket. sk falls in bucket 0, a in 1, b in 2, pk, gpk, id and ts in 3. The parsed body sorts object members on every build but the MongoDB one. dispatch now passes the request text on, and the handler reads the request's member order from it. Two value faults in two members vary between sends on the service. The tests for those accept either answer. The set texts follow the order. Order R quotes the members: Input collection ["a", "a"] contains duplicates. and Input collection ["YQ==","YQ=="]of type BS contains duplicates. Order U does not: Input collection [a, a] contains duplicates. For an NS in order U the text is Input collection contains duplicates, with no prefix and no full stop. An empty SS in the key carries the key prefix in order U. Before this change the key's shape faults came at one stage and its value faults at another in every request. The unreadable ExpressionAttributeValues entries came after the key's value faults whether or not an expression read them. The Select enum was a request-time check in every request. Row B4-7 of 2026-10-31 (an unused empty value beside a nested value) answered the unused-value text instead of the empty value's. Not measured, and kept in the code's order. In order R, the nesting check against ExpressionAttributeNames with no expression, ConditionalOperator and the ScanFilter value count. A set fault in ExpressionAttributeValues against the nesting check. In order U, the Select enum against the mix. A malformed ExpressionAttributeValues number against the key's faults. An empty BS or a BS with duplicates in the key. An empty SS in the key beside an unreadable expression value. Which entry is named when several ExpressionAttributeValues entries are faulty: the first in sorted order. Keys of four members follow the same member order. The texts of #722 (the no-expression suffix), #832, #838 and #839 do not change here. Tests: request_tests.rs covers the order flag, the texts of each order, the member order and its buckets, and what the handler holds back. tests/python/test_scan_request_validation.py sends 161 rows as raw signed JSON, among them B4-7, the R5 rows of 2026-11-05 and the member-order rows on four tables. 41 of them fail on the previous commit.
…he service does
Measured against DynamoDB (us-east-1) on 2026-11-05 at 05:31, 06:20 and
07:38 UTC, each request twice.
- In order U a ScanFilter list value that is not one AttributeValue
answers Supplied AttributeValue is empty, must contain exactly one of
the supported datatypes. The text has no prefix. {} and an unknown
descriptor answer alike. Two descriptors answer the more-than-one
text. The step comes after the no-expression checks. It comes
ahead of ConditionalOperator, the lists' value counts, the key's
faults and the table. The conditions are visited in the order of the
key's members and each list in its order. The handler holds such a
value back from the typed deserialization, which reported it with
the deserializer's text.
- In order U the ExpressionAttributeValues entries are visited in the
order the key's members are visited. A malformed number, a set fault
and a value that is not one AttributeValue are reported at the map's
step, after the key's faults. Each takes the form
ExpressionAttributeValues contains invalid value: <text> for key :a.
The number text is The parameter cannot be converted to a numeric
value: bob. It applies at the top of the entry and inside its L or
NS. The set texts are those of order U. Inside one entry the first fault in the
value's element order is named. A number ahead of an empty value
answers the number.
- In order R the request-time number check visits the entries in the
same order as the key's members. Two malformed numbers answer the one
in the lower bucket, not the lower name. The set faults are checked
at request time too, after the numbers and ahead of the nesting
depth, in sorted name order on every backend. The service answered
each of two set faults in one of its two sends.
- The visiting order of the key's members and of the map's entries is
the iteration order of a Java HashMap. The map starts with four buckets
and doubles when it holds more than three quarters of its size. Up to
three names get four buckets, four to six names get eight, seven to
twelve get sixteen. A key of four members on a GSI with a range key
names gpk and pk ahead of gsk, which four buckets would reverse. Keys
of five and seven members and maps of four and seven entries follow
the same rule. Names outside ASCII hash on their UTF-16 code units,
a supplementary-plane name on its two. Two names in one bucket keep
the request's order. The handler reads the request's order of the key
members, the map's entries and the ScanFilter conditions. It reads
them from the request text.
- An empty BS in the key carries the key prefix in order U, as the empty
SS does. It does so beside an unreadable key member or expression
value, inside an L, and in a member that is not a key attribute. The
empty NS does not.
- In order R the request-time number and nesting checks read the entries
that deserialize one by one. A set fault in one entry no longer skips
the numbers of the others. A malformed number inside an entry the
deserializer refuses is reported after the nesting depth of another
entry.
Left to PR #507 (#564 item 3): a malformed number in a ScanFilter list.
The service answers The parameter cannot be converted to a numeric
value: bob, ahead of a number in the key (2026-11-05). This commit does
not check the lists' numbers. The ComparisonOperator enum clause the
service answers in order U is a legacy-condition check too and is not
made here.
Not measured, and kept in the code's order: an empty value ahead of a
malformed number inside one ExpressionAttributeValues entry. The code
names the empty value, the element order. A set fault in a ScanFilter
list value in order U. A set fault beside a malformed number in another entry of
ExpressionAttributeValues in order R, where the service's two sends
disagreed. Nine or more names in one hash bucket, where Java's HashMap
doubles a table under 64 buckets early and the code does not.
Tests: request_tests.rs covers the ScanFilter step of order U and the
map's order and invalid-value form in order U. It covers the two orders
of the request-time number and set checks and the element order inside
one entry. It covers the table's doubling and the request order read from
the text. The wire file sends 69 of the 73 rows of 2026-11-05, two of
them with the nested value written out. It has 230 tests. The two
ScanFilter number rows are marked xfail for #507. Three rows accept
either of two service answers. Thirty-nine of the others fail on the
previous commit.
…kup tests Main adds three dispatch calls to the SQLite backup tests (#700), and this branch adds the raw_body argument to dispatch. The calls now pass an empty raw body, because only Scan reads it and these calls do not send a Scan.
…e test Main adds the SQLite restore test (#740), which calls dispatch with four arguments, and this branch adds the raw_body argument to dispatch. The call now passes an empty raw body. Only Scan reads the raw body, for the request order of the members of ExclusiveStartKey, ExpressionAttributeValues and ScanFilter. With an empty raw body, the Scan checks use the order of the parsed body. The order sets which fault the Scan reports first. The Scan calls in this test send no faults. Each one sends TableName and Select, with IndexName for an index and, after the first page, the LastEvaluatedKey of the previous page as ExclusiveStartKey.
The doc comment of dispatch said that Scan reads the member order of ExclusiveStartKey from raw_body. handle_scan also reads the member order of ExpressionAttributeValues and ScanFilter from it.
Main adds PartiQL SELECT (#411), which builds a Scan body and calls handle_scan with two arguments, and this branch adds the raw_body argument to handle_scan. The call now passes an empty raw body. Scan reads the raw body only for the request order of the members of ExclusiveStartKey, ExpressionAttributeValues and ScanFilter. With an empty raw body, the parsed body's member order stands in for the request's order. The order sets which fault the Scan reports first. PartiQL builds this body itself, so no request text exists for it. The body holds TableName and, when the statement or the request gives them, FilterExpression, IndexName, ExpressionAttributeNames, ExpressionAttributeValues, Limit, ExclusiveStartKey, ConsistentRead and ReturnConsumedCapacity. It never holds ScanFilter.
This branch adds a nesting check on the ExpressionAttributeValues entries of a Scan. It refuses an entry nested 32 levels deep, as the service does for a Scan request. PartiQL SELECT builds a Scan body for a statement with no key condition, and it puts each parameter into ExpressionAttributeValues. So the check also refused a 32-level parameter in the WHERE clause of such a SELECT. The service accepts that parameter. On 2026-11-09 in us-east-1, SELECT * FROM "t" WHERE a <> ? returned the items for a parameter of 32 maps and refused 33 maps with the nesting message. A Scan with the FilterExpression a <> :v refused 32 maps. handle_scan keeps every check of a Scan request. PartiQL SELECT now calls handle_partiql_scan, which runs the same checks and the same read, except the nesting check on ExpressionAttributeValues, in both orders. The PartiQL parameter check still refuses 33 levels before the engine reads the statement. A unit test runs the request-time checks with the depth checked and with it unchecked. Two wire tests in test_partiql_item_depth.py send a SELECT that reads the whole table, with 32 and with 33 levels.
demohan
left a comment
There was a problem hiding this comment.
Measured against DynamoDB in us-east-1 on 2026-11-12, each request sent at least twice, and against servers built from 2e3e499. The inline comments carry the requests and answers. I will approve once these items are done:
- The enum clauses share one message with the older-form constraint clauses (scan_request.rs:255). #850 answers these rows the same way and needs the same fix.
- An empty or duplicate set in a ScanFilter list is reported at the list step, after the shape and number checks (scan_request.rs:1077).
- A wrong JSON type anywhere in the body answers SerializationException first, before any value is replaced (scan_request.rs:1007, scan_request.rs:615, query_key_values.rs:101).
- The member order work is linear in the member count (scan_request.rs:433).
- Members of an
Mare visited in the service's order, the same on every backend (scan_request.rs:816). - Element order inside one key member and one ScanFilter list (scan_request.rs:657, scan_request.rs:1077).
- The bucket table at nine names in one bucket (scan_request.rs:529).
- Rows that accept either of the two answers the service gives (test_scan_request_validation.py:622).
- The service's escape form in the duplicate set texts (scan_request.rs:743).
selR-arity-select-badexpects the text the service sends (test_scan_request_validation.py:585).
Smaller points:
- scan_request.rs grows from 236 to 1263 lines, request_tests.rs is new at 1302 and test_scan_request_validation.py is new at 1092. A split by concern (member order, value fault texts, the four holders) works as pure moves.
- The sort at scan_request.rs:346 fails no test under
cargo test -p extenddb-engine, wherebsondoes not turn onpreserve_order. On MongoDB the sort is what keeps the answers equal across backends. - The new module fixtures create the table and seed it before
yieldwith notry/finally, so a failure inwait_for_activeorput_itemleaves the table behind._two_member_tabledoes the same. - The description gives 688 engine and 1062 core tests. The head runs 704 and 1084.
| values_order: Option<&[String]>, | ||
| depth: ValuesDepth, | ||
| ) -> Result<(), DynamoDbError> { | ||
| validate_constraints(body, order)?; |
There was a problem hiding this comment.
When the constraint clauses take the older form, the service puts the enum clauses in the same message. {"Select": "BAD", "ReturnConsumedCapacity": "BAD", "FilterExpression": "a = :a", "ExpressionAttributeValues": {":a": {}}} answers 2 validation errors detected: Value 'BAD' at 'select' failed to satisfy constraint: ...; Value 'BAD' at 'returnConsumedCapacity' failed to satisfy constraint: ... (us-east-1, 10 sends). This branch answers the returnConsumedCapacity clause alone. "Limit": 1.5, "Limit": 3000000000 and "Segment": 0.5 with both enums do the same. main answers these four rows as the service does. With six faults the service orders the clauses select, totalSegments, returnConsumedCapacity, segment, limit, attributesToGet. The split is already on the base branch.
There was a problem hiding this comment.
Fixed in 5eb0132, with the rows in 7496c20. The merge uses the base's older-form builder, older_form_request_checks in query_key_values/unreadable.rs, from the fix round of #850. It puts the select and returnConsumedCapacity clauses in one message with the range clauses, in the order select, totalSegments, returnConsumedCapacity, segment, limit. This branch's separate Select check in order U is gone, and the builder now adds the attributesToGet clause last. Order R keeps its own ReturnConsumedCapacity check, which the service makes ahead of the parameter mix there (2026-11-05).
I sent the rows again on 2026-11-23, twice each. Both enums beside {":a": {}} and beside "Limit": 1.5 answered 2 validation errors detected: Value 'BAD' at 'select' ...; Value 'BAD' at 'returnConsumedCapacity' ... (14:03 UTC). AttributesToGet: [], Limit: 0.0, Segment: -1 and TotalSegments: 1000001 beside both enums answered the six clauses in your order (21:49 UTC). The wire rows are d1-select-rcc-unreadable, d1-limit-float-both-enums and A1 to A3 in tests/python/test_scan_request_rows.py, and the unit rows are in the_enum_clauses_sit_inside_the_older_form_message. A local server of this head answers "Limit": 3000000000 and "Segment": 0.5 beside both enums with the same two clauses.
| continue; | ||
| }; | ||
| for value in values.iter_mut() { | ||
| if let Some(text) = shape_fault(value) { |
There was a problem hiding this comment.
Only shape faults are taken out here. An empty or duplicate set in a list value stays in the body, and serde_json::from_value::<ScanInput> reports it first. "AttributeValueList": [{}, {"NS": []}] answers Supplied AttributeValue is empty, must contain exactly one of the supported datatypes on the service (10 sends) and on main. This branch answers An number set may not be empty. Beside ExpressionAttributeNames with no expression, the service answers the no-expression text. A number ahead of a shape fault is also skipped: [{"N": "bob"}, {}] answers The parameter cannot be converted to a numeric value: bob on the service (2 sends). The list needs one walk in element order over shapes, numbers and sets.
There was a problem hiding this comment.
Fixed in 5eb0132, with the rows in 7496c20. ScanFilterBody::take, now in scan_request/holders.rs, walks each list once in element order with first_fault. That walk finds a value the service cannot read, a malformed number and a set fault. The holder takes out every faulty value and reports the first.
On 2026-11-23 (14:03 UTC, twice each) [{}, {"NS": []}] answered the empty value, and [{"N": "bob"}, {}] answered The parameter cannot be converted to a numeric value: bob. Both are wire rows (d2-sf-empty-then-NSe, d2-sf-bob-then-empty) and unit rows in a_scan_filter_list_value_is_checked_at_its_step. That unit test fails with the list check put back to shape faults only. Beside ExpressionAttributeNames with no expression, a local server of this head answers the no-expression text.
| } | ||
| }; | ||
| if let Some(fault) = fault { | ||
| *value = serde_json::json!({"S": ""}); |
There was a problem hiding this comment.
The stand-in replaces the whole entry, so a wrong JSON type inside it is never deserialized. {":a": {"L": [{"S": 5}, {}]}} answers SerializationException: NUMBER_VALUE cannot be converted to String on the service (2 sends). main answers a SerializationException. This branch answers ExpressionAttributeValues contains invalid value: Supplied AttributeValue is empty, ... for key :a. The same happens at line 1078 for [{"L": [{"S": 5}, {}]}] in a ScanFilter list. A pass that finds a wrong JSON type anywhere in the body before any stand-in would cover both.
There was a problem hiding this comment.
Fixed in af5e023. value_shape_fault in query_key_values/unreadable.rs deserializes each ExpressionAttributeValues entry, each ExclusiveStartKey value and each ScanFilter list value on its own, with the parts the service cannot read replaced. request_checks runs it ahead of every other check, so the pass reads a value before any stand-in replaces it.
{":a": {"L": [{"S": 5}, {}]}} answered SerializationException: NUMBER_VALUE cannot be converted to String on 2026-11-23 (14:03 UTC, twice). This head answers SerializationException for it (row d3-eav-L-S5-empty), and for the list [{"L": [{"S": 5}, {}]}] on a local server. The deserializer's text differs from the service's, and the description lists that under Known differences. Without the pass, a_value_of_the_wrong_json_type_is_found_behind_a_value_fault fails.
| .map(|key| serde_json::from_value::<Item>(key.clone())) | ||
| { | ||
| Some(Err(e)) => match crate::deserialize_error(e) { | ||
| shape if is_shape_fault(&shape) => None, |
There was a problem hiding this comment.
The key is classified by the deserializer's first error. {"pk": {"NS": []}, "sk": {"S": 5}} answers a SerializationException on the service in either member order (2 sends each). This branch answers An number set may not be empty. {"pk": {}, "sk": {"N": 5}} answers the prefixed empty-value text here, where the service answers a SerializationException.
There was a problem hiding this comment.
Fixed in af5e023, by the pass of thread 3. value_shape_fault reads each key value on its own ahead of the checks. A value fault in one member no longer hides a wrong JSON type in another.
{"pk": {"NS": []}, "sk": {"S": 5}} answered SerializationException: NUMBER_VALUE cannot be converted to String on 2026-11-23 (14:03 UTC, twice). This head answers SerializationException for it (row d4-key-NSe-S5), and a local server gives the same for the other member order. {"pk": {}, "sk": {"N": 5}} now answers SerializationException too. The reviewed head answered the prefixed empty-value text.
| shape @ DynamoDbError::SerializationException(_) => shape, | ||
| _ => check, | ||
| }, | ||
| Err(e) => { |
There was a problem hiding this comment.
This reads only the first serde error, so a value fault that sorts first hides a wrong JSON type later in the body. {"AttributesToGet": [], "ExclusiveStartKey": {"pk": {"NS": []}}, "Limit": "5"} answers SerializationException: STRING_VALUE cannot be converted to Integer on the service (2 sends). This branch answers the AttributesToGet length clause. {":a": {"NS": []}, ":b": {"S": 5}} answers the empty-set text here.
There was a problem hiding this comment.
Fixed. shape_fault_first now reads each member of the body on its own (d7e6ff3, from the fix round of #544, which the base carries). The merge (5eb0132) brings it in. The key's ValidationException no longer stops it before "Limit": "5". {"AttributesToGet": [], "ExclusiveStartKey": {"pk": {"NS": []}}, "Limit": "5"} answered SerializationException: STRING_VALUE cannot be converted to Integer on 2026-11-23 (14:03 UTC, twice), and this head gives the same text (row d5-atg-NSe-limit-string).
For a wrong JSON type inside a value, value_shape_fault (af5e023, thread 3) runs first. {":a": {"NS": []}, ":b": {"S": 5}} answers SerializationException on a local server of this head.
| /// Returns `DynamoDbError::ValidationException` with the service's text. | ||
| pub(crate) fn validate(&self, order: CheckOrder) -> Result<(), DynamoDbError> { | ||
| for (_, value) in self.members() { | ||
| if order == CheckOrder::Unreadable |
There was a problem hiding this comment.
The shape pass covers the whole member before the value pass, so a shape fault after a number wins. {"pk": {"L": [{"N": "bob"}, {}]}, "sk": {"S": "s"}} answers The parameter cannot be converted to a numeric value: bob on the service (2 sends). This branch answers The provided starting key is invalid: Supplied AttributeValue is empty, .... ExpressionValuesBody uses element order for the same value.
There was a problem hiding this comment.
Fixed in 5eb0132, with the row in 7496c20. StartKeyBody::validate now takes each key member's first fault with first_fault, in the member's element order, and puts the key prefix on a value the service cannot read.
{"pk": {"L": [{"N": "bob"}, {}]}, "sk": {"S": "s"}} answered The parameter cannot be converted to a numeric value: bob on 2026-11-23 (14:03 UTC, twice), and this head gives the same text. It is the wire row d8-key-L-bob-empty and a unit row in a_shape_fault_in_a_key_value_answers_the_prefixed_text, which fails with the old shape pass put back.
| /// The bucket mask of a Java `HashMap` that starts with four buckets and | ||
| /// doubles whenever it holds more than three quarters of its size: 3 for up to | ||
| /// three names, 7 for four to six, 15 for seven to twelve, and so on. | ||
| fn hash_table_mask(names: usize) -> u32 { |
There was a problem hiding this comment.
The table is sized by the name count alone. With nine ExpressionAttributeValues names in one of sixteen buckets, :aa and :dt empty, the service names :dt (10 sends) and this branch names :aa. Ten names give the same result. The table also grows when one bucket reaches nine names.
There was a problem hiding this comment.
Fixed in af556dd. hash_table_mask now puts the names in the request's order. It doubles the table when it holds more than three quarters of its size. It also doubles it when a put makes one bucket hold nine names while the table has fewer than 64 buckets, as HashMap.treeifyBin does.
I sent your rows on 2026-11-23 (21:49 UTC, twice each), with :aa first and :dt last, both empty. Eight names in bucket 10 of 16 named :aa, and nine and ten names named :dt. In a table of 32 buckets :dt sits in bucket 10 and the others in bucket 26. The rows are H8 to H10 in tests/python/test_scan_request_rows.py, with unit rows in the_fitted_member_order_follows_the_hash_buckets_then_the_request. That test fails with the old sizing.
In Java, a bucket that reaches nine names in a table of 64 buckets or more becomes a tree. That moves one of its names to the front. The code keeps the request's order there, and the description lists that as not measured.
| members | ||
| .iter() | ||
| .map(|member| match order { | ||
| CheckOrder::Readable => serde_json::to_string(member).unwrap_or_default(), |
There was a problem hiding this comment.
The service does not escape set members with JSON escapes. {"SS": ["a\u0001", "a\u0001"]} answers Input collection ["a\u{1}", "a\u{1}"] contains duplicates. (2 sends). This branch answers ["a\u0001", "a\u0001"]. \u007f and \u200b come back as \u{7f} and \u{200b}, and \u0000 as \0. This branch returns the raw characters for the first two.
There was a problem hiding this comment.
Agreed, the form differs, and this PR does not change it. I sent three rows on 2026-11-23 (14:03 UTC, twice each). {"pk": {"SS": ["a\u0001", "a\u0001"]}} in the key answered One or more parameter values were invalid: Input collection ["a\u{1}", "a\u{1}"] contains duplicates., where this head answers ["a\u0001", "a\u0001"]. {"pk": {"SS": ["b", "a", "b"]}} in the key and {":a": {"SS": ["b", "a", "b"]}} in ExpressionAttributeValues both answered ... Input collection ["a", "b", "b"] contains duplicates., where this head lists ["b", "a", "b"].
#1368 builds these texts in the service's form for the other operations, in crates/core/src/types/attribute_value.rs. Whichever of #1368 and this PR merges second calls the other's helper and drops its own copy, so Scan gets the same form. The doc of SetFault::text and the description now say that this branch's text differs for such members.
| # ahead of :a in 3); the set faults in sorted name order, where the | ||
| # service's two sends disagreed (the SS text, then the NS text) and the | ||
| # sorted order is pinned so that the answer does not depend on the backend. | ||
| ("eavR-two-numbers", "table", '"FilterExpression": "a = :a", "ExpressionAttributeValues": ' |
There was a problem hiding this comment.
This exact body answered fred in 7 of 14 sends to the service and bob in the other 7. The row and the unit test the_order_r_number_check_visits_the_entries_in_the_hash_order should accept either answer. Row eavR-NSe-and-nest (line 566) expects the empty-set text, where the service answered the nesting text in 12 of 14 sends. Row eavR-NSbobdup-and-nest (line 630) expects the nesting text, where the service answered bob in 3 of 6 sends.
There was a problem hiding this comment.
Fixed. eavR-two-numbers and eavR-NSbobdup-and-nest accept either answer since the merge (5eb0132), and eavR-NSe-and-nest since cedc43f, in the file's ("either", ...) form. The unit test is now two_malformed_numbers_in_order_r_answer_one_of_the_two, and it accepts both texts. The rows are in tests/python/test_scan_request_rows.py after the split.
I sent the three bodies again on 2026-11-23 (14:12 UTC). The two numbers answered fred in 4 of 6 sends and bob in 2. Beside the nested value, the empty NS answered the empty-set text in 4 of 4, and {"NS": ["bob", "1", "1"]} answered bob in 4 of 4. With your counts, each row has both answers on record. The module doc of scan_request.rs, the doc of validate_sets and the description give the send counts.
| '{"ComparisonOperator": "EQ", "AttributeValueList": [{"N": "1"}]}}, "Select": "BAD"', CONDOP), | ||
| ("selR-arity-select-bad", "table", '"ScanFilter": {"a": {"ComparisonOperator": "EQ", ' | ||
| '"AttributeValueList": []}}, "Select": "BAD"', | ||
| ("either", "Invalid number of attribute values for comparison", |
There was a problem hiding this comment.
The service answers One or more parameter values were invalid: Invalid number of argument(s) for the EQ ComparisonOperator here (4 sends). The row also accepts Invalid number of attribute values for comparison, which the service does not send. Expecting the service's text with an xfail matches how the ScanFilter number rows are marked.
There was a problem hiding this comment.
Fixed in cedc43f. selR-arity-select-bad now expects One or more parameter values were invalid: Invalid number of argument(s) for the EQ ComparisonOperator by equality, with an xfail for #838, as the file marks the two ScanFilter number rows for #507. I sent it again on 2026-11-23 (14:03 UTC, twice) and got that text. The row is in tests/python/test_scan_request_rows.py after the split.
The merge dropped EMPTY_AV from tests/test_scan_number_values.py.
tests/test_scan_checks_before_authorization.py imports it, so pytest
stopped at collection in every CI suite. The constant is back.
The key row {"M": {"k": {"N": "bob"}, "j": {}}} expected bob only when
EXTENDDB_TEST_BACKEND is mongodb. The member order depends on the build,
not on the backend. bson turns on serde_json's preserve_order, so a build
with the MongoDB crate names bob. CI's workspace build for PostgreSQL and
Cassandra is such a build. A build without it sorts the members and
names the empty value. The row now accepts either answer (#1013).
…sion The merge of the base brought in a test of the Scan checks that run ahead of the IAM decision. Two of its rows answered AccessDeniedException in CI: an invalid Select, and an ExpressionAttributeValues entry with an unknown type descriptor. This branch makes both checks in the handler, after the IAM decision. The base made them before it. The service answers both with its ValidationException to a principal that may not Scan the table (measured 2026-11-19 with a role allowed only DescribeTable). It makes some checks of the handler ahead of them. In both orders these are a member of the wrong JSON type, the no-expression checks, ConditionalOperator and the ScanFilter value count. In order U the ScanFilter list values and the key's faults come first too. So the handler's first checks move into checked_body. In order R it stops after the Select enum. In order U it stops after the faulty entries and an empty name. The handler calls it, and so does validate_before_authorization, which the server now runs ahead of the IAM decision in place of validate_scan_request_body. The server also passes the request text, so these checks read the member order of the three maps from it, as the handler does.
The doc of order R step 9 said the service makes the Select enum ahead of the filter syntax (measured 2026-11-05). The comment beside the Select check said the same. No row of this branch sends the two together. On 2026-11-19 the service answered the filter syntax, an undefined value and an unused value ahead of an invalid Select, each request sent twice. #1391 tracks that order. The code keeps its order, and the doc and the comment now say so.
demohan
left a comment
There was a problem hiding this comment.
Items 1, 2, 3, 4, 6, 7, 8 and 10 from the earlier review are resolved at 1bdcf89. Items 5 and 9 remain open, as the PR body says. Each request was sent twice to the service and to SQLite builds of this head, with and without preserve_order. The 218 rows of the earlier wire file pass on this head, apart from two rows where the service itself gives two answers.
- Both enum clauses sit in one message beside
{":a": {}},Limit: 1.5,Limit: 3000000000andSegment: 0.5, and the six-fault body gives the service's six clauses in its order. - ScanFilter lists in order U match the service in every row tried. The seven type-fault bodies answer SerializationException.
- The member-name bucket rule matches the service at 16 and 32 buckets for names picked from its hashing.
- Member-order work is linear: 320,000 entries take 1.8 to 2.8 s, against 81 s at 2e3e499. With the sort in
sorted_entriesremoved, two tests fail in the build with the MongoDB crate. - CI is green on 53 of 53 checks.
I will approve once the items below are done.
ExclusiveStartKey member order (fafd29b)
On builds with preserve_order (the MongoDB build, and the whole-workspace build CI runs), "ExclusiveStartKey": {"pk": {"M": {"k": {"N": "bob"}, "j": {}}}, "sk": {"S": "s"}} now answers The parameter cannot be converted to a numeric value: bob. The service answered The provided starting key is invalid: Supplied AttributeValue is empty, ... on 9 of 9 sends, and 2e3e499 gave the same answer. The wire row accepts either answer, so CI passes.
validate_before_authorization (316ea8e)
These checks now run ahead of the IAM decision, and no test covers them: a value of the wrong JSON type, ExpressionAttributeNames or ExpressionAttributeValues without an expression, ConditionalOperator, the ScanFilter value count, and in order U the list values and the key faults. With them reverted to after IAM, every test passes. A row for each in test_scan_checks_before_authorization.py would hold them.
Errors returned there also skip record_error_metrics and record_request_count. Six malformed Scans raise UserErrors and RequestCount by 6 on main and by 0 here. Query has the same gap (#1190).
crates/engine/src/scan.rs, crates/engine/src/query_key_values.rs
scan.rs grew from 591 lines after the split to 643, and query_key_values.rs is 725. Splitting by concern would bring both under 600.
Optional: checked_body runs twice
Every Scan that passes the early checks runs checked_body before IAM on a clone of the body, and again in the handler. A 7.6 MB body takes 2.22 s and about 600 MB here, against 1.33 s and 390 MB with the pre-IAM call removed, and 0.78 s and 340 MB on main. It stays linear, and it is under 0.25 s at 900 KB.
Optional: 32 nesting levels in ExpressionAttributeValues
The earlier review missed this. 8e4aa22 refuses a value nested 32 levels. The service accepts 32 and refuses 33, in 7 of 7 sends with two body shapes, and main accepts 32. Eight tests in the wire files fail against the service for this reason.
| } | ||
| } | ||
|
|
||
| /// The `Select` field of a `Scan` body in order R, where the service checks |
There was a problem hiding this comment.
SelectBody still says the service checks the Select enum ahead of the filter syntax. 1bdcf89 took that claim out of the other two places.
There was a problem hiding this comment.
Changed in fba4abf. The doc of SelectBody now says the service checks the enum after the no-expression check and the nesting check. It adds that the service makes the filter syntax, an undefined value and the unused values ahead of it (2026-11-19, #1391). The order R doc and the handler's comment say the same since 1bdcf89.
| } | ||
| } | ||
|
|
||
| /// Measured 2026-11-05: in order U `ScanFilterBody::take` holds a `ScanFilter` |
There was a problem hiding this comment.
The doc says take leaves a malformed number in the body in both orders. In order U it now takes the number out, as lines 329 to 353 assert.
There was a problem hiding this comment.
Changed in fba4abf. The doc now says that in order R the request-time checks pass a malformed number in a list and take leaves it in the body. In order U, take takes the number out and names it as the list's fault, as the assertions on [{"N": "bob"}, {}] below it do (2026-11-23).
…tion The base brings its third round. The walk over one AttributeValue moves to query_key_values/value_fault.rs. A float Limit, Segment or TotalSegments is read from the digits the request wrote. The older validation path refuses an empty or duplicate set. The Scan range rows beside a value move to a wire file of their own. - The base's set check and this branch's set check are one now. Fault::Set holds this branch's SetFault, which gives the text of either path. The number set duplicates come from the base's has_equal_numbers and its NUMBER_SET_DUPLICATES text. The base's deserializer_fault has no caller left and goes. - Query keeps the base's older path: the numbers of every value, then the sets when an expression can read a value. - Scan keeps this branch's order U. The request-time checks stop at the name keys. The handler checks the ExpressionAttributeValues entries after the expressions-only check and the key's faults. It reads the numbers and sets of each entry in one walk and visits the entries in the hash order. SCAN_VALUE_EXPRESSIONS has no caller left and goes. - The base's set rows for Scan in unreadable_tests.rs now run through validate_before_authorization. Three answers change to the service's answers of 24 Nov at 05:41 UTC. Beside a number in :a, the set in :n is named, as the service named :n in both arrangements. With no expression, or with a ProjectionExpression alone, the answer is the expressions-only text.
…as the service does
The Scan checks refused an entry nested 32 L or M levels deep. The service
accepts 32 and refuses 33. The measurements of 24 Nov 2026 at 08:11 UTC
(us-east-1) sent each request twice to a table that does not exist. An L chain
and an M chain around {"N": "1"} that a FilterExpression reads answer
ResourceNotFoundException at 30, 31 and 32 levels. They answer the nesting
text at 33, 34 and 62. At 63 and 64 levels the service wraps the text as an
invalid value for key :d, as on 30 Oct. main accepts 32 levels too.
nested_too_deep reads the entry as JSON and refuses more than
MAX_ITEM_NESTING_DEPTH (32) levels. Order R makes the check at its step, after
the numbers and the sets. At 08:46 UTC, 33 levels answered the nesting text
ahead of the Select enum, the filter syntax, the no-expression check and the
key's number. The empty NS of another entry came ahead of the nesting text.
On the older validation path (order U) the service refuses such an entry as
a fault of the entry, in the invalid-value form. It visits the entries in the
hash order and finds the depth ahead of the faults inside the entry (08:46 and
08:47 UTC):
- Beside Limit 1.5, a 33-level :p answers ExpressionAttributeValues contains
invalid value: Nesting Levels have exceeded supported limits: ... for key
:p.
- {} inside 33 levels answers that text for its entry.
- The service names a 33-level :d ahead of {} in :e, and {} in :b ahead of :d.
ExpressionValuesBody now makes that check with the entry's other faults, and
the separate order U check in the handler goes. The nesting text moves from
core's partiql module to validation as NESTING_MESSAGE, so a build without the
partiql feature has it. partiql::params re-exports it.
With one limit for every Scan, the PartiQL SELECT no longer needs a Scan of its
own. A SELECT parameter may hold 32 levels, and the parameter check refuses 33
(measured 9 Nov). So ValuesDepth and handle_partiql_scan go. The SELECT calls
handle_scan with an empty request text.
The wire rows that pair a nested value with another fault send 33 levels now.
Each went to the service with 33 levels on 24 Nov at 08:46 or 08:59 UTC,
twice. B4-7 answers the nested entry's text for :d. A row with an empty leaf
inside 33 levels is new.
…the hash order
StartKeyBody::validate read the members of an M in an ExclusiveStartKey member
in the parsed map's order. A build without the MongoDB crate sorts them by
name. A build with it keeps the request's order, since bson turns on
serde_json's preserve_order. On the second kind of build, {"M": {"k": {"N":
"bob"}, "j": {}}} answered the number text for bob. The service answers the
prefixed empty value: 9 of 9 sends in the review, and again on 24 Nov 2026 at
08:11 UTC.
The service visits the members of such an M in the hash order it uses for the
key's own members. Measured on 24 Nov 2026 at 08:11 UTC (us-east-1, a table
that does not exist, each body twice). {"M": {"q": {"N": "bob"}, "b": {}}}
answers the number text, and {"M": {"b": {"N": "bob"}, "q": {}}} the prefixed
empty value. Request order would name bob for both. Sorted order would name
the empty value for the first body and bob for the second. With four buckets,
q is in bucket 1, b in 2, j in 2 and k in 3.
first_fault_in takes the member order as a function. first_fault keeps the
map's order, so an ExpressionAttributeValues entry answers as before (#1013).
StartKeyBody::validate passes hashed_members, which puts the members of an M
through fitted_member_order. Inside one bucket the parsed map's order stands
in for the request's.
The key row of the unit test and of the wire file expects the service's text
on every build. Two wire rows send the q and b bodies. The either form of
TestTwoOrders goes.
The doc of SelectBody still said the service checks the Select enum ahead of the filter syntax. 1bdcf89 took that claim out of the order R doc and the handler's comment. On 2026-11-19 the service answered the filter syntax, an undefined value and an unused value ahead of an invalid Select (#1391). The doc now says the same. The doc of a_scan_filter_list_value_is_checked_at_its_step said that take leaves a malformed number in a ScanFilter list in the body in both orders. That holds in order R. In order U, take takes the number out and names it as the list's fault, as the test asserts for [{"N": "bob"}, {}] (measured 2026-11-23).
scan.rs held 605 lines after the nesting change. CheckedBody and checked_body move to scan/body_checks.rs as written. They are the checks a Scan body passes ahead of the read, which the server also runs ahead of the IAM decision. scan.rs keeps the handler at 496 lines. The struct's fields take pub(super) so the handler can read them, and the imports of each file name what it uses. crate::scan::checked_body stays the path the server's gate calls.
316ea8e moved the handler's checks ahead of the IAM decision. In order R they run up to the Select enum, in order U up to the faulty ExpressionAttributeValues entries. The review of 24 Nov lists the checks among them that no test covered. They are a value of the wrong JSON type and the two maps with no expression. Then come ConditionalOperator and the ScanFilter value count. In order U, a list value and the key's faults. With those checks after IAM again, every test passed. test_scan_checks_before_authorization.py gets one row for each. The role extenddb-test-665-e1, which may Scan no table, sent each body twice to a table that does not exist. The sends were on 24 Nov 2026 at 08:28, 08:33 and 09:59 UTC. The rows of 19 Nov answer as they did then, and the valid body answers AccessDeniedException. Two rows answer SerializationException, so the table gains an error code column. Two rows carry extenddb's text where the service's differs: the ScanFilter value count (#838) and a Select of the wrong JSON type (#1012). The row with ExpressionAttributeValues and no expression takes the older path, where both give the suffixed text. On the newer path the service's text has no suffix (#722). Control: with the gate running the request checks alone, as before 316ea8e, the eight new rows answer AccessDeniedException. Four of the earlier rows do too.
|
The branch merges the base again (fe0e3a0,
The two inline comments are fba4abf. |
…tion Brings in 0e0f078 and 35910e9 from fix/query-key-value-types and its merge of main at 44cd436. It also brings in the merge commits ad5f485 and bed665f of the two branches below this one. Three conflicts, all in crates/engine/src/query_key_values/value_fault.rs, in the doc comments of first_fault_in and set_fault and in the signature line of first_fault_in. The merge keeps this branch's walk (first_fault_in with a member order, SetFault) and its set_fault, which builds the set texts of both paths. The merge drops the other branch's deserializer-based set_fault. The doc comments gain the 2026-11-24 rows. Carried in from the other branch: SS first in TYPE_DESCRIPTORS. The walk then names a duplicate SS beside a second type descriptor ahead of the numbers. The null member and null name handling in shape_fault_first and the first pass of older_form_checks merged without conflict.
…tion This merge adds main at b3c54f6, through the merges 6d74de7, 330d685 and 73a01ae on the three branches below this one. One file conflicted: crates/engine/src/int32_member.rs, in newer_form. The merge keeps this branch's newer_form, which puts the clause of an empty list member first. It calls main's validation_errors_detected, because the merge into fix/563-scan-range-constraints removed validation_error_envelope.
…tion This merge adds main at 018715e, through the merges 31c5f3d, b33d458 and 627cb41 on the three branches below this one. One file conflicted: crates/engine/src/scan.rs. Main's #765 passes no expression parameters to the Scan values check. So a Scan whose values the service reads gets the values message with no suffix. This branch moved that check from handle_scan to checked_body in crates/engine/src/scan/body_checks.rs. The merge keeps this branch's scan.rs and puts #765's change in checked_body for the newer path. On the older path, checked_body still names FilterExpression as null. The service was asked on 2026-11-24 at 15:24 UTC, on a table that does not exist. ExpressionAttributeValues with no expression got the text that has no suffix. Beside Limit 1.5 it got the text with the suffix. Each request went twice. #765's message gives the suffix for a value the service cannot read as one type too. The merge does not change the rows of tests/test_scan_checks_before_authorization.py and query_key_values/unreadable_tests.rs that pin the older path's text.
demohan
left a comment
There was a problem hiding this comment.
The items from the earlier review are resolved at be52b90, with the metrics gap left to #1427. Each body was sent twice to the service in us-east-1 and to SQLite builds of this head with and without serde_json's preserve_order (the member order the MongoDB and workspace builds use).
- An ExclusiveStartKey member holding
{"M": {"k": {"N": "bob"}, "j": {}}}answersThe provided starting key is invalid: Supplied AttributeValue is empty, ...on both builds, as on the service, and 11 of 12 related key rows match (q/b, b/q, a/b and b/a members, an M in an L and in an M, 4- and 3-member maps, an empty NS ahead of an empty value). Puttingfirst_faultback fails the unit row on both builds and two wire rows. - 32 nesting levels in ExpressionAttributeValues are accepted and 33 refused with the nesting text, alone, unused, with no expression, beside
Select: "BAD"and beside a key number, and in order U besideLimit: 1.5. PartiQL SELECT answers as before, and no statement can passhandle_scanan entry deeper than the parameter check allows. With the 32-level bound put back, 3 unit and 3 wire tests fail. - The 8 new rows for the checks ahead of IAM fail with the gate put back as it was.
scan.rsis 496 lines andquery_key_values.rs497, by a pure move, and theSelectBodyandholder_testsdocs match the code. The merge leaves no: FilterExpression is nullsuffix in order R and keeps it besideLimit: 1.5, as on the service. - A Scan refused ahead of the IAM decision still records no metric (9 against 27 on the merge-base for the same 27 requests, at
handler.rs:182). #1427 counts requests refused in the authorization step, and the body says this PR merges after it. - fmt, both clippy commands, the 1.91.1 workspace check and
extenddb-corewithout default features are clean, 5270 workspace tests pass apart from the host'ssecmemtest, the head wire files pass against the service apart from #838, and every CI workflow has a passing run at this head.
…parison The merge of #544's branch brought a second NUMBER_SET_DUPLICATES, in validation::number, with the same text as the one that this branch adds in types::attribute_value. It also brought has_equal_numbers, which finds two members of a number set with one value, as the NS arm of duplicates_as_sent does. attribute_value.rs, BatchWriteItem and the PartiQL parameter tests now use the constant of validation::number. Its doc comment gets the 2026-11-22 BatchWriteItem measurement of this branch. The NS arm of duplicates_as_sent calls has_equal_numbers, which #850 and #854 call too. This commit deletes the copy of the constant in attribute_value.rs, its re-export from types, and the comparison in the NS arm. The answers do not change.
Changes since the last review
The review of 24 November read
1bdcf89b0. This round merges the base four times and adds five commits.be52b9003mergesfix/563-scan-range-constraintsat627cb41be, which carries main at018715e0d. One file conflicted:crates/engine/src/scan.rs. Main's fix(scan): drop the FilterExpression suffix from the values message #765 passes no expression parameters to the Scan values check. This branch moved that check fromhandle_scantochecked_bodyincrates/engine/src/scan/body_checks.rs. The merge keeps this branch'sscan.rs.checked_bodynow passes no parameters in order R andFilterExpressionin order U. The service was asked on 2026-11-24 at 15:24 UTC, on a table that does not exist, two sends each.ExpressionAttributeValueswith no expression got the message with no suffix. BesideLimit: 1.5it got: FilterExpression is null.eaabbce86mergesfix/563-scan-range-constraintsat73a01aeb7, which carries main atb3c54f683. One file conflicted:crates/engine/src/int32_member.rs, innewer_form. The merge keeps this branch'snewer_form, which puts the clause of an empty list member first. It calls main'svalidation_errors_detected, because the base deletedvalidation_error_envelope.On the tree of
be52b9003,cargo fmt --checkis clean, andcargo clippy --all-targets -- -D warningsis clean onextenddb-coreandextenddb-engine. The core lib tests give 1147 passed and 1 ignored, and the engine lib tests give 983 passed.a2fb7ddd3mergesfix/563-scan-range-constraintsatbed665f5a. That head carries fix(query): check Query values against the key schema and the number rules #544's third round (0e0f07817and35910e977), its merge of main at44cd43667and the merges of the two branches below this one. Three conflicts, all incrates/engine/src/query_key_values/value_fault.rs: the doc comments offirst_fault_inandset_fault, and the signature line offirst_fault_in. The merge keeps this branch's walk (first_fault_inwith a member order,SetFault) and itsset_fault, which builds the set texts of both paths. It drops the base's deserializer-basedset_fault. Carried in:SSfirst inTYPE_DESCRIPTORS, so a duplicateSSbeside a second type descriptor comes ahead of the numbers. Two more changes merged without conflict. One is the null member and null name handling inshape_fault_first. The other is the first pass ofolder_form_checksover the sets of a value the service cannot read as one type.fe0e3a032mergesfix/563-scan-range-constraintsat996359746, the fix round of fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850. The base moved the value fault walk tocrates/engine/src/query_key_values/value_fault.rsand split its Scan range wire file. This branch'sFault,SetFault,first_faultandset_faultnow live in that file, with the base's number set check (has_equal_numbers,NUMBER_SET_DUPLICATES). The base'sdeserializer_faultandSCAN_VALUE_EXPRESSIONSgo, with no caller left. Query'solder_form_checkstakes the base's two passes. The base's Scan set rows inunreadable_tests.rsrun throughvalidate_before_authorization, and three of their expected texts are now the service's.e0f7d6571refuses anExpressionAttributeValuesentry nested 33 levels, where8e4aa220refused 32. The service accepts 32 and refuses 33. The review saw it in 7 of 7 sends, and this round on 2026-11-24 at 08:11 UTC (under Why). main accepts 32 too.nested_too_deepcounts the levels of the entry as JSON, because an entry of order U may not deserialize. Core'svalidate_attribute_values_nesting_depthreads typed values and refuses 32 levels, the limit of the single-item writes (measured 2026-08-24). The Scan check cannot reuse it.MAX_ITEM_NESTING_DEPTHandNESTING_MESSAGEmove from core'spartiqlmodule toextenddb_core::validation, so a build without thepartiqlfeature has them. In order U the depth is a fault of the entry, in the invalid-value form, found ahead of the faults inside it (ExpressionValuesBody). The order U check in the handler,ValuesDepthandhandle_partiql_scango. The PartiQL SELECT of a whole table callshandle_scanwith an empty request text. The wire rows that pair a nested value with another fault send 33 levels, each measured again on 2026-11-24.fc6d8d98ereads the members of anMin anExclusiveStartKeyvalue in the hash order of the key's own members, on every build (the review'sExclusiveStartKey member orderitem).first_fault_intakes the member order as a function.first_faultkeeps the parsed map's order for the other two maps, andStartKeyBody::validatepasseshashed_members. The key row expects the service's text on every build. Two wire rows send theqandbbodies, and theeitherform ofTestTwoOrdersgoes.fba4abfc1changes the two doc comments of the inline comments.SelectBodyno longer says the service checks theSelectenum ahead of the filter syntax. TheScanFiltertest doc saystakeleaves a malformed number in the body in order R and takes it out in order U.5257ed892movesCheckedBodyandchecked_bodytocrates/engine/src/scan/body_checks.rsas written.scan.rshas 496 lines.query_key_values.rshas 473 since the merge, where the base moved the value fault walk out.00fec65efadds eight rows totests/test_scan_checks_before_authorization.py, one per check the review named. They are aLimitand aSelectof the wrong JSON type,ExpressionAttributeNamesandExpressionAttributeValueswith no expression,ConditionalOperatorand theScanFiltervalue count. In order U they are a list value and the key's faults. The roleextenddb-test-665-e1, which may Scan no table, sent each body twice to a table that does not exist. The sends were on 2026-11-24 at 08:28, 08:33 and 09:59 UTC. The rows carry an error code column. Two rows carry extenddb's text where the service's differs (Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838, A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012).What a client sees differently from
1bdcf89b0:ExpressionAttributeValuesentry nested 32 levels passes the nesting check, as on the service and on main. 33 levels are refused.ExclusiveStartKeymember{"M": {"k": {"N": "bob"}, "j": {}}}answers the empty value text with the key prefix, as the service does. Every build reads the members of anMin a key value in the hash order.A Scan refused ahead of the IAM decision records no metric. Six malformed Scans raise
UserErrorsandRequestCountby 6 on main and by 0 on this branch (the review). #1190 reports the gap for every request refused in the authorization step, and #1427 fixes it at the handler's authorization error arm. This PR should merge after #1427. #1422 trackschecked_bodyrunning twice on a Scan that passes the early checks, ahead of the IAM decision and in the handler. It covers #544, #562 and this PR, and the design stays.Changes between the review of 12 November and
1bdcf89b0The review of 12 November read
2e3e4996d. That round merged the base and added eleven commits.5eb0132a9mergesfix/563-scan-range-constraintsat63a493394, the fix round of fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850. The base now has the older-path checks of fix(query): check Query values against the key schema and the number rules #544, fix(scan): check the numbers in ExpressionAttributeValues as the service does #562 and fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850 for Scan and Query. The merge keeps one copy of each check and this branch's order of the Scan checks:Limit,SegmentorTotalSegmentsputs a Scan in order U too. On the base,Limit: 1.5beside{"N": "bob"}answers the number in the invalid-value form.SelectandReturnConsumedCapacityclauses (thread 1) and now theAttributesToGetlength clause, last. The faultyExpressionAttributeValuesentries and an empty name come after the key's faults.ReturnConsumedCapacityenum, the mix and the base's names check. Then come the base's number check in placeholder order, this branch's set check and the nesting depth.ScanFilterlists and theExpressionAttributeValuesentries read each value with the base'sfirst_fault, which now also finds set faults. Inside one value it reads the members in element order (threads 2 and 8).7496c201bsends the rows of 2026-11-23 for the older form, the lists and the key.af5e0237ffinds a value of the wrong JSON type before the handler holds one back (threads 3, 4 and 5).9bbf50ef3reads the member order of the three fields in one linear pass (thread 6). A Scan with 40,000ExpressionAttributeValuesentries took 6.98 to 7.82 s on2e3e4996dand 0.72 to 0.79 s on9bbf50ef3(debug SQLite servers, five sends each).af556dd86doubles the fitted table when a bucket reaches nine names (thread 9).cedc43f38accepts either answer foreavR-NSe-and-nest(thread 11). The merge did the same foreavR-two-numbers,eavR-NSbobdup-and-nestand the unit test of the two numbers. It expects the service's text forselR-arity-select-badwith anxfailfor Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838 (thread 12). The module fixtures delete their tables in afinallyblock.ae4fa32bfmovesscan_request.rs, its request tests and the wire file into files by concern, with no other change.6d2c7795cnames Two faults in one request map: ExtendDB can report another member than the service #1013 in the doc offirst_fault. It changes no code.fafd29b61reads the members of anMin the parsed map's order again, as the base does (thread 7). The merge had sorted them on every build. A build without the MongoDB crate sorts them by name. A build with it keeps the request's order, becausebsonturns on serde_json'spreserve_order. The MongoDB build is one, and so is acargo buildof the whole workspace, which CI's PostgreSQL and Cassandra jobs run. On a build with the MongoDB crate,{":a": {"M": {"z": {}, "b": {"N": "fred"}}}}answers the empty value text again, and{":a": {"M": {"z": {"N": "bob"}, "b": {"N": "fred"}}}}the number text forbob, as the service does. TheExclusiveStartKeymember{"M": {"k": {"N": "bob"}, "j": {}}}answered the empty value text on a build without the MongoDB crate, as the service does. On a build with it, the member answered the number text forbob. Its unit test expected the answer of the build it ran in, and its wire row accepted either answer (34fe828).fc6d8d98ereads the members of anMin a key value in the hash order on every build, so both answer the empty value text now. The service's order for the members of anMin anExpressionAttributeValuesentry is the second open part of Two faults in one request map: ExtendDB can report another member than the service #1013.34fe82848putsEMPTY_AVback intests/test_scan_number_values.py. The merge had dropped it, andtests/test_scan_checks_before_authorization.pyimports it, so CI's pytest suites stopped at collection. The commit also made the key row above accept either answer, since CI builds both kinds.316ea8e95runs the handler's first checks ahead of the IAM decision. In order R they end with theSelectenum, and in order U with the faultyExpressionAttributeValuesentries and an empty name. At34fe82848two rows oftests/test_scan_checks_before_authorization.pyansweredAccessDeniedExceptionin CI:{"Select": "NOPE"}, and an entry with an unknown type descriptor. The service answers both with itsValidationExceptionto a principal allowed onlyDescribeTable(measured 2026-11-19). The checks moved intochecked_bodyincrates/engine/src/scan.rs(nowcrates/engine/src/scan/body_checks.rs,5257ed892). The handler calls it, and so doesscan_request::validate_before_authorization, which the server runs ahead of the IAM decision. The server passes the request text too, so the member order of the three maps is the one the handler reads.1bdcf89b0changes a claim in the doc of order R step 9 and in the comment beside theSelectcheck. They said the service makes theSelectenum ahead of the filter syntax (2026-11-05). No row of this branch sends the two together. On 2026-11-19 the service answered the filter's text ahead of an invalidSelect(Scan reports an invalid Select ahead of the filter checks, and the table lookup and the IAM decision ahead of the Segment pairing check #1391, under Known differences). It changes no code.What a client sees differently from
2e3e4996d:Limit: 1.5, answer both clauses in one message, with the range and length clauses.Limit: 1.5beside{"N": "bob"}answers the number in the invalid-value form, after the key's faults.{"NS": ["bob", "1", "1"]}in another entry answersbobahead of the nesting text. The service varies on both (the counts are under Why).ScanFilterlist names its first faulty value in the list's order, a number or a set fault included. A key member names its first fault in element order, the members of anMin the hash order.SerializationException, also behind a value fault in the same map or list.ExpressionAttributeNameschecks of the base run, and in order U an empty name comes after the faulty entries.{":a": {"M": {"z": {"N": "bob"}, "b": {"N": "fred"}}}}answers the number text forbob, as the service does. The reviewed head read the numbers of a readableMin sorted order on every build, so it answeredfredthere.ExpressionAttributeValuesentry nested 32 levels passes the nesting check, as on the service.2e3e4996drefused it.What a client sees differently from the base at
63a493394(the base is996359746now, and the fix round of #850 describes its own changes):NSwith duplicates inExpressionAttributeValuesanswersOne or more parameter values were invalid: Input collection contains duplicates., as the service does. That base gave the deserializer's text with the members listed.{":a": {}, ":n": {"N": "bob"}}names:n, as the service does. That base named:a.Selectenum, and in order U with the faultyExpressionAttributeValuesentries and an empty name. A principal that may not Scan the table gets theValidationExceptionof an invalidSelectand of a faulty entry, as on the base. It also gets the answer of each check the service makes ahead of those two. These are a member of the wrong JSON type, the no-expression checks,ConditionalOperatorand theScanFiltervalue count. In order U they also include theScanFilterlist values and the key's faults. The base made these after the IAM decision and answeredAccessDeniedExceptionto that principal. The roleextenddb-test-665-e1sent those rows to the service on 2026-11-24 and got each check's answer (00fec65ef, under Why).What
Stacked on #850 (
fix/563-scan-range-constraints), which sits on #562 and #544. The branch covers items 1, 2, 4 and 5 of #564, with one row of item 5 left open (below). Item 3 is a malformed number in aScanFilterlist in order R. It is also item 3 of #477, and #507 covers it (the comment of 25 October on #564).The service checks a Scan request in one of two orders. A request on the service's older validation path follows order U. Such a request holds a value the service cannot read as one type, or a
Limit,SegmentorTotalSegmentsthat is a float or outside int32. The value is a null or empty, or carries an unknown or lower-case type descriptor, two descriptors or a null payload. It can sit at the top or inside anLorM. The places read are theExpressionAttributeValuesentries, theExclusiveStartKeyvalues and theScanFilterlists. Every other request follows order R. The same test picks the older form of the constraint clauses (#563).crates/engine/src/scan_request.rscomputes it once per request (CheckOrder), and its module doc lists both orders.Order R:
AttributesToGetlength, then theLimit,SegmentandTotalSegmentsranges, in one messageReturnConsumedCapacityenumScanFiltercounts as present whether or not it is emptyExpressionAttributeNameschecks (fix(scan): check the numbers in ExpressionAttributeValues as the service does #562)ExpressionAttributeValues, the entries in placeholder order (fix(scan): check the numbers in ExpressionAttributeValues as the service does #562). The numbers of theScanFilterlists are fix(query): check legacy conditions against the key schema #507's checkExpressionAttributeValues, in placeholder order, with the set texts of order RExpressionAttributeValues: an entry nested 33 levels or more, withMlevels counted asLlevelsExpressionAttributeNameswith no expression,ExpressionAttributeValueswith no expression,ConditionalOperatorwith noScanFilter, aScanFiltercondition's value countSelectenumSelectrules, the unused values,COUNTwith aProjectionExpression,COUNTwithAttributesToGet, theSegmentpairingOrder U:
Select, theTotalSegmentsfault, an invalidReturnConsumedCapacity, theSegmentfault, theLimitfault and an emptyAttributesToGet, in one message (fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850 builds it)ExpressionAttributeNameskey checksExpressionAttributeNamesandExpressionAttributeValueswith no expression, then theScanFilterlist values, thenConditionalOperatorwith noScanFilterand aScanFiltercondition's value count. In a list the first faulty value in the list's order is named, with no prefix. Its fault is a value the service cannot read, a malformed number or a set fault. The conditions are visited in the member order belowThe provided starting key is invalid:. A number carries the number check's text. A set fault carries the texts of order U (below)ExpressionAttributeValuesentries, in the member order below, the first faulty one named, each fault in the formExpressionAttributeValues contains invalid value: <text> for key :a. An entry nested 33 levels or more is a fault of the entry, found ahead of the faults inside it. Then an empty name inExpressionAttributeNamesInside one value, the first fault is the one
first_fault_in(crates/engine/src/query_key_values/value_fault.rs) finds. It readsLmembers in their order. In anExpressionAttributeValuesentry or aScanFilterlist value it readsMmembers in the parsed map's order (first_fault). A build without the MongoDB crate sorts them by name, and a build with it keeps the request's order (#1013). In anExclusiveStartKeyvalue it reads them in the hash order below on every build (hashed_membersincrates/engine/src/scan_request/holders.rs). Inside one bucket the parsed map's order stands in for the request's. With several type descriptors it reads each payload and answers the more-than-one text only when no payload has a fault. This branch adds the set faults to it, for Scan. Query does not ask for them.The handler in
crates/engine/src/scan.rsholds back the values each order reports late, so that the typed deserialization does not report them first (checked_bodyincrates/engine/src/scan/body_checks.rs). They are the key (StartKeyBody), and in order U the faultyExpressionAttributeValuesentries and an empty name (ExpressionValuesBody) and the faultyScanFilterlist values (ScanFilterBody). In order R it holds back an invalidSelect(SelectBody). A readable stand-in replaces each value taken out. Ahead of every check,value_shape_faultreads each of those values on its own, so a member of the wrong JSON type inside one answersSerializationExceptionfirst.The service visits the members of
ExclusiveStartKeyin the iteration order of a JavaHashMapover the names. In order U it visits the entries ofExpressionAttributeValuesand the conditions ofScanFilterin that order too. It takesString.hashCode()of each name, spreads it ash ^ (h >>> 16), and masks it to the table's buckets. The names go into the table in the request's order. The table starts with four buckets and doubles when it holds more than three quarters of its size. It also doubles when a name is the ninth in its bucket and the table has fewer than 64 buckets. The buckets come in ascending order, and the request's order holds inside a bucket. Names outside ASCII hash on their UTF-16 code units, a name outside the Basic Multilingual Plane (U+1D11E) on its two. The rule is fitted to the measured rows. The service does not document it. The code comment atfitted_member_order(crates/engine/src/scan_request/member_order.rs) states the rows. The parsed body sorts object members on every build but the MongoDB one. So the handler reads the request's order of the three fields from the request text, in one pass (member_orders).dispatchpasses the request text to the handler.The set texts follow the order. Order R quotes the members as JSON strings:
Input collection ["a", "a"] contains duplicates.andInput collection ["YQ==","YQ=="]of type BS contains duplicates.. The service gives the same text for these members. For members out of sorted order or with a control character it differs (under Known differences). Order U does not quote them:Input collection [a, a] contains duplicates.. For anNSin order U the text isInput collection contains duplicates, with no prefix and no full stop. An emptySSand an emptyBSin the key carry the key prefix in order U. An emptyNSdoes not. The texts come fromSetFault::textincrates/engine/src/query_key_values/value_fault.rs.One row of item 5 stays open. From 63
Llevels the JSON parser refuses the body (128 JSON levels, two perLlevel) before any check reads it. ExtendDB answersSerializationExceptionwhere the service answers the prefixed nesting text. #807 changes request parsing, which every operation shares, and covers these depths.The PartiQL SELECT of a whole table calls
handle_scanwith an empty request text, so the parsed body's member order stands in for the request's. It runs every check of a Scan, the nesting check among them. The service accepts a 32-level parameter in such a SELECT and refuses 33 levels with the nesting text, as it does for a Scan entry. The PartiQL parameter check makes that refusal before the engine reads the statement.Why
Refs #564.
Measured against DynamoDB (us-east-1) on 2026-10-25 at 10:38 and 10:55 UTC, on 2026-10-30 at 12:40 UTC and on 2026-10-31 between 23:54 and 23:56 UTC. Measured again on 2026-11-05 between 00:54 and 01:05 UTC, at 03:18 UTC, at 05:31 UTC, at 06:20 UTC and at 07:38 UTC. The probe sent each request twice, as a raw signed Scan. The key with two number faults was sent again on 2026-11-04 at 23:45 UTC. The rows of the round before went out on 2026-11-23 at 14:03, 14:12 and 21:49 UTC, to a table that does not exist. The rows of this round went out on 2026-11-24 at 08:11, 08:28, 08:33, 08:46, 08:47, 08:59 and 09:59 UTC. Each went twice, to tables that do not exist.
ScanFiltercounts as present for the parameter mix.ScanFilter: {}with aFilterExpressionanswersCan not use both expression and non-expression parameters in the same request: Non-expression parameters: {ScanFilter} Expression parameters: {FilterExpression}. The service acceptsScanFilter: {}alone.AttributesToGet: []answers1 validation error detected: Value at 'AttributesToGet' failed to satisfy constraint: Member must have length greater than or equal to 1: alone, with aFilterExpression, with aFilterExpressionand a malformed number, and withScanFilter: {}and aFilterExpression. The length constraint joins the range constraints.Limit: 0withAttributesToGet: []answers2 validation errors detected: Value at 'AttributesToGet' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'Limit' failed to satisfy constraint: Member must have value greater than or equal to 1.NinExclusiveStartKeyanswersThe parameter cannot be converted to a numeric value: bob. That holds with a valid filter, with no filter, and in the index key of a GSI scan and of an LSI scan. It holds for anNSmember, anLmember, and a number in theLof an attribute that is not a key attribute. On anNhash key," 1"and""answer the same text with the value echoed. 39 digits answerAttempting to store more than 38 significant digits in a Number.{"pk": {"N": "bob"}}alone, with nosk, answersbobahead of the key schema check (2026-11-05).Value at 'Limit' ...), in order U the older form (Value '0' at 'limit' ...).{"pk": {}, "sk": {"S": "x"}}withSelect: "BAD"answers theSelectclause. A value nested 32 levels withSelect: "BAD"answers the nesting text. The same nested value beside that key answers the key's text. The three rows fit the two orders above, and so does every other measured row.ReturnConsumedCapacity: "BAD"beside the parameter mix and besideSelect: "BAD"answers its own clause.ExpressionAttributeNameswith no expression answers its text ahead ofExpressionAttributeValueswith no expression and ofConditionalOperator.ConditionalOperatoranswers its text ahead of aScanFiltercondition with no value.{":e": {"NS": []}}with no expression answersOne or more parameter values were invalid: An number set may not be emptyahead of the no-expression check.ExpressionAttributeValueswith no expression andSelect: "BAD"answers the no-expression text. The mix besideSelect: "BAD"answers the mix text.ExpressionAttributeValuesvalue nested 33 to 62LorMlevels deep answersNesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit. 32 levels answer the next check's text. On 2026-11-24 at 08:11 UTC anLchain and anMchain around{"N": "1"}, read by the filter, went to a table that does not exist. They answeredResourceNotFoundExceptionat 30, 31 and 32 levels, the nesting text at 33, 34 and 62, and the wrapped text below at 63 and 64. The rows of 2026-10-30 and 2026-10-31 answered the nesting text at 32 levels. The reviewer's 7 of 7 sends of 24 November and every send here answer the next check's text there. The nesting text comes ahead of theSelectenum, the filter syntax, the no-expression check and a number in the key. That was measured at 32 levels on 2026-10-30, 2026-10-31 (B4-5a) and 2026-11-05, and at 33 levels on 2026-11-24 at 08:46 UTC. The nesting text holds for a value the filter reads and for one nothing reads, with anNor anSleaf. An emptyNSin another entry answered its set text ahead of the nesting text ({":p": {"S": "x"}, ":d": <nested>, ":e": {"NS": []}}). It did so in both sends on 2026-11-05 at 06:20 UTC and in 4 of 4 on 2026-11-23, at 32 levels. At 33 levels it did so in 2 of 2 on 2026-11-24. It answered the nesting text in 12 of 14 sends on 2026-11-12.{"NS": ["bob", "1", "1"]}in another entry answered the nesting text on 2026-11-05. It answeredbobin 4 of 4 sends on 2026-11-23 and the nesting text in 3 of 6 on 2026-11-12. At 33 levels it answeredbobin 1 of 2 on 2026-11-24.{"L": [{"N": "bob"}, {"NS": []}]}in another entry answered the number in one send and the nesting text in the other. That held on 2026-11-05 and again on 2026-11-24. AnSSwith duplicates in another entry answered its duplicates text in one send and the nesting text in the other. That held on 2026-11-05 at 07:38 UTC and on 2026-11-24. The service reports a malformed number at the bottom first, at every depth measured. The depths were 31 to 60 and anMat 32, and 33 on 2026-11-24 in 2 of 2 sends. From 63 levels the text isExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :d. The depths 63, 70, 80, 99 and 100 were measured, and 63 and 64 again on 2026-11-24.SPECIFIC_ATTRIBUTES,ALL_PROJECTED_ATTRIBUTESand theSegmentpairing. An undefined value ahead of the unused values, theSegmentpairing andSPECIFIC_ATTRIBUTES. An operand type ahead of the unused values and theSegmentpairing. The unused values ahead ofCOUNTwith aProjectionExpressionand of theSegmentpairing.COUNTwithAttributesToGetahead of theSegmentpairing.{"pk": {"N": "bob"}, "sk": {"S": "x"}}, each expression check answers its own text. A missing index,ConsistentReadon a GSI and a missing table answer the number text. The set texts areOne or more parameter values were invalid: An number set may not be empty,... An string set may not be emptyand... Binary sets should not be empty. A set with duplicates answers... Input collection contains duplicates.for anNS(["1", "1"]and["1", "1.0"]alike),... Input collection ["a", "a"] contains duplicates.for anSS(["a\"b", "a\"b"]for members with a quote) and... Input collection ["YQ==","YQ=="]of type BS contains duplicates.for aBS. In anNS,["bob", "1", "1"]and["1", "1", "bob"]answerbob. The service reports a number inExpressionAttributeValuesahead of a number in the key. A malformed number in aScanFilterlist answersThe parameter cannot be converted to a numeric value: bob(2026-11-05 at 05:31 UTC). It does so alone and beside{"pk": {"N": "fred"}, "sk": {"S": "x"}}in the key. That check is fix(query): check legacy conditions against the key schema #507's and is not made here. Beside an emptyNSin another entry, a malformed number inExpressionAttributeValuesanswered the empty-set text in one send and the number text in the other. An emptyNSanswers its text ahead ofExpressionAttributeNameswith no expression and ahead ofSelect: "BAD", and afterReturnConsumedCapacity: "BAD".ConditionalOperatorand aScanFiltercondition with no value answer their texts ahead ofSelect: "BAD".{":n": {"N": "fred"}, ":a": {"N": "bob"}}answeredfredon 2026-11-05. On 2026-11-23 it answeredfredin 4 of 6 sends andbobin 2, and on 2026-11-12 each in 7 of 14. The placeholder order namesbob.{":n": {"NS": []}, ":a": {"SS": []}}answeredOne or more parameter values were invalid: An string set may not be emptyin one send and... An number set may not be emptyin the other. An emptyNSbeside the parameter mix answers the mix text.The provided starting key is invalid: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes. A key value with two descriptors answersThe provided starting key is invalid: Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes. An empty value inside anLorM, or in a member that is not a key attribute, answers the first text too. Five checks answer their own text beside such a key. They areExpressionAttributeValueswith no expression,ExpressionAttributeNameswith no expression,ConditionalOperatorwith noScanFilter, aScanFiltercondition with no value, and the parameter mix. Nine checks answer the key's text beside it. They are the filter syntax, an undefined value, the operand types, the projection syntax, the threeSelectrules and the unused value. TheSegmentpairing does too, with each of its three faults. The three table checks (a missing index,ConsistentReadon a GSI and a missing table) do too. A nested value the filter reads does too, with anSor anNleaf. So does a nested value nothing reads.ExpressionAttributeValuesentries (2026-10-31 B4-7 and 2026-11-05). An empty entry the filter reads answersExpressionAttributeValues contains invalid value: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes for key :awith no key, with a valid key and on a missing table. An entry nothing reads answers the same text for its key, ahead of the nesting check (B4-7) and of the unused values.{"X": "1"}answers the empty-value text in that position. Two descriptors answer the more-than-one text with the same wrapper. The entry's text comes ahead of the filter syntax, an undefined value and the projection syntax. BesideSelect: "BAD"orReturnConsumedCapacity: "BAD"the enum clause comes first, and beside the parameter mix andSelect: "BAD"theSelectclause does. Beside a key fault the key's text comes first. A malformed number in the map answersExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :a. It comes after the key's faults:{":n": {"N": "bob"}}beside{"pk": {}, ...}answers the key's text, with and without an empty entry. The entries are visited in the member order below.{":p": {"S": "x"}, ":a": {"N": "bob"}, ":e": {}}names:a, and the same with:nnames:n.{":p": {"S": "x"}, ":b": {}, ":a": {"X": "1"}}names:b. An empty value at the bottom of 32Llevels is named too:{":d": <32 levels around {}>}answers the empty-value text for:d(2026-11-05 at 06:20 UTC). At 33 levels the entry answers the nesting text in the same form, ahead of the fault inside it (2026-11-24 at 08:46 and 08:47 UTC).{":d": <33 levels around {}>}answersExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :d. A 33-level:pbesideLimit: 1.5answers it for:p. A 33-level:dis named ahead of{}in:e(B4-7), and{}in:bis named ahead of a 33-level:d. The key's faults come ahead of a 33-level entry (2026-11-24 at 08:46 and 08:59 UTC, six key rows). A set fault in an entry takes the same form (2026-11-05 at 07:38 UTC):{":p": {"S": "x"}, ":s": {"NS": []}, ":e": {}}answersExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An number set may not be empty for key :s, and anSSwith duplicates there... Input collection [a, a] contains duplicates. for key :s. A malformed number inside anLor anNSanswers the number text for its key, and 39 digits... Attempting to store more than 38 significant digits in a Number for key :a.{":p": {"S": "x"}, ":e": {}, ":a": {"N": "bob"}}names:e::aand:eshare a bucket and the request's order decides. With four entries and with seven the entry the eight and sixteen buckets put first is named. Inside one entry{"L": [{"N": "bob"}, {}]}answers the number.ScanFilterlist values (2026-11-05 at 05:31 UTC).[{}]and[{"X": "1"}]answerSupplied AttributeValue is empty, must contain exactly one of the supported datatypes, with no prefix.ExpressionAttributeNameswith no expression answers its text ahead of the list value. The list value answers its text ahead ofConditionalOperator, a condition with two values, a key shape or number fault and a missing table.Select: "BAD"answers its clause ahead of the list value. Two descriptors in a list value answerSupplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes, and an empty value inside anLthe empty-value text (2026-11-05 at 07:38 UTC). With two conditions the one first in the member order below is named:pkahead ofsk, andtsahead ofidwhentscomes first. In one list the first faulty value is named: on 2026-11-23[{}, {"NS": []}]answered the empty value and[{"N": "bob"}, {}]the number.ExpressionAttributeValueswith no expression answers its text ahead of the list value. An invalidComparisonOperatoranswers its constraint clause ahead of the list value, a legacy-condition check this branch does not make (below). In order R an emptyNSin a list answersOne or more parameter values were invalid: An number set may not be empty, the deserializer's text here.ExpressionAttributeValuesentry the filter reads, a keyNSwith duplicates answersInput collection contains duplicatesand a keySSwith duplicatesOne or more parameter values were invalid: Input collection [a, a] contains duplicates.. An empty keyNSanswersOne or more parameter values were invalid: An number set may not be emptythere and beside an unreadable key member. An empty keySSbeside an unreadable key member answersThe provided starting key is invalid: One or more parameter values were invalid: An string set may not be empty. Beside an emptyExpressionAttributeValuesentry the filter reads it answers the same. An empty keyBSbeside an unreadable key member answersThe provided starting key is invalid: One or more parameter values were invalid: Binary sets should not be empty. A keyBSwith duplicates there answersOne or more parameter values were invalid: Input collection [YQ==, YQ==]of type BS contains duplicates.. The empty keyBSkeeps the prefix beside an emptyExpressionAttributeValuesentry the filter reads (2026-11-05 at 07:38 UTC). It keeps it inside anLand in a member that is not a key attribute.{"Select": "BAD", "ReturnConsumedCapacity": "BAD"}beside an empty entry, and beside"Limit": 1.5, answers2 validation errors detected: Value 'BAD' at 'select' ...; Value 'BAD' at 'returnConsumedCapacity' ...."AttributesToGet": []beside"Limit": 0.0answers2 validation errors detected: Value '0' at 'limit' ...; Value '[]' at 'attributesToGet' failed to satisfy constraint: Member must have length greater than or equal to 1. With the five other faults the order is select, totalSegments, returnConsumedCapacity, segment, limit, attributesToGet. BesideSelect: "BAD"and an empty entry the two clauses are select and attributesToGet.{"L": [{"N": "bob"}, {}]}answers the number. An empty key value comes ahead of an empty name. A member of the wrong JSON type answersSerializationExceptionbehind a value fault:{":a": {"L": [{"S": 5}, {}]}}and the key{"pk": {"NS": []}, "sk": {"S": 5}}answerNUMBER_VALUE cannot be converted to String."AttributesToGet": []beside a key with an emptyNSand"Limit": "5"answersSTRING_VALUE cannot be converted to Integer.pk,sktable the service namesskin both request orders. On HASHa, RANGEbit namesa. On HASHpk, RANGEait namesain both request orders. Onts,idand onid,tsit names the member first in the request. On HASHä, RANGEéit namesäin both request orders. On the GSI,{"gpk": {}, "pk": {"N": "bob"}, "sk": {"S": "x"}}namesgpk. On a GSI with a range key the key has four members. There{"gpk": {}, "gsk": {"N": "bob"}, "pk": ..., "sk": ...}namesgpkin both request orders, and{"gpk": ..., "gsk": {}, "pk": {"N": "bob"}, "sk": ...}namespk. Four buckets would reverse both. Eight buckets give them. Every row fits the hash order above. On 2026-11-23 eight, nine and tenExpressionAttributeValuesentries shared bucket 10 of sixteen, with:aafirst and:dtlast in the request, both empty. The eight named:aa, and the nine and the ten named:dt. With the table doubled at the ninth name in one bucket,:dtfalls in bucket 10 of 32, ahead of the others in bucket 26. With two value faults and no shape fault the service's two sends disagreed on 19 of the 40 matrix cells (20 pairs, both request orders).{"pk": {"N": "bob"}, "sk": {"N": "fred"}}answeredbobon 2026-10-31 andfredon 2026-11-04. The tests for those rows accept either member's fault.Min anExclusiveStartKeyvalue (2026-11-24 at 08:11 UTC).{"pk": {"M": {"q": {"N": "bob"}, "b": {}}}, "sk": {"S": "s"}}answersThe parameter cannot be converted to a numeric value: bob.{"pk": {"M": {"b": {"N": "bob"}, "q": {}}}, "sk": {"S": "s"}}answers the prefixed empty-value text. So does{"pk": {"M": {"k": {"N": "bob"}, "j": {}}}, "sk": {"S": "s"}}, as the member{"M": {"k": {"N": "bob"}, "j": {}}}did on 2026-11-05 in a member that is not a key attribute. With four bucketsqis in bucket 1,bandjin bucket 2 andkin bucket 3. So the hash order above namesbob, the empty value and the empty value. Request order would namebobfor all three, and sorted order the empty value,boband the empty value.extenddb-test-665-e1, which may Scan no table. The bodies went to a table that does not exist on 2026-11-24 at 08:28, 08:33 and 09:59 UTC.{"Limit": "5"}answersSerializationExceptionwithSTRING_VALUE cannot be converted to Integer, and{"Select": 5}withNUMBER_VALUE cannot be converted to String.ExpressionAttributeNameswith no expression answers its text.ExpressionAttributeValueswith no expression answersExpressionAttributeValues can only be specified when using expressions. BesideLimit: 1.5it answers the same text with the suffix: FilterExpression is null(Scan: ExpressionAttributeValues without an expression answers with a ": FilterExpression is null" suffix the service does not send #722).ConditionalOperatoralone answersConditionalOperator cannot be used without Filter or Expected. AScanFiltercondition with no value answersOne or more parameter values were invalid: Invalid number of argument(s) for the EQ ComparisonOperator. In order U,[{}]in aScanFilterlist answers the bare empty-value text and{"pk": {}, "sk": {"S": "x"}}the prefixed one.{"N": "bob"}andSelect: "NOPE"answer as on 2026-11-19, and a valid body answersAccessDeniedException."ConsistentRead": "yes"alone answersAccessDeniedExceptiontoo: the service reads the string as a boolean (A boolean member given as a JSON string is read differently from the service #984). As the Admin role the same body answersResourceNotFoundException(08:31 UTC).main (
25ee109bf, a SQLite server) acceptsScanFilter: {}with aFilterExpression. It scans and compares for{"N": "bob"}in aScanFilterlist (200, no item), as every commit of this branch does. The check is #507's. It answersInvalid ProjectionExpression: The expression can not be empty;forAttributesToGet: []alone, with aFilterExpressionand withLimit: 0. The #562 base answers theLimitclause alone for that last request, in the newer form. For a malformedExclusiveStartKeynumber on anSkey, main answers the key schema text (The provided starting key is invalid: The provided key element does not match the schema). On anNsort key it answers500 InternalServerError, and on anNhash key it scans and returns no items. For" 1",""and 39 digits on anNhash key it scans the table. main reports an empty key value, two descriptors and the set faults with the deserializer's texts, ahead of every handler check. It reports an unknown descriptor as aSerializationException. main has no nesting check on Scan: 32 levels answer the unused-value text or scan, and from 63 levels the JSON parser's recursion limit answersSerializationException: Start of structure or map found where not expected: recursion limit exceeded.Known differences (main differs from the service on each of them too):
ScanFilterlist. The service answersThe parameter cannot be converted to a numeric value: bob, ahead of a number in the key (measured on 5 November). ExtendDB scans and compares. The check is Scan request validation gaps: empty ScanFilter in the parameter mix, empty AttributesToGet, legacy and ExclusiveStartKey numbers, ExpressionAttributeValues nesting depth #564 item 3, which fix(query): check legacy conditions against the key schema #507 makesComparisonOperatorin aScanFiltercondition beside an unreadable list value. The service answers1 validation error detected: Value 'BAD' at 'scanFilter.a.member.comparisonOperator' failed to satisfy constraint: Member must satisfy enum value set: [IN, NULL, BETWEEN, LT, NOT_CONTAINS, EQ, GT, NOT_NULL, NE, LE, BEGINS_WITH, GE, CONTAINS](measured on 5 November). ExtendDB answers the list value's text. TheComparisonOperatorchecks are legacy-condition checks, which fix(query): check legacy conditions against the key schema #507 makes with the textInvalid comparison operator. The clause form of order U is in neither1 validation error detected:prefix on theSPECIFIC_ATTRIBUTESrule and theProjectionExpressionrule ofSelect(Scan Select rules and the Query ALL_PROJECTED_ATTRIBUTES rule answer without the "1 validation error detected: " prefix #832): Segment: 2 is not less than TotalSegments: 2on theSegmenttext (Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838)Invalid number of attribute values for comparisonfor aScanFiltercondition with no value, where the service answersOne or more parameter values were invalid: Invalid number of argument(s) for the EQ ComparisonOperator(Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838)Cannot specify the ProjectionExpression when Select is COUNTforAttributesToGetwithSelect: COUNT, where the service answers1 validation error detected: Cannot specify the AttributesToGet when choosing to get only the Count(Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838)Invalid FilterExpression: expected attribute path or value placeholderfora = = :pandInvalid ProjectionExpression: expected attribute namefora,,b, where the service answersSyntax error; token: "=", near: "= = :p"andSyntax error; token: ",", near: ",,b"(FilterExpression and ProjectionExpression syntax errors answer the parser's text, not the service's token and position #839): FilterExpression is nullonExpressionAttributeValues can only be specified when using expressions, which the service answers in order U and drops in order R (Scan: ExpressionAttributeValues without an expression answers with a ": FilterExpression is null" suffix the service does not send #722)SerializationExceptiontexts for a field of the wrong JSON type. The service answersSTRING_VALUE cannot be converted to Integerfor"Limit": "5",NUMBER_VALUE cannot be converted to Stringfor"Select": 5, for{"N": 5}in the key and for{"SS": ["a", 1]}, andUnexpected field typefor"ExclusiveStartKey": "x". It answersBase64 encoded length is expected a multiple of 4 bytes but found: 3for{"B": "!!!"}. It answersDuplicate key found in payloadfor a member name written twice inExclusiveStartKeyor an entry name written twice inExpressionAttributeValues(A repeated type descriptor in an attribute value is accepted last-wins where the service refuses it #630). The parser here keeps the last value. It answersStart of structure or map found where not expectedfor an object whereExpressionAttributeNamesneeds a string. ExtendDB gives the service's text for"Limit": "5"(the base's check) and the deserializer's texts for the others (A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012)NUMBER_VALUE cannot be converted to Stringfor{"S": 5}, and ExtendDB the deserializer's textMwith a fault in two members in anExpressionAttributeValuesentry. The service reads them in an order of its own:{"M": {"z": {"N": "bob"}, "b": {"N": "fred"}}}answersbob, and{"M": {"z": {}, "b": {"N": "fred"}}}the empty value (2026-11-23). ExtendDB reads them in the parsed map's order, so its answer depends on the build (Two faults in one request map: ExtendDB can report another member than the service #1013). A build without the MongoDB crate sorts them by name and answersfredfor both. A build with it keeps the request's order and answersboband the empty value. In anExclusiveStartKeyvalue ExtendDB reads them in the hash order of the key's own members on every build, which fits the three measured rows (above). Inside one bucket the parsed map's order stands in for the request's, which no row measuresSSor aBSwhose members are not in order, or hold a control character. The service sorts the members and writes U+0001 as\u{1}:["b", "a", "b"]answersInput collection ["a", "b", "b"] contains duplicates.and["a\u0001", "a\u0001"]answersInput collection ["a\u{1}", "a\u{1}"] contains duplicates.(2026-11-23). ExtendDB lists them as sent, quoted as JSON strings. fix(core): give a set with duplicate members DynamoDB's text #1368 builds the service's form for the other operations"ConsistentRead": "yes"beside a key shape fault: the service answers the key's text, ExtendDB reads the whole body first and answers theSerializationException. Alone, from a principal that may not Scan the table, the service answersAccessDeniedException(2026-11-24): it reads the string as a boolean (A boolean member given as a JSON string is read differently from the service #984). ExtendDB answers theSerializationExceptionahead of the IAM decisionExclusiveStartKeytexts.{"pk": {}, ...}and{"pk": {"X": "1"}, ...}answer the prefixed empty-value text on the service. Query answers the bare text and theSerializationExceptionhere, as beforeSelectbeside a filter syntax fault, an undefined value or an unused value, in order R. The service answers the filter's text (2026-11-19, each request twice). ExtendDB answers theSelectclause, as the base does (Scan reports an invalid Select ahead of the filter checks, and the table lookup and the IAM decision ahead of the Segment pairing check #1391)Segmentpairing sent by a principal that may not Scan the table. The service answers the pairing text (2026-11-19). ExtendDB makes the pairing check after the IAM decision and answersAccessDeniedException, as the base does (Scan reports an invalid Select ahead of the filter checks, and the table lookup and the IAM decision ahead of the Segment pairing check #1391)Overlaps with other PRs
ScanFilterlists in order R. Both PRs change the Scan handler incrates/engine/src/scan.rs, so the one that merges second must redo its changes there. fix(core): refuse a document path of more than 32 elements #597, fix(mongodb): evaluate deeply nested conditions instead of answering 500 #571, fix(expression): operator cap, syntax error wording, PutItem map keys #558 and fix(expressions): validate in the service's order, with its messages #399 (mine) conflict with this branch inscan.rstoo, as they do with the base.crates/core/src/types/attribute_value.rs. This branch builds the Scan texts inSetFault::text. Whichever of the two merges second calls the other's helper and drops its own.crates/engine/src/query_key_values.rs, and fix(engine): end a failed ImportTable as DynamoDB does #1370, fix(core): give a set with duplicate members DynamoDB's text #1368 and fix(core): read a B value with "=" or another character inside #1355 (mine) incrates/core/src/types/mod.rsandcrates/core/src/partiql/params.rs. The base has the same conflicts.authorize_requestcall incrates/server/src/handler.rs, where this branch adds the request text as an argument. The one that merges second keeps both changes there.Min anExclusiveStartKeyvalue in the same order on every build. Two faults in one request map: ExtendDB can report another member than the service #1013 stays open for the others. Its second open part is the members of anMin anExpressionAttributeValuesentry or aScanFilterlist value.first_faultreads them in the parsed map's order here, so the answer depends on the build.UserErrorsorRequestCountmetric. A Scan this branch refuses ahead of the IAM decision has that gap until fix(server): count a request refused in the authorization step in UserErrors and RequestCount #1427 merges, so this PR merges after it. An authorized Query or Scan runs its request checks twice (#544, #562, #854) #1422 (mine) tracks the double run ofchecked_bodyon fix(query): check Query values against the key schema and the number rules #544, fix(scan): check the numbers in ExpressionAttributeValues as the service does #562 and this PR.print_orderandbucketincrates/engine/src/partiql/request_checks/echo.rs. fix(server): read request members in the client's order on every build #781 (mine) moves them toextenddb_core::map_order::hash_map_order. This branch keeps its own copy inscan_request/member_order.rs. Scan needs the request's order from the request text, and the echo reads the parsed map. Scan also needs the table to double at nine names in one bucket. The echo model sizes the table by the count of names alone. Whichever of the two merges second moves the doubling intohash_map_order, makes Scan call it and deletesfitted_member_order.Not measured, kept in the code's order
AttributesToGetlength clause beside aSegmentorTotalSegmentsfault alone, and againstReturnConsumedCapacityin order R.ScanFilter: {}andAttributesToGet: []with aProjectionExpression.ExpressionAttributeNameswith no expression,ConditionalOperatorand theScanFiltervalue count.ScanFilterlist value in order U (the texts of order U).Selectenum against the mix (the enum first). The mix besideSelect: "BAD"and an empty entry answers theSelectclause.ExpressionAttributeValuesentry (the empty value, the element order). The number ahead of the empty value is measured.ExpressionAttributeValuesagainst the key's faults (the key first, the set fault with the map's entries).BSwith duplicates in the key beside an unreadable expression value (no key prefix, the members unquoted).HashMapmakes such a bucket a tree, which moves one of its names to the front. The code keeps the request's order there.NS(the request's order).Min anExclusiveStartKeyvalue that share a bucket (the parsed map's order stands in for the request's).AttributesToGetandQueryFilterforms were not measured.Where the service's own sends disagreed, the code names one of the answers and the tests accept either. Those are a set fault in
ExpressionAttributeValuesagainst a malformed number in another entry (the number first here), and two set faults (the first by placeholder). They also cover two malformed numbers, a number or a set fault beside a nested value, and two value faults in two key members.Testing done
At
a2fb7ddd3, the merge of the base atbed665f5a:cargo +1.97.0 test -p extenddb-engine --lib: 969 passed on the default build and 969 in a build withextenddb-storage-mongodb(serde_json/preserve_orderon).cargo +1.97.0 test -p extenddb-core --lib: 1147 passed, 1 ignored.cargo +1.97.0 fmt --all -- --checkis clean.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server -p extenddb-storage-sqlite --all-targets -- -D warningsgave 0 warnings, and so did-p extenddb-enginewith--features extenddb-engine/backup-test-hooksand-p extenddb-corewith--no-default-features.cargo +1.91.1 check -p extenddb-core -p extenddb-engine -p extenddb-server --all-targetsgave 0 warnings.tests/test_partiql_item_depth.py,test_scan_checks_before_authorization.py,test_scan_number_values.py,test_query_scan.py,test_query_value_shapes.py,test_query_key_value_types.pyandtest_query_leading_keys_values.pygave 573 passed and 3 xfailed.tests/python/test_scan_request_rows.py,test_scan_request_validation.py,test_scan_range_constraints.pyandtest_scan_range_constraints_beside_values.pygave 356 passed and 3 xfailed. The 18 more than at00fec65efare the rows fix(query): check Query values against the key schema and the number rules #544's third round adds.--features mongodb, a mongo:7 replica set on 127.0.0.1,EXTENDDB_TEST_BACKEND=mongodb): the fivetests/files above withouttest_query_scan.pyandtest_query_leading_keys_values.py, andtest_scan_request_rows.py,test_scan_request_validation.pyandtest_scan_range_constraints_beside_values.pygave 753 passed and 6 xfailed.pytest --collect-onlycollects 7371 tests intests/and 1031 intests/python/, with no error.At
00fec65ef:cargo +1.97.0 test --locked -p extenddb-engine --lib: 969 passed. The 88 unit tests ofscan_request,query_key_valuesandint32_memberalso pass withserde_json/preserve_orderon, in a build withextenddb-storage-mongodb.cargo +1.97.0 fmt --all -- --checkis clean.cargo +1.97.0 clippy --locked -p extenddb-engine -p extenddb-server --all-targets -- -D warningsgave 0 warnings, with and without--features extenddb-engine/backup-test-hooks.cargo +1.91.1 check --locked -p extenddb-engine -p extenddb-server --all-targetsgave 0 warnings.clippy -W clippy::pedanticgives 12 warnings on lines this PR adds or changes: 7doc_markdown, 4needless_pass_by_valuein test helpers and 1similar_names.--no-default-features --features sqlite).tests/test_scan_checks_before_authorization.pypasses: its 19 rows answer the service's error code to a user allowed onlyDescribeTable, and the valid body answersAccessDeniedException.tests/test_query_scan.py,test_partiql_item_depth.py,test_query_key_value_types.py,test_query_value_shapes.py,test_query_leading_keys_values.py,test_scan_number_values.pyand the authorization file gave 555 passed and 3 xfailed.tests/python/test_scan_request_validation.py,test_scan_request_rows.py,test_scan_range_constraints.py,test_scan_range_constraints_beside_values.py,test_scan_edge_cases.pyandtest_query_scan.pygave 408 passed and 3 xfailed.--no-default-features --features mongodb, a mongo:7 replica set on 127.0.0.1): 431 passed, 6 xfailed. Thexfailrows are the three oftest_scan_request_rows.pyand the three oftest_partiql_item_depth.py.pytest --collect-onlycollects 7349 tests intests/and 1031 intests/python/, with no error.ExpressionValuesBody, 1 fails. Withfirst_faultin place ofhashed_membersinStartKeyBody::validate,a_shape_fault_in_a_key_value_answers_the_prefixed_textfails on the build without the MongoDB crate:{"M": {"q": {"N": "bob"}, "b": {}}}answers the empty value wherebobis expected. Withvalidate_before_authorizationrunning the request checks alone, as before316ea8e95, the eight new rows of the authorization file answerAccessDeniedExceptionon a SQLite server. Four of the earlier rows do too.5257ed892is a pure move. A line-by-line comparison of the commit finds no other added or dropped line. The exceptions are the file header, the module doc, themodanduselines, and the field visibility.At
1bdcf89b0:cargo +1.97.0 test --locked -p extenddb-engine --lib: 965 passed.cargo +1.97.0 fmt --all -- --checkis clean.cargo +1.97.0 clippy --locked -p extenddb-engine -p extenddb-server --all-targets -- -D warningsgave 0 warnings, with and without--features extenddb-engine/backup-test-hooks.cargo +1.91.1 check --locked -p extenddb-engine -p extenddb-server --all-targetsgave 0 warnings.clippy -W clippy::pedanticgives no warning on the lines of these two commits, and the same 15 on the lines of the PR as below.--no-default-features --features sqlite).tests/test_scan_checks_before_authorization.pypasses: its nine rows answerValidationExceptionto a user allowed onlyDescribeTable, and the valid body answersAccessDeniedException. At34fe82848it failed in four pytest jobs of CI, on theSelectrow and the unknown type descriptor row. Withtests/test_scan_number_values.pyit gave 90 passed.tests/test_query_scan.py,test_partiql_item_depth.py,test_query_key_value_types.py,test_query_value_shapes.py,test_query_leading_keys_values.pyand the authorization file gave 466 passed and 3 xfailed.tests/python/test_scan_request_validation.py,test_scan_request_rows.py,test_scan_range_constraints.py,test_scan_edge_cases.pyandtest_query_scan.pygave 393 passed and 3 xfailed.pytest --collect-onlycollects 7334 tests intests/and 1016 intests/python/, with no error.At
fafd29b61:cargo +1.97.0 test --locked -p extenddb-engine --lib: 965 passed. The Scan checks have 46 unit tests: 13 inscan_request/range_tests.rs, 8 inscan_request/tests.rs, 12 inrequest_tests.rs, 8 inkey_tests.rsand 5 inholder_tests.rs.scan_request,query_key_valuesandint32_memberalso pass withserde_json/preserve_orderon, in a build withextenddb-storage-mongodb.cargo +1.97.0 fmt --all -- --checkis clean.cargo +1.97.0 clippy --locked -p extenddb-engine --all-targets -- -D warningsgave 0 warnings, with and without--features extenddb-engine/backup-test-hooks, asclippy.ymlruns it.cargo +1.91.1 check --locked -p extenddb-engine --all-targetsgave 0 warnings.clippy -W clippy::pedanticon the engine gives 15 warnings on lines this PR adds: 9doc_markdown, 4needless_pass_by_valuein test helpers, 1similar_namesand 1too_many_lineson the Scan handler.tests/python/test_scan_request_validation.pyandtest_scan_request_rows.pyhold 245 tests: 242 passed, and 3 arexfail(the twoScanFilternumber rows for fix(query): check legacy conditions against the key schema #507, the value count text for Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838). Withtest_scan_range_constraints.py,test_scan_edge_cases.pyandtest_query_scan.pyintests/python/, 393 passed and 3 xfailed.test_scan_range_constraints.pyon a MongoDB server (--features mongodb, a mongo:7 replica set,EXTENDDB_TEST_BACKEND=mongodbasdevtools/run-tests --backend mongodbsets it): 341 passed, 3 xfailed.At
ae4fa32bf. Its production code differs fromfafd29b61only in the order it reads the members of anM. A build without the MongoDB crate sorts a parsed map, so there the two read them in the same order:cargo +1.97.0 test --locked -p extenddb-core --lib: 1147 passed, 1 ignored.tests/test_scan_number_values.py,test_query_scan.py,test_partiql_item_depth.py,test_query_key_value_types.pyandtest_query_value_shapes.pygave 552 passed and 3 xfailed.devtools/test-shards checkon three legs of the--comprehensivesuite, prepared withdevtools/test-shards prepare: 1016 tests, 327 + 326 + 363.cargo +1.97.0 clippy --all-targets -- -D warningsgave 0 warnings onextenddb-storage-postgres,extenddb-storage-sqliteandextenddb-servertoo, andcargo +1.91.1 check --locked -p extenddb-storage-postgres --all-targetsgave 0 warnings.Controls. Each puts back the old lines of one fix on the committed tree, and the unit tests then fail:
ScanFilterlist taking only a value the service cannot read: 1 testAttributesToGetclause in the older form: 2 testsvalue_shape_faultahead of the checks: 1 testMin sorted order, as6d2c7795cread them, in thepreserve_orderbuild: 1 test.a_shape_fault_in_a_key_value_answers_the_prefixed_textthen answers the empty value text for the key member{"M": {"k": {"N": "bob"}, "j": {}}}, where that build expectsbob. A build without the MongoDB crate passes with either orderA SQLite server built with the first five fails 10 of the 15 rows of 2026-11-23. They are the three
AttributesToGetrows, both list rows, the key row, the nine and ten names, and two of the three shape rows. The other five pass there as well. The two enum rows come from the base's builder, and the eight names do not double the table. The empty name row keeps the merge's order, and"Limit": "5"is the base's shape fault check.A MongoDB server built with the sort put back answers the number text for
fredfor bothzandbrows, on Scan and on Query. It fails the wire row of the key member. The MongoDB server offafd29b61answersboband the empty value text, as the service does on Scan.A Scan with 40,000
ExpressionAttributeValuesentries (908,994 bytes) went to debug SQLite servers, five sends each. It took 6.98 to 7.82 s on2e3e4996dand 0.72 to 0.79 s on9bbf50ef3.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
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.