Repository navigation
fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms - #850
LeeroyHannigan wants to merge 20 commits into
Conversation
…in the service's two forms The Scan range check reported the first fault in the order Limit, Segment, TotalSegments, with the previous release's texts for the two segment fields (Value '-1' at 'segment', and "The parameter TotalSegments should be greater than or equal to 1" for a value below 1). A float or an integer outside i64 in any of the three answered SerializationException. The service reports every range fault in one message. When each field present is an integer inside the int32 range it uses "Value at '<Field>' failed to satisfy constraint: ..." with the field capitalised and no value echoed, in the order Limit, Segment, TotalSegments. When any of the three is a float or outside int32, or an ExpressionAttributeValues entry is not one AttributeValue (empty, an unknown type descriptor, two descriptors), it truncates or saturates the value and uses "Value '<n>' at '<field>' ..." with the field in lower camel case and limit last. A float or an out-of-range integer that satisfies the constraint is accepted: Limit 1.5 returns one item and Segment 1.5 returns part of the table. The request-time check now builds that message from the raw body, and the three fields deserialize from any JSON number, truncated toward zero and saturated to int32, so the handler uses the value the check validated. Query answers the older form for a Limit of 0 beside an entry that is not one AttributeValue, as measured on Query. The two assertions in tests/test_query_scan.py that pinned the previous segment texts now assert the measured text. Measured against the service on 2026-10-25 (09:23, 09:25, 09:28, 10:38, 10:55 and 12:56 UTC), each request twice.
…members
Measured against the service on 2026-10-30 at 12:40 UTC, each request
sent twice, as a raw signed Scan:
- A fault in each of Limit, Segment and TotalSegments in the older form
(Limit 0.0, Segment -1, TotalSegments 1000001, and the same with
TotalSegments 1000001.0 and Limit 0) answers "3 validation errors
detected: Value '1000001' at 'totalSegments' ...; Value '-1' at
'segment' ...; Value '0' at 'limit' ...". The older form lists the
faults in the reverse of the newer form's order, which agrees with the
two-fault rows measured on 2026-10-25. The check put segment ahead of
totalSegments.
- Limit 0 beside an ExpressionAttributeValues entry {"L": [{}]} or
{"M": {"k": {"X": "1"}}} answers the older form, Value '0' at 'limit'.
The check read only the top level of each entry and answered the
newer form. Query reads the entries with the same function, so its
answer to Limit 0 beside these entries changes too.
- Limit -1.5 answers Value '-1', and Limit -0.5 and Limit -0 answer
Value '0'. The check already answered these as measured.
The tests send each measured row. The rows no test sent before were
measured on 2026-10-31 at 12:36 UTC, each request sent twice, and the
tests cite that measurement: Limit 0 beside a readable entry of each of
the ten types answers the newer form, Segment 0 with TotalSegments 1
returns the whole table, a Query with Limit -2147483649 beside an empty
entry echoes -2147483648 in the older form, and a Query with Limit 0
beside the two nested entries or the lower-case descriptor answers the
older form. The combinations test, which said its rows were not sent,
is renamed for what it checks: every fault in one message, and nothing
reported for a field inside its bounds; its eleven rows were measured
the same day.
Measured against the service on 2026-10-31 between 23:54 and 23:56 UTC, each request sent twice, as a raw signed Scan or Query: - Limit 0 answers the older form, Value '0' at 'limit', beside an empty value or one with an unknown type descriptor in ExclusiveStartKey or in a ScanFilter AttributeValueList on Scan, and beside an empty value in ExclusiveStartKey or in a KeyConditions or QueryFilter AttributeValueList on Query. Segment -1 with TotalSegments 2 beside an empty ExclusiveStartKey value answers Value '-1' at 'segment'. The check read only ExpressionAttributeValues and answered the newer form for these. - Limit 0 beside a readable value keeps the newer form: a number as the value of an S key in ExclusiveStartKey, an N entry in a ScanFilter list and an S entry in a KeyConditions list. The older-form check now reads ExclusiveStartKey and the AttributeValueList entries of ScanFilter on Scan and of KeyConditions and QueryFilter on Query, with the rule it applies to ExpressionAttributeValues entries. It reads the L and M members of those values the same way, which is not measured. range_tests.rs and query_key_values/tests.rs have the measured rows, and tests/python/test_scan_range_constraints.py sends them as raw signed requests: seven Scan and four Query tests.
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 twice, and against a SQLite server built from 24a3242. Five items are left: the rounding of long fractions (query.rs:207), null as a value that is not one AttributeValue (query_key_values.rs:270), the Query Limit form outside int32 (query_key_values.rs:119), the enum clauses in the older form (scan_request.rs:172), and test rows for the behaviours on range_tests.rs:1. I will approve once they are done. The newer and older forms, the field order, and the reads of the key and the condition lists match the service on every other row measured.
Smaller points, not conditions:
- The description gives 521 and 219 tests. At this head
cargo test -p extenddb-core -p extenddb-engine --libruns 1084 core and 680 engine tests. floats_and_out_of_range_integers_that_satisfy_the_constraints_are_accepted(range_tests.rs:123) asserts only that the body check returns Ok.- The doc comments at query.rs:145 and :210 say "any JSON number". A number outside f64 (
1e400) is refused at body parse before these lines run.
| } | ||
| // A float: `as` truncates toward zero and saturates at the int32 bounds. | ||
| #[allow(clippy::cast_possible_truncation)] | ||
| number.as_f64().map_or(0, |value| value as i32) |
There was a problem hiding this comment.
as_f64 rounds a long fraction to the next integer before the cast truncates it. The service truncates the decimal text. Scan "Limit": 2.99999999999999999999 returns 2 items on the service and 3 here. "Limit": 0.99999999999999999999 answers Value '0' at 'limit' ... on the service and returns 1 item here. "Segment": 0, "TotalSegments": 0.99999999999999999999 answers Value '0' at 'totalSegments' ... on the service and returns the whole table here. "Segment": 1.99999999999999999999, "TotalSegments": 2 reads segment 1 on the service and answers Segment: 2 is not less than TotalSegments: 2 here. 2.999999999999999 agrees. Reading the integer part from the number's text (for example through RawValue) would fix all four.
There was a problem hiding this comment.
Agreed. saturated_int32 reads the number as a double, so 0.99999999999999999999 reads as 1 here and 2.99999999999999999999 as 3, where the service truncates the written text. That is #1203, which proposes reading the integer part from the text. This branch now uses main's saturated_int32 (#1144), whose doc states the departure, and its own copy is gone (dabead0). The body names #1203 as open.
| /// Whether `entry` is an object that is not one AttributeValue, or an `L` or | ||
| /// `M` with such a member; see [`has_unreadable_attribute_value`]. | ||
| fn is_unreadable_attribute_value(entry: &Value) -> bool { | ||
| let Some(descriptors) = entry.as_object() else { |
There was a problem hiding this comment.
The service treats null here as a value that is not one AttributeValue. Scan "Limit": 0 with ":p": null, with ":p": {"L": [null]}, or with ExclusiveStartKey {"pk": {"S": null}, "sk": {"S": "s0"}} answers 1 validation error detected: Value '0' at 'limit' ... on the service. Here they answer SerializationException. "Segment": -1, "TotalSegments": 2 beside ":p": null answers Value '-1' at 'segment' ..., and Query KeyConditions AttributeValueList: [null] beside "Limit": 0 answers Value '0' at 'limit' .... {"NULL": true}, {"L": []} and "ExclusiveStartKey": null keep the newer form on the service.
There was a problem hiding this comment.
Fixed in dabead0. The check now uses the unreadable rule from #544, which counts a null, a null payload and a null L or M member. It reads the ExpressionAttributeValues entries, the ExclusiveStartKey values and the condition lists. Limit: 0 beside :p: null, beside {"L": [null]} or beside {"pk": {"S": null}} answers Value '0' at 'limit', Segment: -1, TotalSegments: 2 beside a null entry answers Value '-1' at 'segment', and the null KeyConditions entry on Query answers Value '0' at 'limit'. {"NULL": true}, {"L": []} and ExclusiveStartKey: null keep the newer form. Each row is in range_tests.rs, unreadable_tests.rs and the wire file, by equality. I re-measured the first and third rows on 2026-11-23 (14:51 UTC, twice each): the same texts.
| /// an `ExclusiveStartKey` value or of a list entry is read as one of an | ||
| /// `ExpressionAttributeValues` entry is; that is not measured. | ||
| /// | ||
| /// A value that is not an object is a shape fault, reported ahead of the |
There was a problem hiding this comment.
This holds for a string (the service answers Unexpected value type in payload), but not for null, which the service reads as a value that is not one AttributeValue. See the comment on line 270.
There was a problem hiding this comment.
Fixed in dabead0. That function is gone with the rest of this branch's reader. The doc of unreadable in query_key_values/unreadable.rs now states the rule. A null is a value the service cannot read. A value of another JSON type is a shape fault. The doc of has_unreadable names the three places it reads.
| } | ||
| } | ||
| Ok(()) | ||
| let clauses: Vec<String> = if older_form { |
There was a problem hiding this comment.
In the older form the service puts the Select and ReturnConsumedCapacity enum clauses in this message too. {"TableName": T, "Select": "BAD", "ReturnConsumedCapacity": "BAD", "FilterExpression": "a = :a", "ExpressionAttributeValues": {":a": {}}} answers 2 validation errors detected: Value 'BAD' at 'select' failed to satisfy constraint: Member must satisfy enum value set: [SPECIFIC_ATTRIBUTES, COUNT, ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES]; Value 'BAD' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE] (us-east-1, 2026-11-12, 10 sends), and main answers the same. This branch answers the returnConsumedCapacity clause alone. {"TableName": T, "Limit": 1.5, "Select": "BAD", "ReturnConsumedCapacity": "BAD"} splits the same way (2 sends). With six faults the service orders the clauses select, totalSegments, returnConsumedCapacity, segment, limit, attributesToGet, so the enum clauses sit inside this aggregate. The module comment on line 27 ("Both enums invalid answers the ReturnConsumedCapacity error alone") holds only in the newer form. {"Select": "BAD", "ReturnConsumedCapacity": "BAD"} with no other fault answers the returnConsumedCapacity clause alone on the service, as here.
There was a problem hiding this comment.
Fixed in dabead0. older_form_checks in query_key_values/unreadable.rs now builds the one message for Scan and Query. The order is the select clause, the totalSegments fault, the returnConsumedCapacity clause, the segment fault and the limit fault, also when only the enum clauses apply. Limit: 0.0, Segment: -1, TotalSegments: 1000001 beside both enums answers the five clauses. Your two rows answer the two enum clauses, as on main (measured 2026-11-23 14:51 UTC, twice each). The module doc no longer says the enums are not aggregated. The rows are in range_tests.rs and the wire file by equality.
| @@ -119,6 +119,16 @@ fn query_request_checks(body: &Value) -> Result<(), DynamoDbError> { | |||
| if let Some(limit) = body.get("Limit").and_then(Value::as_i64) | |||
There was a problem hiding this comment.
Query "Limit": -2147483649 with ":p": {"S": "p0"} answers 1 validation error detected: Value '-2147483648' at 'limit' ... on the service. Here it answers Value at 'Limit' .... The same Limit on Scan answers as the service here. The older form for a value outside int32 applies on Query without an unreadable value.
There was a problem hiding this comment.
Fixed in dabead0. Query's Limit now goes through the same ranges helper as Scan: a float or a value outside int32 takes the older path, with the value saturated. Limit: -2147483649 beside {"S": "p0"} answers Value '-2147483648' at 'limit', Limit: 0.0 answers Value '0' at 'limit', and both enums beside Limit: -2147483649 answer select, returnConsumedCapacity, limit (measured 2026-11-23 14:51 and 18:45 UTC, twice each). The rows are in unreadable_tests.rs and the wire file by equality.
| @@ -0,0 +1,321 @@ | |||
| // Copyright 2026 ExtendDB contributors | |||
There was a problem hiding this comment.
These rows answer as the service at this head, and no test fails if they change. Scan "Limit": 1.5, 2147483648 or 9223372036854775808 with "Segment": -1, "TotalSegments": 2 answers Value '-1' at 'segment' .... "Segment": 18446744073709551615, "TotalSegments": 2 answers Value '2147483647' at 'segment' .... ":p": {"L": [{"L": [{}]}]} beside "Limit": 0 answers Value '0' at 'limit' ... on Scan and Query. "Limit": 2147483647, "Segment": -1, "TotalSegments": 2 answers Value at 'Segment' .... The Query clamp has a wire test only.
There was a problem hiding this comment.
Added in dabead0 and 5fa0dda. range_tests.rs has your five rows (Limit 1.5, 2147483648 and 9223372036854775808 with Segment: -1, TotalSegments: 2, the Segment outside int32, and Limit: 2147483647 with the same segments) and the nested L on Scan. unreadable_tests.rs has the nested L and Limit: -2147483649 beside {} on Query. The wire file sends them all. The Query clamp now has unit rows beside a readable value and beside {}.
| ], | ||
| BillingMode="PAY_PER_REQUEST", | ||
| ) | ||
| wait_for_active(dynamodb_client, name) |
There was a problem hiding this comment.
If wait_for_active or a put_item raises, the table is not deleted. Moving the seeding inside a try with the delete in finally covers it.
There was a problem hiding this comment.
Fixed in 5fa0dda. The fixture seeds the items inside a try and deletes the table in finally, so a failure in wait_for_active or put_item does not leave the table behind.
|
#1344 fixes #1257, so the server now reads a number written with leading zeros in a request body. When serde_json refuses a body, the parse removes the leading zeros and reads the body again. A Scan
The last column comes from the code of the two branches. The merged tree was not built. Today each of these bodies gets a |
…heck
Measured against the service on 2026-11-12 (demohan's review rows) and on
2026-11-23 at 14:51 and 18:45 UTC. I sent each request twice, as a raw
signed Scan or Query on a table that does not exist:
- In the older form the service puts the Select and ReturnConsumedCapacity
enum clauses in the one message with the range clauses. The order is
select, totalSegments, returnConsumedCapacity, segment, limit. Limit 0.0,
Segment -1, TotalSegments 1000001 beside both enums answers five
clauses. Select BAD and ReturnConsumedCapacity BAD beside an empty entry,
or beside Limit 1.5, answer the two enum clauses. The check returned the
range clauses alone. For the two enum rows it returned the
ReturnConsumedCapacity clause alone, where main answers both.
- A null is a value the service cannot read as one type. Limit 0 beside a
null entry or an L with a null member answers Value '0' at 'limit'. So
does an ExclusiveStartKey value with a null S payload, and a null
KeyConditions list entry on Query. The check answered SerializationException
for these. {"NULL": true}, {"L": []} and a null ExclusiveStartKey member
keep the newer form.
- Query takes the older form for a Limit that is a float or outside int32
without any such value. Limit -2147483649 answers Value '-2147483648' at
'limit', and Limit 0.0 answers Value '0' at 'limit'. Both enums beside
Limit -2147483649 answer select, returnConsumedCapacity, limit. The
check answered the newer form or SerializationException.
- In the older form the aggregate comes ahead of the parameter mix and of
an invalid ExpressionAttributeNames key. A float Limit that satisfies
its constraint beside an N that is not a number answers the wrapped
numeric text.
- Limit, Segment or TotalSegments of another JSON type answers
SerializationException ahead of an invalid Select. The texts are the
service's: STRING_VALUE cannot be converted to Integer, TRUE_VALUE cannot
be converted to Integer, and no message for an array.
The Scan and Query request checks now share one path. int32_member reads
the three members as the service does, with main's saturated_int32
(#1144), finds their range faults, and builds the newer form. The handlers
read the members through it before they deserialize the body. A float or a
value outside int32 so reaches the storage layer truncated or saturated.
unreadable.rs reads ExpressionAttributeValues, ExclusiveStartKey and the
condition lists with the one rule. Its older-path checks take the range
faults beside the enum clauses. The Query Limit block, this branch's
saturated_int32, its Scan field deserializer, its unreadable-value reader
and its hand-built envelope are gone. The envelope is core's
validation_error_envelope.
saturated_int32 reads the number as a double. A long decimal such as
0.99999999999999999 reads as 1 here, where the service truncates the
written text and reads 0 (#1203).
range_tests.rs, unreadable_tests.rs and int32_member/tests.rs have the
measured rows, with the ones demohan listed that no test sent.
tests/python/test_scan_range_constraints.py sends the rows measured on 2026-11-12 and 2026-11-23 as raw signed requests. Each row asserts the service's text by equality: - nine Scan rows for the enum clauses inside the older-form message, with the three newer-form controls. - four Scan rows for the aggregate ahead of the parameter mix and the names key, and for the wrapped numeric text. - seven rows for a null as a value the service cannot read, with the three shapes that keep the newer form. - seven Query rows for a Limit that is a float or outside int32. - five rows from demohan's review: a float or saturated Limit beside a Segment fault, a Segment outside int32, and an L nested in an L. - the M member of a key value, the L member of a ScanFilter list entry and a null KeyConditions list entry. - three Scan rows and one Query row for a range field of another JSON type. They assert the SerializationException text, and the absent message for an array. The table fixture now seeds its items inside a try and deletes the table in finally. A failure in wait_for_active or put_item then does not leave the table behind. The file has 99 tests.
tests/test_scan_number_values.py came from fix/scan-number-check. On extenddb its range rows expected the previous release's Segment and TotalSegments texts and the Query Limit text. On DynamoDB they expected the service's texts, named as a #563 difference. This branch gives the service's texts. The eight rows now assert them on both targets, and the dual-target note drops the item.
|
The review body raised three points:
The body also lists what stays open, each with its issue. The leading-zero rows are #1344 and #1372. The long fractions and the double range are #1203. |
…tion The base brings the older-path checks of #544, #562 and #850 for Scan and Query. They are the range reader in int32_member, the aggregate with the enum clauses, has_unreadable, the names checks and the per-member shape fault check. The server also runs the Scan checks ahead of the IAM decision. This branch's copies of those checks go, and its order of the Scan checks stays: - A float or out-of-range Limit, Segment or TotalSegments puts a Scan in order U as well. On the base, Limit 1.5 beside an N of bob answers the number in the invalid-value form. - Order U makes the base's aggregate, the mix and the name keys at request time. The faulty ExpressionAttributeValues entries and an empty name come after the key's faults, in the hash order, as this branch measured. - Order R makes the base's number check, then this branch's set texts, then the nesting depth. The Select enum stays in the handler. - The start key, the ScanFilter lists and the expression values read each value with the base's first_fault, which now also finds set faults. It visits the members of an M in sorted order on every build. - The aggregate gains the AttributesToGet clause, last in the older form and first in the newer form.
demohan
left a comment
There was a problem hiding this comment.
Items 2 to 6 from the earlier review are resolved at 63a4933, and so are the Segment, TotalSegments and Limit rows that #562 left to this branch. 257 Scan and Query cases were sent twice each to the service and to a SQLite build of this head. This head matches the service on 234, against 201 at 24a3242 and 80 on main. No case that matched the service at 24a3242 answers differently here.
- Every null shape beside
Limit: 0answersValue '0' at 'limit', as the service does. A string value answers SerializationException. - The two-enum row beside
{},Limit: 1.5and the five-fault Scan answer in the older form, with the service's clauses in the service's order. Limit: -2147483649answersValue '-2147483648' at 'limit'on Scan and Query. Both wire rows assert that text and fail with the older-form switch disabled.- 87 of 91 Segment and TotalSegments rows match. The other 4 answer as main does.
- CI is green on 59 of 59 checks.
The long fraction below blocks the merge. I will approve once it and the set check are fixed.
crates/engine/src/query.rs:192
A Limit, Segment or TotalSegments with a long fraction is rounded, and the service truncates it. Twice each:
Limit: 0.99999999999999999999: the service answersValue '0' at 'limit' ..., and this head returns 200 with 1 item.Limit: 2.99999999999999999999: the service returns 2 items, and this head returns 3.TotalSegments: 0.99999999999999999999: the service answersValue '0' at 'totalSegments' ..., and this head scans the whole table.Segment: 1.99999999999999999999, TotalSegments: 2: the service reads segment 1, and this head answersSegment: 2 is not less than TotalSegments: 2.
Main refuses these bodies with SerializationException, so the float read on this branch introduced it. #1203 records it, and the branch needs the fix because the answers return items the service does not.
tests (range_tests.rs:149 and :275, unreadable_tests.rs:462, test_scan_range_constraints.py:159, :235 and :299)
These comments name the person who measured. Stating the measurement and its date is enough.
tests/test_scan_range_constraints.py:192
Optional. This comment sits above the UNREADABLE and READABLE lists and describes OLDER_FORM_BEFORE_THE_MIX, which starts at line 218.
| /// beside `{"N": "bob"}` answers `The provided starting key is invalid: | ||
| /// Supplied AttributeValue is empty, must contain exactly one of the | ||
| /// supported datatypes`). | ||
| pub(crate) fn older_form_checks( |
There was a problem hiding this comment.
older_form_checks does not call validate_sets. So when a Scan takes the older path, a duplicate or empty set in ExpressionAttributeValues is no longer refused ahead of IAM. The older path covers a decimal or out-of-range Limit, Segment or TotalSegments, and an unreadable value in ExclusiveStartKey or a ScanFilter list. Limit: 1.5 with ":a": {"NS": ["1", "1"]}, from a principal allowed only DescribeTable, answers AccessDeniedException here. 5d9eff4 answered ValidationException. The service answers the set error on this path (ExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :a). A row of this shape in test_scan_checks_before_authorization.py would hold it.
There was a problem hiding this comment.
Fixed in fa1a640. older_form_checks now checks the sets of every ExpressionAttributeValues entry after the numbers, through the same first_fault walk. The check runs when a member that can read a value is present: FilterExpression on Scan, KeyConditionExpression or FilterExpression on Query. A duplicate number set answers Input collection contains duplicates, wrapped, the text core gives a statement parameter. An empty set and a duplicate SS answer the deserializer's text, wrapped.
Measured 2026-11-24 at 05:41 UTC, each body twice, as a raw signed Scan or Query on a table that does not exist. Each body carried Limit: 1.5 and a filter that reads the value. {"NS": ["1", "1"]} answers ExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :a on Scan and on Query, and inside an L. {"NS": []} answers ... One or more parameter values were invalid: An number set may not be empty for key :a. {"SS": ["x", "x"]} answers ... Input collection [x, x] contains duplicates. for key :a. An invalid names key comes ahead of the set, an empty name after it. With no FilterExpression, or with a ProjectionExpression alone, the service answers the expressions-only text instead, so the check does not run then.
tests/test_scan_checks_before_authorization.py sends the duplicate and the empty NS beside Limit: 1.5 from the principal allowed only DescribeTable and gets the set text. The rows are in unreadable_tests.rs and in the wire file. With the set pass removed from older_form_checks, the unit test fails on the first row.
The body parser keeps a number with a fraction or an exponent as the nearest double, and saturated_int32 truncates that double. So a long fraction such as 0.99999999999999999999 reached the range check as 1, and the check passed it. The service truncates the written decimal and reads 0. Measured against the service on 2026-11-24 at 05:41 UTC, each request twice. Each body went out as a raw signed Scan or Query on a table that does not exist: - Limit 0.99999999999999999999 answers Value '0' at 'limit' on Scan and on Query. Limit -0.99999999999999999999 answers the same on Scan. - TotalSegments 0.99999999999999999999 answers Value '0' at 'totalSegments'. - The service accepts Segment -0.99999999999999999999 of TotalSegments 2, so it reads the Segment as 0. It accepts a Query Limit of 2.99999999999999999999. The server now reads a float Limit, Segment or TotalSegments of a Scan or Query from the digits the request wrote. It does so right after it parses the body and before any check. int32_member::read_floats_as_written takes the digits from the raw body and truncates the decimal toward zero. It saturates the value to int32 and puts it back in the body as a float. The member stays a float, so the request stays on the older validation path. ranges, read and saturate then give the service's value. An integer member is not touched. The engine's serde_json gets the raw_value feature for the digits. The server build had it already through axum. main refused these bodies with SerializationException, since Limit was an integer there. This branch read them through the double, so the fix belongs here. Refs #1203: an ExecuteStatement Limit still reads through the double. A number beyond the range of a double still fails the body parse, where the service reads it. int32_member/tests.rs has the reader's rows and the measured rows on Scan and Query. range_tests.rs has the Scan rows in its tables. The wire file has the refusals, the accepted Segment, and the pages of Limit 2.99999999999999999999. That page holds 2 items, where the double gave 3.
A float or out-of-range Limit, Segment or TotalSegments, or an unreadable
value, puts a Scan or Query on the service's older validation path. The
request-time checks of that path did not look at the sets. So a
duplicate or empty set in ExpressionAttributeValues reached the IAM
decision, and a principal that may not Scan the table got
AccessDeniedException. The service answers the set fault first.
Measured against the service on 2026-11-24 at 05:41 UTC, each request
twice. Each body went out as a raw signed Scan or Query on a table that
does not exist. Each carried Limit 1.5 and a FilterExpression that reads
the value:
- {"NS": ["1", "1"]} answers ExpressionAttributeValues contains invalid
value: Input collection contains duplicates for key :a, on Scan and on
Query, and inside an L.
- {"NS": []} answers the same wrapper around One or more parameter values
were invalid: An number set may not be empty.
- {"SS": ["x", "x"]} answers the wrapper around One or more parameter
values were invalid: Input collection [x, x] contains duplicates.
- The service reports an invalid ExpressionAttributeNames key ahead of
the set, and an empty name after it. It names a value it cannot read
as one type ahead of the set.
- With no FilterExpression, or with a ProjectionExpression alone, the
service answers ExpressionAttributeValues can only be specified when
using expressions: FilterExpression is null. It does so for the
duplicate set and for an N that is not a number.
older_form_checks now checks the sets of every ExpressionAttributeValues
entry after the numbers of every entry, as the newer path does, through
the same first_fault walk. The duplicate number set text is the one core
gives a statement parameter. has_equal_numbers and that text move from
core's partiql module, which a build without the partiql feature leaves
out, to validation::number. The deserializer gives the other texts
through deserializer_fault, which validate_sets now uses too. The check
runs only when a member that can read a value is present: FilterExpression
on Scan, KeyConditionExpression or FilterExpression on Query. With none
present the handler answers the expressions-only text after these
checks. The number check runs as before in that case, where the service
answers the expressions-only text. That is a gap of its own.
Beside a set fault in one value and a number fault in another, the
service named :n in both arrangements (#1013). This order names the
number.
unreadable_tests.rs has the measured rows on Scan and Query.
test_scan_checks_before_authorization.py sends the duplicate and the
empty NS from a principal allowed only DescribeTable.
test_scan_range_constraints.py sends the four texts on Scan and the
duplicate NS on Query.
Six comments in range_tests.rs, unreadable_tests.rs and test_scan_range_constraints.py named the person who measured the rows of 2026-11-12. They now state the measurement and its date. The comment on the 18:45 UTC rows of 2026-11-23 in test_scan_range_constraints.py sat above the UNREADABLE and READABLE lists. It describes OLDER_FORM_BEFORE_THE_MIX, so it now sits above that list.
query_key_values.rs was 646 lines. The walk over one AttributeValue is a concern of its own. It answers what is wrong inside one value. The request-time number check and the older validation path both call it, each with its own texts. It holds Fault, first_fault, set_fault, deserializer_fault and number_fault, with NULL_VALUE and TYPE_DESCRIPTORS, which only the walk and unreadable.rs read. So it moves whole to query_key_values/value_fault.rs, beside unreadable.rs, which holds the older path. The moved text is the text of the parent file. Fault with its two methods, first_fault and TYPE_DESCRIPTORS are pub(super) now, because the parent and unreadable.rs call them. One doc link to older_form_checks became plain code, as the name is out of scope in the new file. deserializer_fault keeps pub(crate) for scan_request.rs through a re-export in the parent. Outside the moved text only the mod, use and re-export lines change. query_key_values.rs is 470 lines and value_fault.rs 193.
tests/python/test_scan_range_constraints.py was 628 lines. The rows that put a range field beside an attribute value move to test_scan_range_constraints_beside_values.py, with the three classes that send them. The value is an ExpressionAttributeValues entry, an ExclusiveStartKey value or a condition list entry. The tables are UNREADABLE, READABLE, UNREADABLE_MEMBERS, OLDER_FORM_SETS, NULL_ROWS, KEY_AND_LISTS, QUERY_KEY_AND_LISTS and QUERY_OLDER_FORM. The first file keeps the rows on the range fields alone, the enum clauses, the int32 shapes and the accepted values. No row, assertion or helper changed. The new file imports the messages, the request helpers and the table fixture from the first, as tests/test_query_value_shapes.py does from its neighbour. The 111 test ids are the same set, 58 in the first file and 53 in the second. The suite that runs tests/python collects the directory whole, and the shard planner assigns every collected file. So CI runs the new file with no change to the workflows. The files are 392 and 270 lines.
|
The long fraction is fixed in 48cd735. The body parser keeps a number with a fraction or an exponent as the nearest double, so Measured 2026-11-24 at 05:41 UTC, each body twice, on a table that does not exist. The rows are in The six comments name the measurement and its date now, and the comment on the 18:45 UTC rows sits above |
Brings in 0e0f078 and 35910e9 from fix/query-key-value-types, its merge of main at 44cd436, and the merge commit ad5f485 of fix/scan-number-check. Conflicts and their resolution: - crates/core/src/validation/number.rs: both branches add NUMBER_SET_DUPLICATES and has_equal_numbers with different doc comments. One copy stays, with one doc comment that names both measurements. - crates/engine/src/query_key_values.rs: this branch moved the value fault walk to query_key_values/value_fault.rs. The merge keeps that layout and drops the other branch's copy of Fault, first_fault, set_fault and number_fault. The shape fault walk keeps this branch's int32 arm for Limit, Segment and TotalSegments. It adds the other branch's ExpressionAttributeNames arm and its filter of null members. - crates/engine/src/query_key_values/unreadable.rs: older_form_checks keeps this branch's two passes over the values. A value the service cannot read as one type has its sets checked in the first pass, with its numbers. So a duplicate SS beside a second type descriptor keeps the duplicate text ahead of the more than one datatypes text. Carried into value_fault.rs: SS first in TYPE_DESCRIPTORS and the 2026-11-24 rows in the doc comments of first_fault and set_fault.
This merge adds main at b3c54f6, through the merges 6d74de7 and 330d685 on the two branches below this one. Two files conflicted: crates/core/src/error/messages.rs and mod.rs. Main's #468 added validation_errors_detected, with the same body as this branch's validation_error_envelope. The merge keeps main's function and removes this branch's copy. The one caller, newer_form in crates/engine/src/int32_member.rs, now calls validation_errors_detected.
demohan
left a comment
There was a problem hiding this comment.
The items from the earlier review are resolved at 627cb41. Each case was sent twice to the service in us-east-1 and to SQLite builds of this head and of 63a4933.
- Long fractions read from the digits as written:
Limit: 0.99999999999999999999andTotalSegments: 0.99999999999999999999answerValue '0' at 'limit'andValue '0' at 'totalSegments',Limit: 2.99999999999999999999returns 2 items where 63a4933 returned 3, andSegment: 1.99999999999999999999and-0.99999999999999999999return the items of segments 1 and 0. 51 more forms, including exponents, fractions just under the bounds and1e308,4.9e-324and1e-400, match the service, and 1,532 random texts match truncation saturated to int32. Paging and LastEvaluatedKey matchLimit: 2, and the second parse costs about 3.3 ms either way on a 900 KB body. - On the older path with a value-reading expression, an empty or duplicate NS, SS or BS, nested in
LandMtoo, answers the service's text on 20 of 20 rows, where 63a4933 matched none, and a principal allowed only DescribeTable now gets that ValidationException ahead of the IAM decision. The order rows match the service. - The comments state the measurement date only, and the 18:45 UTC comment sits above
OLDER_FORM_BEFORE_THE_MIX. - Of 382 cases, none that matched the service at 63a4933 differs here; 333 of the 370 main cases match against 282. The new rows fail with each part of the fix removed, fmt, clippy and the 1.91.1 check are clean, core, engine and server pass, 661 wire tests pass on SQLite, and CI is green on 59 of 59 checks.
| ("null beside Select", {**NULL_BESIDE_SELECT, "ExpressionAttributeValues": {":v": None}}, SELECT_BAD), | ||
| ("exponent above int32", | ||
| {"FilterExpression": "a = :n", "ExpressionAttributeValues": {":n": {"N": "1e9999999999"}}}, OVERFLOW), | ||
| # A float Limit puts the request on the service's older validation path, |
There was a problem hiding this comment.
The comment says these rows were measured from a principal allowed only DescribeTable. That request was sent to ExtendDB builds only; the service's answer for such a principal was not measured. The measurement behind the rows is the owner's request at 05:41 UTC on a table that does not exist, and the comment can say that.
| /// beside `{"N": "bob"}` answers `The provided starting key is invalid: | ||
| /// Supplied AttributeValue is empty, must contain exactly one of the | ||
| /// supported datatypes`). | ||
| pub(crate) fn older_form_checks( |
There was a problem hiding this comment.
Optional. The older path checks every number twice and normalizes each NS member twice: a 100,000-member NS (889 KB) takes 202 and 208 ms against 106 and 114 ms on the newer path, linear and bounded by the request size.
There was a problem hiding this comment.
This stays in this PR. With an expression that reads the values, older_form_checks walks each value twice. The first pass checks the numbers of every value. The second pass checks the sets, and checks the numbers again on the way. To skip the numbers in the second pass, the recursive walk in first_fault needs a new parameter. A draft of that change adds 10 code lines and removes 7 in three files. It also conflicts in three places with #854, which changes the same walk.
The second normalization of each NS member is in set_fault. It calls has_equal_numbers and then the deserializer, which finds nothing more in a set that is not empty. #854 removes that deserializer call: its set_fault returns after has_equal_numbers for an NS.
The cost, on debug SQLite builds on 3 December 2026: a Scan with your 100,000-member NS (889,023 bytes), on a table that does not exist. Each figure is a median of 9 requests, in three series. This head takes 1,309 to 1,318 ms on the older path and 738 ms on the newer path. With the second pass skipping the numbers, the older path takes 1,076 to 1,080 ms per request. Series by series, the repeated number checks take 231 to 238 ms of each request.
…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
627cb41bemergesfix/scan-number-checkatb33d4588f, which carries main at018715e0d. No file conflicted. Main's fix(scan): drop the FilterExpression suffix from the values message #765 passes no expression parameters to the Scan values check. So a Scan withExpressionAttributeValuesand no expression that reads them gets the message with no suffix, as on the service.73a01aeb7mergesfix/scan-number-checkat330d685b7, which carries main atb3c54f683. Two files conflicted:crates/core/src/error/messages.rsandcrates/core/src/error/mod.rs. Main's feat(streams): AT_TIMESTAMP shard iterator on all four backends #468 addedvalidation_errors_detected, with the same body as this branch'svalidation_error_envelope. The merge keeps main's function and removes this branch's copy.newer_formincrates/engine/src/int32_member.rs, the one caller, now callsvalidation_errors_detected.627cb41be,cargo fmt --checkis clean, andcargo clippy --all-targets -- -D warningsis clean onextenddb-coreandextenddb-engine. The core lib tests give 1147 passed and 1 ignored. The engine lib tests give 956 passed and 1 failed. The failed test,backup::tests::a_slow_registration_does_not_end_the_job_at_its_first_check, is outside this branch and passed in 3 of 3 runs after that.bed665f5amergesfix/scan-number-checkat ad5f485, which carries fix(query): check Query values against the key schema and the number rules #544's third round (0e0f078 and 35910e9) and its merge of main at 44cd436. Conflicts in three files.crates/core/src/validation/number.rs: both branches addNUMBER_SET_DUPLICATESandhas_equal_numbers, and one copy stays, with one doc comment.crates/engine/src/query_key_values.rs: the merge drops fix(query): check Query values against the key schema and the number rules #544's copy of the value fault walk forvalue_fault.rs.shape_fault_firstgets fix(query): check Query values against the key schema and the number rules #544'sExpressionAttributeNamesarm and its filter of null members, beside this branch's int32 arm.crates/engine/src/query_key_values/unreadable.rs: the first pass ofolder_form_checksnow checks the sets of a value the service cannot read as one type. So{"SS": ["a", "a"], "N": "1"}answers the duplicate text ahead of the more than one datatypes text, as fix(query): check Query values against the key schema and the number rules #544 measured.value_fault.rsgetsSSfirst inTYPE_DESCRIPTORS.Five commits on top of the reviewed head
63a493394answer the review of 2026-11-24. They cover the long fraction, the set check on the older path and the comments, and two moves keep the files under 600 lines.48cd73513reads a floatLimit,SegmentorTotalSegmentsof a Scan or Query from the digits the request wrote.0.99999999999999999999now reads as 0 and answersValue '0' at 'limit', where the double read gave 1 and accepted the request (query.rs:192, A Limit number is read through a double: a decimal close to an integer reads as that integer, and a number beyond the double range fails the request parse, where DynamoDB reads the digits as written #1203).fa1a64046refuses an empty or duplicate set on the older path at request time, ahead of the IAM decision, with the service's wrapped text (unreadable.rs:268).44636031dstates the measurement and its date in the six test comments that named the person who measured. It also moves the comment on the 18:45 UTC rows above the list it describes.29aa161abmoves the value fault walk (Fault,first_fault,set_fault,deserializer_fault,number_fault) fromcrates/engine/src/query_key_values.rstoquery_key_values/value_fault.rs. Onlymod,useand visibility lines change.query_key_values.rshas 470 lines, where the round left 646.996359746moves the rows beside an attribute value fromtests/python/test_scan_range_constraints.pytotests/python/test_scan_range_constraints_beside_values.py. No row changes, and the two files hold the same 111 tests, 58 and 53.The earlier round,
5d9eff4d9to63a493394, answered the review of 2026-11-12. The test counts in Testing done are the ones at996359746.What
Stacked on #562 (
fix/scan-number-check). This branch adds its own commits on top of that branch.The
ScanandQueryrequest-time checks readLimit,SegmentandTotalSegmentsthrough one helper,crates/engine/src/int32_member.rs.rangesreads each member present as the service does, with main'ssaturated_int32(#1144): a fraction truncated toward zero, a value outside int32 saturated to the nearer bound. It records each range fault and whether a member is a float or an integer outside int32.newer_formbuilds the newer message: every fault in one message, the field capitalised and no value echoed, in the order Limit, Segment, TotalSegments.saturatereplaces the members in the body with the value the service reads, and the two handlers call it before they deserialize. SoLimit: 1.5reads as 1 andLimit: 2147483648as 2147483647 in the storage layer.read, from main, gives the service'sSerializationExceptiontexts for a member of another JSON type.The body parser keeps a number with a fraction or an exponent as the nearest double, so
0.99999999999999999999would reachsaturated_int32as 1.read_floats_as_written, in the same helper, runs in the server right after the body parse, for Scan and Query. It takes the digits of each float member from the raw body and truncates the decimal toward zero. It saturates the value to int32 and puts it back in the body as a float. The member stays a float, so the request stays on the older path, andranges,readandsaturategive the service's value. An integer member is not touched. The engine'sserde_jsongets theraw_valuefeature for the digits. The server build had it through axum.crates/engine/src/query_key_values/unreadable.rsholds the service's older validation path. A request takes it when one of its range members is a float or outside int32. It also takes it when a value in the request is one the service cannot read as one type. Such a value is a null, an empty object, an unknown or doubled type descriptor, or a null payload. It can sit at the top level or inside anLorMmember.has_unreadablereads theExpressionAttributeValuesentries, theExclusiveStartKeyvalues and theAttributeValueListentries ofScanFilteron Scan and ofKeyConditionsandQueryFilteron Query, with the one rule from #544.older_form_checksbuilds one message from theSelectclause, theTotalSegmentsfault, theReturnConsumedCapacityclause, theSegmentfault and theLimitfault, in that order. It echoes each value as the service reads it. Then it runs the parameter mix, theExpressionAttributeNameskey checks, the values and the names, as #544 measured them. The values pass has the sets. After the numbers of every entry, an empty set or a set with a duplicate member answers the wrapped text. A number set answersExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :a, the other sets the deserializer's text. The set check runs when a member that can read a value is present,FilterExpressionon Scan,KeyConditionExpressionorFilterExpressionon Query. A value the service cannot read as one type has its sets checked with its numbers, in the first pass. So a duplicateSSbeside a second type descriptor answers the duplicate text ahead of the more than one datatypes text (#544's rows of 2026-11-24). The duplicate number set text andhas_equal_numbersmove from core'spartiqlmodule, which a build without that feature leaves out, tovalidation::number.deserializer_faultgives the deserializer's texts to this path and tovalidate_setson the newer path.readable_for_shape_checkreplaces the parts the service cannot read in the same three places, so a null there is not a shape fault.crates/engine/src/scan_request.rsandquery_request_checksincrates/engine/src/query_key_values.rscallrangesfirst. On the older path they returnolder_form_checks. Otherwise they return the newer form for a range fault. Then they run the order the base measured:ReturnConsumedCapacity, the mix, the names, the numbers, the sets on Scan,Select.shape_fault_firstreports a range member of another JSON type withread's text.Gone from this branch: its own
saturated_int32anddeserialize_int32_fieldincrates/core/src/types/query.rs(the fields are main's again), itsTYPE_DESCRIPTORScopy andis_unreadable_attribute_value, the QueryLimitblock, and the hand-built envelope. The envelope is main'svalidation_errors_detectedincrates/core/src/error/messages.rs, besidevalidation_errors.Why
Refs #563. Refs #1203.
The issue's rows for a number written with a leading zero or
-0("Limit": 00,-01,"TotalSegments": 01000001) wait for #1344. The rows for1000001.and a lone-wait for #1372. Today the server's JSON reader refuses those bodies. With those branches they reachrangesas integers and get the newer form. The 20-digit fractions of the issue (0.99999999999999999999) read as the service reads them since48cd73513. So #563 stays open after this branch.Of #1203, this branch fixes the Scan and Query rows: a long decimal reads as written. An
ExecuteStatementLimitstill reads through the double. A number beyond the range of a double (1e309) still fails the body parse, where the service reads it. So #1203 stays open after this branch.I measured every row below against DynamoDB (us-east-1), each request twice, as a raw signed Scan or Query. The dates: 2026-10-25 at 09:23, 09:25, 09:28, 10:38, 10:55 and 12:56 UTC, and 2026-10-30 at 12:40 UTC. Also 2026-10-31 at 12:36 UTC and between 23:54 and 23:56 UTC. Then 2026-11-05 between 00:54 and 00:55 UTC and 2026-11-12 (the review's rows). Then 2026-11-23 at 14:51 and 18:45 UTC and 2026-11-24 at 05:41 UTC, both on a table that does not exist.
When
Limit,SegmentandTotalSegmentsare integers inside int32 and every value is readable, the service reports all range faults in one message. The order is Limit, Segment, TotalSegments, asValue at '<Field>' failed to satisfy constraint: ...with the field capitalised and no value echoed. TheReturnConsumedCapacityenum comes after the range faults, and both enums invalid answerreturnConsumedCapacityalone.When any of the three is a float or outside int32, the service takes its older path. It takes the same path when a value is one the service cannot read as one type. It truncates or saturates the numbers, from the digits as written:
0.99999999999999999999and-0.99999999999999999999read as 0, and2.99999999999999999999as 2. It puts theSelectandReturnConsumedCapacityenum clauses in the one message with the range clauses. Each clause readsValue '<v>' at '<field>' failed to satisfy constraint: ...with the field in lower camel case. The order is select, totalSegments, returnConsumedCapacity, segment, limit.Limit: 0.0, Segment: -1, TotalSegments: 1000001beside both enums answers five clauses.Select: BAD, ReturnConsumedCapacity: BADbeside an empty entry, or besideLimit: 1.5, answers the two enum clauses. That aggregate comes ahead of the parameter mix and of an invalidExpressionAttributeNameskey. A floatLimitthat satisfies its constraint beside{"N": "bob"}answers the wrapped text,ExpressionAttributeValues contains invalid value: ... for key :n, and beside a duplicate or empty set it answers the set's wrapped text. A null is one of the values the service cannot read.Limit: 0beside a null entry, beside{"L": [null]}, or beside anExclusiveStartKeyvalue{"S": null}answersValue '0' at 'limit'. So does a nullKeyConditionslist entry on Query.{"NULL": true},{"L": []}and a nullExclusiveStartKeymember keep the newer form. Query takes the older path for a float or saturatedLimitwithout any such value:Limit: -2147483649answersValue '-2147483648' at 'limit'. A range member of another JSON type answersSerializationException:STRING_VALUE cannot be converted to Integer,TRUE_VALUE cannot be converted to Integer, and no message for an array.The first table holds the range rows and the second the enum and null rows. The third holds the rows beside a value the service cannot read. The fourth holds the set rows on the older path, and the fifth the accepted values. Each row is one request, and the answer is the service's, which is also this branch's. The tables shorten each clause to
...after the field name or the value. The full texts are in the tests.Limit: 0Value at 'Limit' ... greater than or equal to 1Segment: -1Value at 'Segment' ... greater than or equal to 0Segment: -1, TotalSegments: 2Value at 'Segment' ... greater than or equal to 0Segment: 1000000, TotalSegments: 1000000Value at 'Segment' ... less than or equal to 999999TotalSegments: 0Value at 'TotalSegments' ... greater than or equal to 1Segment: 0, TotalSegments: 0Value at 'TotalSegments' ... greater than or equal to 1Segment: 0, TotalSegments: -1Value at 'TotalSegments' ... greater than or equal to 1TotalSegments: 1000001Value at 'TotalSegments' ... less than or equal to 1000000Limit: 0, Segment: -1, TotalSegments: 10000013 validation errors detected: Value at 'Limit' ...; Value at 'Segment' ...; Value at 'TotalSegments' ...Limit: 0, TotalSegments: 02 validation errors detected: Value at 'Limit' ...; Value at 'TotalSegments' ...Segment: -1, TotalSegments: 10000012 validation errors detected: Value at 'Segment' ...; Value at 'TotalSegments' ...Segment: 1000000, TotalSegments: 02 validation errors detected: Value at 'Segment' ...; Value at 'TotalSegments' ...Limit: -2147483648Value at 'Limit' ... greater than or equal to 1Limit: 2147483647, Segment: -1, TotalSegments: 2(2026-11-12)Value at 'Segment' ... greater than or equal to 0Limit: -2147483649Value '-2147483648' at 'limit' ... greater than or equal to 1Segment: 0, TotalSegments: 2147483648Value '2147483647' at 'totalSegments' ... less than or equal to 1000000Limit: 0.0Value '0' at 'limit' ... greater than or equal to 1Limit: -2147483649, Segment: -12 validation errors detected: Value '-1' at 'segment' ...; Value '-2147483648' at 'limit' ...TotalSegments: 1000001, Limit: 0.02 validation errors detected: Value '1000001' at 'totalSegments' ...; Value '0' at 'limit' ...Limit: 0.0, Segment: -1, TotalSegments: 1000001(2026-10-30)3 validation errors detected: Value '1000001' at 'totalSegments' ...; Value '-1' at 'segment' ...; Value '0' at 'limit' ...Limit: 0, Segment: -1, TotalSegments: 1000001.0(2026-10-30)Limit: -1.5(2026-10-30)Value '-1' at 'limit' ... greater than or equal to 1Limit: -0.5andLimit: -0(2026-10-30)Value '0' at 'limit' ... greater than or equal to 1Limit: 1.5,2147483648or9223372036854775808withSegment: -1, TotalSegments: 2(2026-11-12)Value '-1' at 'segment' ... greater than or equal to 0Segment: 18446744073709551615, TotalSegments: 2(2026-11-12)Value '2147483647' at 'segment' ... less than or equal to 999999Limit: 0.99999999999999999999andLimit: -0.99999999999999999999(2026-11-24)Value '0' at 'limit' ... greater than or equal to 1TotalSegments: 0.99999999999999999999(2026-11-24)Value '0' at 'totalSegments' ... greater than or equal to 1Limit: 0.99999999999999999999(2026-11-24)Value '0' at 'limit' ... greater than or equal to 1Limit: 0.0, Select: BAD(2026-11-23)2 validation errors detected: Value 'BAD' at 'select' ...; Value '0' at 'limit' ...Limit: 0, ReturnConsumedCapacity: BADbeside{}(2026-11-23)2 validation errors detected: Value 'BAD' at 'returnConsumedCapacity' ...; Value '0' at 'limit' ...Limit: 0.0, Segment: -1, TotalSegments: 1000001, Select: BAD, ReturnConsumedCapacity: BAD(2026-11-23)5 validation errors detected: Value 'BAD' at 'select' ...; Value '1000001' at 'totalSegments' ...; Value 'BAD' at 'returnConsumedCapacity' ...; Value '-1' at 'segment' ...; Value '0' at 'limit' ...Select: BAD, ReturnConsumedCapacity: BADbeside{}(2026-11-12 and 2026-11-23)2 validation errors detected: Value 'BAD' at 'select' ...; Value 'BAD' at 'returnConsumedCapacity' ...Limit: 1.5, Select: BAD, ReturnConsumedCapacity: BAD(2026-11-12 and 2026-11-23)Limit: -2147483649, ReturnConsumedCapacity: bad(2026-11-23)2 validation errors detected: Value 'bad' at 'returnConsumedCapacity' ...; Value '-2147483648' at 'limit' ...Limit: 1.5, Select: BADbeside aScanFilterand aFilterExpression(2026-11-23)Value 'BAD' at 'select' ...Limit: 0.0beside aScanFilterand aFilterExpression(2026-11-23)Value '0' at 'limit' ...Limit: 0.0, ExpressionAttributeNames: {"a": "b"}(2026-11-23)Value '0' at 'limit' ...Limit: 1.5beside:n = {"N": "bob"}(2026-11-23)ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :nSegment: -1, ReturnConsumedCapacity: NOPEbeside{"N": "bob"}(2026-11-23)Value at 'Segment' ... greater than or equal to 0Limit: 0, Select: NOPE, ReturnConsumedCapacity: NOPE(2026-11-23)Value at 'Limit' ... greater than or equal to 1Select: NOPE, ReturnConsumedCapacity: NOPE(2026-11-23)Value 'NOPE' at 'returnConsumedCapacity' ...Limit: 0beside a null entry (2026-11-12 and 2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside{"L": [null]}(2026-11-12)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,ExclusiveStartKey{"pk": {"S": null}, "sk": {"S": "s0"}}(2026-11-12 and 2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Segment: -1, TotalSegments: 2beside a null entry (2026-11-12)Value '-1' at 'segment' ... greater than or equal to 0Limit: 0,KeyConditionsAttributeValueList[null](2026-11-12)Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside{"NULL": true}or{"L": []}, or withExclusiveStartKey: null(2026-11-12)Value at 'Limit' ... greater than or equal to 1Limit: -2147483649beside{"S": "p0"}(2026-11-12 and 2026-11-23)Value '-2147483648' at 'limit' ... greater than or equal to 1Limit: 0.0(2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Limit: 0, ReturnConsumedCapacity: BADbeside{}(2026-11-23)2 validation errors detected: Value 'BAD' at 'returnConsumedCapacity' ...; Value '0' at 'limit' ...Limit: -2147483649, Select: BAD, ReturnConsumedCapacity: BAD(2026-11-23)3 validation errors detected: Value 'BAD' at 'select' ...; Value 'BAD' at 'returnConsumedCapacity' ...; Value '-2147483648' at 'limit' ...Limit: 1.5, Select: BAD, ReturnConsumedCapacity: BAD(2026-11-23)2 validation errors detected: Value 'BAD' at 'select' ...; Value 'BAD' at 'returnConsumedCapacity' ...Limit: 1.5beside:n = {"N": "bob"}(2026-11-23)ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :nLimit: 0.0beside aQueryFilterand aFilterExpression(2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Segment: "1", TotalSegments: 2, Select: BADand QueryLimit: "5", Select: BAD(2026-11-23)SerializationException: STRING_VALUE cannot be converted to IntegerLimit: true, Select: BAD(2026-11-23)SerializationException: TRUE_VALUE cannot be converted to IntegerLimit: [1], Select: BAD(2026-11-23)SerializationExceptionwith no message memberLimit: 0beside{},{"X": "1"}or{"S": "x", "N": "1"}Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside{"NS": []}or{"NS": ["1", "1"]}Value at 'Limit' ... greater than or equal to 1Limit: 0beside{"L": [{}]},{"M": {"k": {"X": "1"}}}or{"s": "x"}, with a filter that reads another entry (2026-10-30)Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside{"L": [{"L": [{}]}]}(2026-11-12)Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside one readable entry of each type (S,N,B,SS,NS,BS,M,L,NULL,BOOL), no expression (2026-10-31, ten rows)Value at 'Limit' ... greater than or equal to 1Limit: 0beside{},{"X": "1"}or{"S": "x", "N": "1"}, withKeyConditionExpression: "pk = :p"Value '0' at 'limit' ... greater than or equal to 1Limit: 0beside{"NS": []}or{"NS": ["1", "1"]}Value at 'Limit' ... greater than or equal to 1Limit: -2147483649beside{}(2026-10-31)Value '-2147483648' at 'limit' ... greater than or equal to 1Limit: 0beside{"L": [{}]},{"M": {"k": {"X": "1"}}}or{"s": "x"}(2026-10-31)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,ExclusiveStartKey{"pk": {}, "sk": {"S": "x"}}or{"pk": {"X": "1"}, "sk": {"S": "x"}}(2026-10-31)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,ScanFilterAttributeValueList[{}]or[{"X": "1"}](2026-10-31)Value '0' at 'limit' ... greater than or equal to 1Segment: -1, TotalSegments: 2,ExclusiveStartKey{"pk": {}, "sk": {"S": "x"}}(2026-10-31)Value '-1' at 'segment' ... greater than or equal to 0Limit: 0,ExclusiveStartKey{"pk": {"M": {"k": {}}}, "sk": {"S": "s0"}}(2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,ScanFilterAttributeValueList[{"L": [{}]}](2026-11-23)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,ExclusiveStartKey{"pk": {"N": "1"}, "sk": {"S": "x"}}(a number for anSkey), orScanFilterAttributeValueList[{"N": "1"}](2026-10-31)Value at 'Limit' ... greater than or equal to 1Limit: 0,ExclusiveStartKey{"pk": {}, "sk": {"S": "x"}}, orQueryFilterorKeyConditionsAttributeValueList[{}](2026-10-31)Value '0' at 'limit' ... greater than or equal to 1Limit: 0,KeyConditionsAttributeValueList[{"S": "p0"}](2026-10-31)Value at 'Limit' ... greater than or equal to 1The set rows below carry
Limit: 1.5and aFilterExpressionthat reads the value, on Scan unless noted (2026-11-24).:a = {"NS": ["1", "1"]}, on Scan and on QueryExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :a:a = {"L": [{"NS": ["1", "1"]}]}:a = {"NS": []}ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An number set may not be empty for key :a:a = {"SS": ["x", "x"]}ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: Input collection [x, x] contains duplicates. for key :a:a = {"NS": ["1", "1"]}withExpressionAttributeNames: {"a": "b"}ExpressionAttributeNames contains invalid key: Syntax error; key: "a":a = {"NS": ["1", "1"]}withExpressionAttributeNames: {"#a": ""}:a:a = {"NS": ["1", "1"]}beside:z = {"X": "1"}ExpressionAttributeValues contains invalid value: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes for key :z:a = {"NS": ["1", "1"]}beside:n = {"N": "bob"}ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :nThe service also named
:nwith the set in:nand{"N": "bob"}in:a, where this branch names:a. The service picks among faulty values by an order of its own (#1013). The branch checks the numbers of every value ahead of the sets, as on the newer path.Limit: 2147483648,Limit: 9223372036854775808,Limit: 1e2Limit: 1.5,Limit: 1.0Limit: 2.99999999999999999999(review of 2026-11-24)Segment: 1.5, TotalSegments: 2Segment: 1.99999999999999999999, TotalSegments: 2(review of 2026-11-24)Segment: -0.99999999999999999999, TotalSegments: 2(2026-11-24)Limit: 2.99999999999999999999(2026-11-24)Segment: 0, TotalSegments: 1, ConsistentRead: true(2026-10-31)The 2026-11-05 run (151 requests) put six shapes the service cannot read in the key, in
KeyConditionsand in the filter lists. They sat besideLimit0, -1 and -2147483648, beside -2147483649 on Query, and besideSegmentfaults on Scan. All 151 answer the older form, and 145 answer as this branch does. The six withLimit: 0andAttributesToGet: []beside a key value addValue '[]' at 'attributesToGet' failed to satisfy constraint: Member must have length greater than or equal to 1after theLimitclause. #854, stacked on this branch, adds that clause.Open after this branch, each with its issue:
-0rows of Scan range constraints: the service aggregates Limit, Segment and TotalSegments faults and uses two text forms by the value's size #563 wait for fix(server): read a number written with leading zeros in a request body #1344, and1000001.and the lone-for fix(server): read a trailing point and a lone minus sign in a request number #1372.ExecuteStatementLimitwith a long decimal reads as a double (0.99999999999999999as 1, where the service reads 0). A number beyond the range of a double (1e400) fails the body parse here, where the service accepts1e309. Both are A Limit number is read through a double: a decimal close to an integer reads as that integer, and a number beyond the double range fails the request parse, where DynamoDB reads the digits as written #1203.ExpressionAttributeValueswith noFilterExpressionanswers the expressions-only text on the service, ahead of a fault inside a value. Measured 2026-11-24 at 05:41 and 05:47 UTC. The text isExpressionAttributeValues can only be specified when using expressions: FilterExpression is null. This branch answers the fault inside the value: Scan on the older validation path: ExpressionAttributeValues with no FilterExpression answers the value fault, where DynamoDB answers the expressions-only text #1423.Limit: 0beside{"B": "!!!"}answersSerializationExceptionon both, with another text here: A B value that is not valid base64 answers serde's text in its SerializationException, where DynamoDB names the length #1189.Limit: "0"beside{}answers theExpressionAttributeValuestext here andSTRING_VALUE cannot be converted to Integeron the service: the shape-fault order, Query and Scan: a Limit fault beside an ExpressionAttributeValues fault answers the value fault; DynamoDB answers the Limit fault #778 row 2.ExclusiveStartKeyvalue the service cannot read, with no range or enum fault, beside{"N": "bob"}. The service answersThe provided starting key is invalid: Supplied AttributeValue is empty, ...ahead of the numbers (measured 2026-11-23 18:52 UTC on Scan and Query). This branch answers the numeric text, because the handler's start key check runs after the request-time checks. Neither this branch nor its base moves that check.This branch answers #778 row 1 (
Limit: 0beside{}on Query and Scan).Overlaps with other PRs
#399, #507 and #558 (base main) carry their own Scan range checks in
handle_scanwith the previous texts (Value '-1' at 'segment',The parameter TotalSegments should be greater than or equal to 1). Whichever of them and this branch merges second drops its copy. #854 sits on this branch and adds theattributesToGetclause to this message. At its head1bdcf89b0, which held63a493394, the three commits of this round conflicted with it inquery_key_values.rs,unreadable.rsandscan_request.rs, which #854 restructures. #854 merged them. Its head00fec65efholds996359746. The merge ofbed665f5ainto it conflicts inquery_key_values/value_fault.rsonly, in the doc comments and the signature line of the walk, which #854 rewrites. #1344 and #1372 change how the server reads a number and name this branch in their bodies. #781 conflicts with this branch incrates/core/src/partiql/params.rson theuselines:fa1a64046dropsuse std::collections::HashSet;and #781 drops the twobase64lines. The second to merge takes both removals.#468 merged into main on 2026-11-24 (
6aef346f4) withvalidation_errors_detectedincrates/core/src/error/messages.rs. This branch had its own copy,validation_error_envelope, with the same body. The merge73a01aeb7removes it, andcrates/engine/src/int32_member.rscalls main's function. #1262 adds a third copy,validation_failureincrates/engine/src/lib.rs, and drops it the same way when it merges.Testing done
crates/engine/src/scan_request/range_tests.rs: 13 tests, every row measured. They hold the range rows, the three-fault older-form rows, the negative fractions, the long fractions and the ten readable entry types. They also hold the enum clauses inside the older form (with the mix, names and numeric rows). The null rows, the key and list rows, and the rows of 2026-11-12 are there too. The accepted-values test also asserts the value the handler reads (1 for1.5, 100 for1e2, 2147483647 for2147483648, 2 for2.99999999999999999999, 1 forSegment: 1.99999999999999999999, 0 forSegment: -0.99999999999999999999).crates/engine/src/query_key_values/unreadable_tests.rs: three new tests. They hold the Query rows for a float or saturatedLimit, with the enum clauses, the mix and the wrapped numeric text. They also hold the null list entry and the nestedL. The set rows of the older path on Scan and Query are there too. So are the two rows the check does not refuse (no expression, aProjectionExpressionalone).crates/engine/src/query_key_values/tests.rskeeps theExclusiveStartKey,KeyConditionsandQueryFilterrows.crates/engine/src/int32_member/tests.rs: the handlers' reading of the members (1.5as 1,1e2as 100,2147483648and9223372036854775808as 2147483647,Segment: 1.5as 1). Also theSerializationExceptiontexts for a string, a boolean and an array, through the checks and through the handlers' read. Also the reader of the written digits (26 texts,2147483648.5,1e300and1e99999999999999999999among them). Also the long fraction rows on Scan and Query, through the server's read, the checks and the handlers' read.crates/core/src/types/query.rs: thesaturated_int32table, with-1.5,-0.5,-0,1e40and-1e40among its values.tests/python/test_scan_range_constraints.pyandtest_scan_range_constraints_beside_values.py: 111 tests (58 and 53) that send each row as a raw signed request and compare the message by equality. At63a493394the file had 99 tests. Against a SQLite server built from the base (6f722f7d7), 69 of those 99 failed and 30 passed. The 30 are rows the base already answers like the service. Among them:Limit: 0andLimit: -2147483648alone, and aSegmentfault beside a float or saturatedLimit(the base's segment text is the older form). Also the two enum rows the base aggregates and the newer-form enum controls. Also the four null rows that keep the newer form or a segment fault. And the acceptedLimit: 2147483648andSegment: 0, TotalSegments: 1, with the readable entries. The rest are Query rows the base's older path already answers. The 12 tests added this round: the long fraction refusals on Scan and Query, the pages ofLimit: 2.99999999999999999999and of the two long fraction Segments. Also the set rows on Scan and Query.tests/test_scan_checks_before_authorization.py: the duplicate and the emptyNSbesideLimit: 1.5, from a principal allowed onlyDescribeTable, answer the set text, notAccessDeniedException.tests/test_scan_number_values.py: the eight range rows assert the service's text on both targets.tests/test_query_scan.pythat pinnedValue '1000000' at 'segment'andValue '1000001' at 'totalSegments'assert the service's text.read_floats_as_writtenreading no member, four tests fail (the long fraction rows inint32_member/tests.rsandrange_tests.rs). With the set pass ofolder_form_checksremoved, the set test inunreadable_tests.rsfails.Gates on the head:
cargo +1.97.0 fmt --all -- --check.cargo +1.97.0 clippy --locked -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -D warnings, and the same forextenddb-enginewith--features backup-test-hooks.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -W clippy::pedanticgives no warning on a line this branch adds.cargo +1.91.1 check --locked -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets.cargo +1.97.0 test --locked -p extenddb-core --lib(1147 tests, 1 ignored) and-p extenddb-engine --lib(943 tests). Twobackup::testsfailed once under a load average of 26 and passed when run alone. Against a SQLite server built from44636031d:tests/python/test_scan_range_constraints.py,tests/test_scan_number_values.py,tests/test_scan_checks_before_authorization.py,tests/test_query_scan.py,tests/test_query_key_value_types.py,tests/test_query_value_shapes.pyandtests/test_query_leading_keys_values.py, 628 tests, all pass. At996359746fmt, both clippy commands, the 1.91.1 check and the engine lib tests (943) pass again. The two range files pass on a SQLite server built from it (111 tests).pytest --collect-onlycollectstests/(7099 tests) andtests/python(783) with no error. PostgreSQL, MongoDB and Cassandra run in CI. The checks read the request body before any backend call.At
bed665f5a, the merge of #544's third round, these pass: fmt, the two clippy commands and the 1.91.1 check. So do clippy onextenddb-corewithout default features and the engine check without default features.-p extenddb-core --libgives 1147 tests (1 ignored) and-p extenddb-engine --lib943. Against a SQLite server built frombed665f5a, the seven files above andtest_scan_range_constraints_beside_values.pygive 646 tests, all pass. The 18 more than 628 are the rows #544's third round adds.python3 -m pytest --collect-only -qcollectstests/(7121) andtests/python(783) with no error.Not measured: a
TotalSegmentsfault beside anExpressionAttributeValuesentry the service cannot read, and aSegmentfault beside such an entry other than a null. The probe measuredLimit: 0beside those entries,Segmentfaults beside a null entry, andSegmentfaults beside such a value in the key and theScanFilterlist. The code uses the older form for every fault in the message.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
A client sees the service's texts where the previous release gave its own. A
SegmentorTotalSegmentsfault readsValue at 'Segment' ...instead ofValue '-1' at 'segment' ...orThe parameter TotalSegments should be greater than or equal to 1. Several range faults come in one message. The server accepts aScanorQuerywith a float or an out-of-range integer inLimit,SegmentorTotalSegments. It reads the member as the service does, from the digits as written:0.99999999999999999999reads as 0. The previous release answeredSerializationException. ALimit,SegmentorTotalSegmentsof another JSON type answersSTRING_VALUE cannot be converted to Integerand the other texts of the service, where the previous release answered the deserializer's text. On the older path a duplicate or empty set inExpressionAttributeValuesanswersValidationExceptionwith the wrapped text at request time, before the IAM decision.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.