Skip to content

fix(query): check Query values against the key schema and the number rules - #544

Merged
LeeroyHannigan merged 33 commits into
mainfrom
fix/query-key-value-types
Nov 25, 2026
Merged

LeeroyHannigan merged 33 commits into
mainfrom
fix/query-key-value-types

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

The review of 24 November read d7e6ff3. This round adds 0e0f078 and 35910e9, and 4b5125a merges main at 44cd436. Main's four new commits change none of this branch's files. The bullets from 5cd089d to d7e6ff3 are the round before.

  • 5cd089d merges main at 8c64333. Of the files this branch changes, the merge changes only crates/engine/src/lib.rs, where main adds a module line.
  • 680c83b takes NOT_A_NUMBER, EMPTY_ATTRIBUTE_VALUE and MULTI_ATTRIBUTE_VALUE from core in place of three private copies in query_key_values.rs. Core now makes the three public. The texts do not change.
  • f07a565 fixes three comments on the order in which first_fault reads the members of an M.
  • 467e287 gives the service's message in a comment on each row of TestShapeFaultsAreReportedFirst.
  • e2d90f1 adds a Query section to docs/differences-from-dynamodb.md, with rows for Query on a table ARN in another account answers AccessDeniedException ahead of the request checks #974, Unicode decimal digits in N values: refused on writes, compared as text on reads #565 and Query beside a Limit above 2147483647 answers the number fault without the wrapper the service adds #976.
  • d7e6ff3 finds a shape fault in any member and value. When a request-time check fails, shape_fault_first now deserializes each member of the body on its own, and each ExpressionAttributeValues value on its own. Before, it deserialized the whole body once and stopped at the first member that failed. So Select: 5 beside an empty NS and Limit: 0 answered the Limit text, where the service answers SerializationException. The commit also stops counting two kinds of member as shape faults. One is a string in ConsistentRead or ScanIndexForward that the service reads as a boolean, such as "true", "T" or "0". The other is a number in Limit. Beside an invalid Select, e2d90f1 answered SerializationException for each, where the service and main answer the Select text.
  • 0e0f078 leaves the check's answer beside a null member or a null name. ScanIndexForward: null beside Select: "NOPE", and ExpressionAttributeNames: {"#a": null} beside an invalid Select or ReturnConsumedCapacity, answered SerializationException at d7e6ff3, where the service and main answer the enum text. The service reads a null member as an absent one and a null name as an empty name, which it reports after these checks. shape_fault_first now skips a null member and reads ExpressionAttributeNames without its null names. The handler's deserializer still refuses both (see Differences that remain).
  • 35910e9 names an empty set or a set with a duplicate member beside a second type descriptor, the Query case of Query: a value with two type descriptors and a duplicate set member answers another text than DynamoDB #1186. {"SS": ["a", "a"], "N": "1"} answered the more than one datatypes text, where the service answers Input collection [a, a] contains duplicates. for the value. first_fault now reads these set faults on that path, SS ahead of the numbers and NS after its own numbers, as measured. The SS and BS texts come from the AttributeValue deserializer. The NS text and its check move from core's partiql module to validation::number, so a build without the partiql feature has them.
  • In this description, "Differences that remain" drops the Query: a value with two type descriptors and a duplicate set member answers another text than DynamoDB #1186 line and adds the null member and null name rows. "Testing done" has the requests measured on 2026-11-24. The merge checks name the hunks that the PRs stacked on this branch get from these two commits.
  • In this description, "Why" and the dynamodb:LeadingKeys sentence now describe main as it is. "Differences that remain" names the issue for each difference and adds nine more. The merge checks are new, for main at 1d3be63. "Testing done" has the requests measured on 2026-11-23.

What

This branch adds two checks to the expression path of Query, in crates/engine/src/query_key_values.rs.

  1. An N value in ExpressionAttributeValues that is not a number answers The parameter cannot be converted to a numeric value: <value>. In the overflow, underflow and 38-digit cases, it answers the text for that case. An empty value answers the message with the colon and nothing after it. The answer has no ExpressionAttributeValues contains invalid value wrapper. On Query the service adds that wrapper in two cases. One is a value it cannot read as one type (see below). The other is a Limit above 2147483647 (see Differences that remain).

    The check covers the whole map, including NS members and values nested in L and M, whether the key condition, the FilterExpression or nothing reads them. The check reads each entry on its own, so a value that does not deserialize does not stop the check of another. The walk covers the same values that PutItem and UpdateItem check.

    The check accepts a Unicode decimal digit below U+10000 as the ASCII digit of the same value, as the service does. These digits are the 37 runs of ten general category Nd digits up to U+FF10 in Unicode 15.0, among them ASCII, fullwidth, Arabic-Indic and Devanagari. In crates/engine/src/decimal_digits.rs, the check folds each such digit to ASCII before the number rules run, with a binary search over the 37 run zeros. The check refuses a digit of the 31 runs from U+104A0 up, as the service does. Its refusal echoes the value with each decimal digit folded to ASCII. The fold applies to the check only. The handler and the server's key binding read the value as written (see Differences that remain). The fold adds no new dependency and does not change the write paths.

    The check runs at request time on the raw body, before ExtendDB deserializes it and before the table lookup. It runs in the service's order: Limit, the ReturnConsumedCapacity enum, the expression and non-expression parameter mix, ExpressionAttributeNames, the numbers, then the Select enum. This moves Limit ahead of the two enum checks and the table lookup. It also moves the mix check ahead of the table lookup and the Select check, and the Select check after the numbers. Because the checks read the raw body, a field that does not deserialize does not stop the ones before it.

    A value in ExpressionAttributeValues that the service cannot read as one type takes the service's own order. Such a value is a null, or holds no known type descriptor, more than one, or an unknown one beside a known one. A known type descriptor with a null payload counts as absent. A value that an L or M holds counts too. An invalid Select, an invalid ReturnConsumedCapacity and a Limit below 1 come first, together in one message, with the Limit text that names the value (Value '0' at 'limit' for 0). The parameter mix comes next, then the ExpressionAttributeNames key checks (an invalid key, a key over 255 bytes, an empty map). Then the first value with a fault answers ExpressionAttributeValues contains invalid value: <reason> for key <placeholder>, with a number echoed as written. Beside a second type descriptor, an empty set and a set with a duplicate member are faults of the value too. SS comes ahead of the numbers, so {"SS": ["a", "a"], "N": "bob"} answers One or more parameter values were invalid: Input collection [a, a] contains duplicates. for the value. NS comes after the N and its own numbers, and ahead of BS and L, so {"NS": ["1", "1"], "N": "bob"} answers the numeric text and {"NS": ["1", "1"], "L": [{"N": "bob"}]} answers Input collection contains duplicates. The answer names a value the service cannot read ahead of a number fault in another value. An empty name in ExpressionAttributeNames comes after the values. This code is in crates/engine/src/query_key_values/unreadable.rs.

    When a check fails, ExtendDB deserializes each member of the body, and each ExpressionAttributeValues value, on its own as part of the typed input. If the deserializer raises a SerializationException for a member of the wrong JSON type, ExtendDB returns it instead, which is the service's order. A fault in one member or value does not hide a shape fault in another. Beside Limit: 0, for example, Select: 5 next to an empty NS answers SerializationException, as on the service. So does {"S": 5} after an empty NS in another value. In an ExpressionAttributeValues value the service cannot read as one type, ExtendDB first replaces the parts the service cannot read. So a field of the wrong JSON type in the rest of the value still answers SerializationException. The service also reads a null in ExclusiveStartKey, and an unknown type descriptor there or in a KeyConditions AttributeValueList, as a value it cannot read as one type. ExtendDB looks for such values only in ExpressionAttributeValues (see Differences that remain). For a value with one type descriptor, a ValidationException the deserializer raises (an empty set, a duplicate, an invalid AttributeValue) does not preempt the check. Those orders are not measured (Query reports an invalid Select ahead of an empty set, a duplicate set member or a NULL of false #979). Neither does an AttributeValue with an unknown type descriptor.

    The service reads a string such as "true", "T" or "0" in ConsistentRead or ScanIndexForward as a boolean, and any number in Limit as an integer. It reads a null member as an absent one, and a null name in ExpressionAttributeNames as an empty name, which it reports after these checks. So ExtendDB does not count these members as shape faults. Any other string in those two members, such as "on", is a shape fault, as on the service. When a body passes every check, the handler deserializes it once. The handler still refuses every string in those two members, a null member or name, and a Limit such as 1.5 or 1e2 (see Differences that remain).

    The server runs the same request-time checks ahead of the IAM decision, because authorization binds no dynamodb:LeadingKeys value to a number it cannot parse. On main, a principal whose Allow carries ForAllValues:StringEquals dynamodb:LeadingKeys ["alice"] passes the IAM decision for pk = :u with :u = {"N": "bob"}, since no key is bound. The engine then refuses the request with the Condition parameter type does not match schema type text of item 2, and it serves no partition. A principal under a ForAnyValue, Null or plain-operator fence answers AccessDeniedException on main, where the request's error is the numeric ValidationException. In crates/server/src/request_helpers.rs the call sits between the tag ARN shape check and validate_operation_arns, after the cross-account refusal. The dev-mode return comes after these checks, so the Query checks also run in dev mode.

  2. A key condition value whose type is not the key attribute's type answers One or more parameter values were invalid: Condition parameter type does not match schema type. The check covers the partition key value and the sort key value under =, <, <=, >, >= and the reversed operand order. It also covers both BETWEEN bounds, the begins_with prefix, and the extra conditions of a multi-attribute index key. The check reads the queried table's or index's key schema. So it checks a GSI partition or range key and an LSI range key against their own definitions.

    On a single-attribute key schema with a KeyConditionExpression, the check runs after the key schema, FilterExpression, ProjectionExpression, unused value and Select checks and before the ExclusiveStartKey check. When a compared placeholder is undefined, the check returns without a verdict and ExtendDB reports the undefined placeholder, which is the service's order. On a multi-attribute key schema and for legacy KeyConditions, the key schema classifier checks the type first, as on main. Both places call the classifier's check_key_value_type.

    refuse_begins_with_on_number, from fix(query): classify and order key conditions on a multi-attribute GSI the way the service does #429, refused begins_with by the sort key's type. It now refuses by the type of the value, as the service does. An N or BOOL value answers Invalid KeyConditionExpression: Incorrect operand type for operator or function; operator or function: begins_with, operand type: N (or BOOL) on an S, N or B sort key. An S or B value on a sort key of another type answers the schema type message.

The legacy KeyConditions checks are not changed here. They land with #507, and #975 tracks their order against the other checks. Scan is not changed here (see Differences that remain).

The number check runs ahead of the FilterExpression placeholder check. So the Query row of #1211 (:n = {"N": "abc"} beside an undefined placeholder in the filter) gets the service's answer, The parameter cannot be converted to a numeric value: abc (SQLite server built from 5cd089d, 2026-11-23).

Refs #1211

The checks take NOT_A_NUMBER, EMPTY_ATTRIBUTE_VALUE and MULTI_ATTRIBUTE_VALUE from core, which makes them public. They also take NUMBER_SET_DUPLICATES and has_equal_numbers, which move from core's partiql module to validation::number so that every build has them. The partiql module reads them from there. The pieces below repeat code that exists elsewhere, each for the reason given:

  • first_fault and make_readable walk the raw AttributeValue JSON, beside the PartiQL walker (check_value and modelled_value in crates/core/src/partiql/params.rs). Their rules differ. The Query walker reads the numbers and the sets in every payload before it answers the more than one datatypes text. The PartiQL walker answers that text first. Core also compiles the PartiQL walker only with its partiql feature.
  • NULL_VALUE and TYPE_DESCRIPTORS repeat two private constants of the same PartiQL module, for the same reason. The engine builds without the partiql feature.
  • set_fault builds a one-descriptor value and reads the SS or BS refusal from the AttributeValue deserializer, so the duplicate and empty set texts have one copy.
  • enum_violation in unreadable.rs builds the enum clause that validate_enum_fields builds. Beside a value the service cannot read as one type, the enum clauses and the Limit clause go into one message, and validate_enum_fields returns a finished message.
  • The Value '<n>' at 'limit' text has five copies on main, in scan.rs, list_tables.rs and backup.rs. One helper for all of them would change three handlers that this branch does not touch.

Why

On main, a Query with a KeyConditionExpression refuses a key condition value of another type, a check from #429. It answers One or more parameter values were invalid: Condition parameter type does not match schema type (the schema type message), and it serves no partition for pk = :u with :u = {"N": "bob"} or {"N": "5"} on an S key. Main still answers differently from the service in the cases below, which this branch changes. The main answers come from the three test files below, run on 2026-11-24 against a SQLite server built from main at 44cd436. There, 150 of the 329 tests pass and 179 fail.

  • Main does not check that an N value in ExpressionAttributeValues is a number. For {"N": "bob"} as the key value on an S key, main answers the schema type message, where the service answers The parameter cannot be converted to a numeric value: bob. On a missing table, main answers ResourceNotFoundException. With {"N": "bob"} only in the filter, the request succeeds on main. Thirty nine Devanagari ones as a sort key value answer InternalServerError on main, where the service answers the 38-digit message.
  • Main makes the Limit and parameter mix checks after the table lookup, so Limit: 0 on a missing table answers ResourceNotFoundException. An invalid Select beside {"N": "bob"} answers the Select text, where the service answers the numeric text.
  • On a single-attribute key schema, main checks the key value's type ahead of the missing key, FilterExpression, ProjectionExpression, unused value and Select checks. The service checks the type after them. For example, sk = :s with :s = {"N": "5"} and no partition key condition answers the schema type message on main and Query condition missed key schema element: pk on the service.
  • Main refuses begins_with by the sort key's type. The service refuses it by the type of the value.
  • Main checks the two enums before it deserializes the body, and then answers the first fault the deserializer meets in member order. So ConsistentRead: 1 beside an invalid Select answers the Select text on main. Beside Limit: 0, Select: 5 next to an empty NS answers One or more parameter values were invalid: An number set may not be empty. The service answers SerializationException for both.
  • For a value the service cannot read as one type, main answers the deserializer's text. For {"X": "1"} main answers SerializationException (Start of structure or map found where not expected: unknown AttributeValue type descriptor: X), and the service answers ExpressionAttributeValues contains invalid value: Supplied AttributeValue is empty, must contain exactly one of the supported datatypes for key :z. For a set with a duplicate member beside an S or an N, such as {"SS": ["a", "a"], "N": "1"}, main answers Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes, and the service answers ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: Input collection [a, a] contains duplicates. for key :z (Query: a value with two type descriptors and a duplicate set member answers another text than DynamoDB #1186).
  • Main makes these checks after the IAM decision. A principal under a dynamodb:LeadingKeys fence then gets AccessDeniedException or the schema type message, where the request's error is the numeric ValidationException (see What).

Refs #1186

#1381 (mine) is the change for #1186 in core's AttributeValue deserializer, which reads the values of every request. This PR's first_fault reads Query values ahead of that deserializer, so it needs the same order here. The second of the two to merge drops the copy. On top of #1381, first_fault can take the deserializer's text for a value with two type descriptors, as the body of #1381 says. The two branches merge with no conflict.

Differences that remain

Merge checks

On 2026-11-23 I ran git merge-tree --write-tree of this branch at d7e6ff3 against main at 1d3be63. I also ran it against the current heads of the open PRs that change the same files. This branch merges clean with main. Each PR below merges clean with main on its own unless its line says otherwise, so these conflicts come from this branch. On 2026-11-24 I ran the same check at 35910e9 against main at 44cd436, which is clean. I also ran it against the three PRs that build on this branch. The two new commits change query_key_values.rs, unreadable.rs, number.rs and params.rs. Those PRs change the same files, so each of them gets conflicts when it merges this branch:

Commit 4a4e92f (fix(cassandra): pass the bare index name in IndexNotFound so the Query sentence matches the other backends) is in this branch, but main got the same change from #483. So the diff has no storage-cassandra hunk, and the squash message should omit that commit.

Testing done

Measured on the service

The requests went to us-east-1 from an admin principal, with client retries off. Each request went twice. The tables had these keys: pk S and sk S (with an LSI and a GSI), pk S and sk N (with a GSI), and bpk B and bsk B. Later requests also used a table with pk S and sk S and one whose GSI has HASH h1 (S) and h2 (N) and RANGE r (S).

2026-10-24 15:10 UTC, the reported shapes:

request answer
pk = :u, :u = {"N": "bob"} ValidationException The parameter cannot be converted to a numeric value: bob
pk = :u, :u = {"N": "5"} ValidationException One or more parameter values were invalid: Condition parameter type does not match schema type
pk = :u, :u a B value the schema type message
pk = :u, :u = {"BOOL": true} the schema type message
pk = :u AND sk = :s, :s = {"N": "5"} the schema type message
pk = :u AND pk > :v, :u = {"N": "bob"}, :v = {"S": "alice"} The parameter cannot be converted to a numeric value: bob
pk = :u AND pk > :v, :u = {"N": "5"}, :v = {"S": "alice"} Invalid KeyConditionExpression: KeyConditionExpressions must only contain one condition per key

2026-10-24 21:00 UTC, 77 requests, where the two checks fall against the other Query checks:

  • The service reports the numeric message ahead of a missing table, an unknown IndexName, an undefined placeholder, an unused value and a syntax error. It reports the message ahead of ConsistentRead on a GSI, a nested key path, a non-equality partition operator and an invalid ExclusiveStartKey as well. The message also comes ahead of the Select and ProjectionExpression checks and a reserved word in the filter. The service answers the numeric message for an N value that only the FilterExpression reads or that nothing reads. It reports Limit 0 and the expression and non-expression parameter mix ahead of the message. An empty N answers The parameter cannot be converted to a numeric value: , 1e200 answers the overflow message, and 39 digits answer the 38-digit message.
  • The service reports the schema type message after Query condition missed key schema element, a reserved word in the key condition, the unknown index, Limit 0 and the unused value. It also reports the message after the undefined placeholder, the missing table, ConsistentRead on a GSI, a begins_with operand error and a reserved word in the filter. A ProjectionExpression overlap and the Select checks come ahead of it too. The message comes before an invalid ExclusiveStartKey. It applies to the partition and the sort key, on the table, a GSI and an LSI, for the six comparison operators, BETWEEN and begins_with. It covers NULL, SS, L, M, BOOL and B values on an S key, S and N values on a B key, and S values on an N key.

2026-10-24 21:06 UTC, 29 requests:

  • An N value that is not a number inside L, M, NS or M in L in M, read by the filter or by nothing, answers the numeric message.
  • A nested empty N answers the message with the colon.
  • The service reports the numeric message ahead of a missing table for a value nothing reads, and ahead of the missing key condition refusal. It also reports the message for a value beside legacy KeyConditions.
  • Limit 0 comes ahead of a missing table, an unknown index, ConsistentRead on a GSI, the parameter mix and the numeric check.
  • The parameter mix comes ahead of a missing table.

2026-10-24 23:42 UTC, the request-time order:

  • An invalid Select beside {"N": "bob"} answers the numeric message. An invalid ReturnConsumedCapacity beside it answers 1 validation error detected: Value 'bad' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE].
  • Limit 0 comes ahead of an invalid Select and an invalid ReturnConsumedCapacity, and the parameter mix comes ahead of an invalid Select.
  • Limit -1 comes ahead of the numeric message.
  • Limit 0 comes ahead of a type mismatch and a number that is not a number in one request.

2026-10-25 11:31 UTC, Unicode decimal digits, on an S/N table holding an item with sk N 1 and a N 1:

  • A fullwidth, Arabic-Indic or Devanagari one as the sort key value returns that item (Count 1). As a filter value, it matches a (Count 1). As an unused value, it answers the unused-value text (the digit passed the number check).
  • Thirty nine Devanagari ones answer Attempting to store more than 38 significant digits in a Number in all three positions.
  • The service accepts 1\uff12 and 1e\uff12 (Count 0).
  • A fullwidth digit in an NS passes the check.
  • The service refuses a superscript two, a vulgar half, a fullwidth minus and a fullwidth full stop with the numeric message. It echoes the value as sent.
  • The service accepts PutItem with sk N \uff11, and GetItem by the fullwidth key and by the ASCII key both return the item with sk N 1. So the service stores the ASCII value.

2026-10-25 11:31 UTC, shape faults:

  • Limit: 0 with ExpressionAttributeValues: "x" and ExpressionAttributeNames: "x" with {"N": "bob"} answer SerializationException: Unexpected field type.
  • Limit: "1" with {"N": "bob"} answers STRING_VALUE cannot be converted to Integer.
  • AttributesToGet: {"a": 1} with ProjectionExpression answers Start of structure or map found where not expected.
  • QueryFilter: [1] with FilterExpression answers SerializationException with no message.
  • Select: 5 with {"N": "bob"} and Limit: 0 with Select: 5 answer NUMBER_VALUE cannot be converted to String.
  • Limit: 0 with {"N": "bob"} and no shape fault answers the Limit text.
  • Limit: 0 beside {"X": "1"} answers the Limit ValidationException (12:56 UTC), in its older Value '0' at 'limit' form.

2026-11-06, begins_with and the main merge:

  • An N or BOOL value answers Invalid KeyConditionExpression: Incorrect operand type for operator or function; operator or function: begins_with, operand type: N (or BOOL), on an S, N or B sort key.
  • An S or B value on a sort key of another type answers the schema type message.
  • The refusal comes before the unused-value check, a ProjectionExpression overlap, the Select check and a partition key value of the wrong type.
  • begins_with with an N value on an attribute outside the key schema answers the same refusal, on a table with an S or N sort key.
  • tests/test_query_key_value_types.py passed against the service (131 passed and 2 skipped at 19:30 UTC). So on a single-attribute key schema the type comes after the missing-key, filter, projection, unused-value and Select checks. fix(query): classify and order key conditions on a multi-attribute GSI the way the service does #429's early check now runs only on a multi-attribute key schema and for legacy KeyConditions. With the begins_with rows added, the file had 140 passed and 2 skipped against the service.
  • On a dev-mode server, tests/test_dev_mode_authorization.py passed, and the Query file gave the same answers as on a server that is not in dev mode.

2026-11-11:

  • An invalid ReturnConsumedCapacity comes ahead of the parameter mix with AttributesToGet, QueryFilter, ConditionalOperator or KeyConditions, and ahead of an N value that is not a number.
  • The service accepts digit one of each of the 37 Nd runs up to U+FF10 as a FilterExpression value. Digit one of each of the 31 runs from U+104A0 up answers The parameter cannot be converted to a numeric value: <value>.
  • {"N": "\uff11bob"} answers The parameter cannot be converted to a numeric value: 1bob.
  • :u with {"N": "bob"} beside :z with {"X": "1"} names :z in 40 of 40 requests. Twelve other shapes of :z beside that :u name :z too, and five shapes of :a beside it name :a.
  • {"L": [null, "x"]}, {"L": [{"X": "1"}, {"N": 5}]} and {"L": [null, {"B": "!!"}]} answer SerializationException, and so does {"S": 5, "X": "1"} with Limit 0.

2026-11-12, each request twice (the last one six times):

  • With TableName set to a table ARN in another account, {"N": "bob"} answers The parameter cannot be converted to a numeric value: bob, Limit: 0 answers 1 validation error detected: Value at 'Limit' failed to satisfy constraint: Member must have value greater than or equal to 1, and a valid body answers AccessDeniedException: The caller is not authorized to access the specified resource.
  • KeyConditions {"pk": EQ [{"N": "5"}]} on an S key answers the schema type message. Beside Select: SPECIFIC_ATTRIBUTES with no projection, beside Select: ALL_PROJECTED_ATTRIBUTES on the table, and beside QueryFilter {"a": {"ComparisonOperator": "EQ", "AttributeValueList": []}}, it answers the Select texts and the QueryFilter text.
  • Limit: 2147483648 beside {"N": "bob"} answers the text with the ExpressionAttributeValues contains invalid value wrapper, and Limit: 2147483647 beside it answers the bare text.
  • Six identical requests with :a {"N": "aaa"}, :b {"N": "bbb"} and :c {"N": "ccc"} named aaa, bbb, aaa, bbb, ccc and ccc.

2026-11-23, 15 bodies, each request twice with the same answer, with a TableName that does not exist. Each Query body without its own key condition has pk = :p and :p = {"S": "x"}. The Select text is 1 validation error detected: Value 'NOPE' at 'select' failed to satisfy constraint: Member must satisfy enum value set: [SPECIFIC_ATTRIBUTES, COUNT, ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES].

request answer
Limit: 0, :u = {"X": "1"}, Select: 5, pk = :u SerializationException NUMBER_VALUE cannot be converted to String
Limit: 0, :u = {"X": "1"}, pk = :u ValidationException 1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1
Limit: 0, :s = {"NS": []}, Select: 5 SerializationException NUMBER_VALUE cannot be converted to String
Limit: 0, :a = {"NS": []}, :b = {"S": 5} SerializationException NUMBER_VALUE cannot be converted to String
ConsistentRead: "true", Select: "NOPE" the Select text
ConsistentRead: "T", Select: "NOPE" the Select text
ConsistentRead: "on", Select: "NOPE" SerializationException Unexpected token received from parser
ConsistentRead: 1, Select: "NOPE" SerializationException NUMBER_VALUE cannot be converted to Boolean
ConsistentRead: "yes" ResourceNotFoundException
ConsistentRead: "true", Limit: 0 ValidationException 1 validation error detected: Value '0' at 'limit' failed to satisfy constraint: Member must have value greater than or equal to 1
ScanIndexForward: "true", Select: "NOPE" the Select text
ScanIndexForward: "0", Select: "NOPE" the Select text
Limit: 1.5, Select: "NOPE" the Select text
Scan: Limit: 0, :u = {"X": "1"}, Select: 5 SerializationException NUMBER_VALUE cannot be converted to String
Scan: ConsistentRead: "true", Select: "NOPE" the Select text

2026-11-24, 21 bodies, each request twice with the same answer, with a TableName that does not exist. Each Query body has pk = :p and :p = {"S": "x"}, or pk = :z for the :z rows. INVALID stands for ExpressionAttributeValues contains invalid value: , PARAMS for One or more parameter values were invalid: .

request answer
ScanIndexForward: null, Select: "NOPE" the Select text
ExpressionAttributeNames: {"#a": null}, Select: "NOPE" the Select text
ExpressionAttributeNames: {"#a": null}, ReturnConsumedCapacity: "NOPE" ValidationException 1 validation error detected: Value 'NOPE' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE]
ExpressionAttributeNames: {"#a": null}, :n = {"N": "bob"} INVALID The parameter cannot be converted to a numeric value: bob for key :n
ScanIndexForward: null ResourceNotFoundException
ExpressionAttributeNames: {"#a": null} ValidationException ExpressionAttributeNames contains invalid value: Empty attribute name for key #a
:z = {"SS": ["a", "a"], "N": "1"} INVALID PARAMS Input collection [a, a] contains duplicates. for key :z
:z = {"SS": ["a", "a"], "N": "bob"} the same
:z = {"SS": ["a", "a"], "X": "1"} the same
:z = {"SS": ["a", "a"], "L": [null]} the same
:z = {"S": "x", "L": [{"SS": ["a", "a"]}]} the same
:z = {"NS": ["1", "1"], "S": "x"} INVALID Input collection contains duplicates for key :z
:z = {"NS": ["1", "1"], "L": [{"N": "bob"}]} the same
:z = {"NS": ["1", "1"], "BS": ["YQ==", "YQ=="]} the same
:z = {"NS": ["1", "1"], "N": "bob"} INVALID The parameter cannot be converted to a numeric value: bob for key :z
:z = {"NS": ["bob", "bob"], "S": "x"} the same
:z = {"BS": ["YQ==", "YQ=="], "N": "bob"} the same
:z = {"BS": ["YQ==", "YQ=="], "N": "1"} INVALID PARAMS Input collection [YQ==, YQ==]of type BS contains duplicates. for key :z
:z = {"SS": [], "N": "1"} INVALID PARAMS An string set may not be empty for key :z
:z = {"NS": [], "S": "x"} INVALID PARAMS An number set may not be empty for key :z
:z = {"BS": [], "N": "1"} INVALID PARAMS Binary sets should not be empty for key :z

Not measured

Whether the service answers a principal fenced away from the value with ValidationException or AccessDeniedException for the schema type case cannot be measured on this host. No restricted principal can be created there. The test file does not encode either answer. The same holds for a fenced principal and a value the service cannot read as one type: the LeadingKeys test pins ExtendDB's answer only. The order of Limit 0 against the Select ALL_ATTRIBUTES index projection check was not measured. The Limit check now runs first.

Tests

  • crates/engine/src/query_key_values/tests.rs: 19 unit tests at the checks. They cover the six comparison operators and the reversed operand order, both BETWEEN bounds, and S, N and B keys. Other cases are a GSI range key, a multi-attribute hash schema, #name references and an undefined placeholder, where the check returns without a verdict. The tests also cover the numeric messages, nested NS, L and M values, values the key condition does not name and sorted order. The rest cover the accepted and refused decimal digits and the folded echo.
  • crates/engine/src/query_key_values/request_order_tests.rs: 5 unit tests for the request-time order (Limit, ReturnConsumedCapacity, the parameter mix, the numbers, Select) and for a shape fault in another field. One of them holds 11 rows of 2026-11-23 and 3 rows of 2026-11-24. They cover a shape fault past a fault in another member or value, and ConsistentRead as a number and as "on". They also cover the members that the service reads as a boolean or an integer, a null member and a null name.
  • crates/engine/src/query_key_values/unreadable_tests.rs: 8 unit tests for values the service cannot read as one type. Four cover the named placeholder, the wrapped and echoed numbers, the value named ahead of a number fault and the combined enum and Limit message. One covers a number or set fault named ahead of the more than one datatypes text. It has 16 rows of 2026-11-19 and 15 rows of 2026-11-24. One covers a type descriptor with a null payload. Two cover shape faults.
  • crates/engine/src/query_key_values/names_tests.rs: 1 unit test with 28 rows for the ExpressionAttributeNames checks. The rows cover their place after the mix and ahead of the numbers. Beside a value the service cannot read as one type, they cover the key checks ahead of the value and an empty name after it. Other rows send names that no expression reads.
  • crates/engine/src/query_gate_tests.rs: 2 tests through handle_query. It refuses a legacy KeyConditions value of another type, and it refuses a multi-attribute value of another type before the non-key rule.
  • crates/engine/src/query_begins_with_tests.rs: 3 unit tests for the begins_with refusal by value type.
  • crates/engine/src/decimal_digits.rs: 5 unit tests (the measured digits and controls, the runs from U+104A0 up, the run zeros, folding of text).
  • tests/test_query_key_value_types.py (dual target): 214 tests. ROWS holds 170 parametrized rows, one per measured request whose answer the branch produces. The other 44 tests are controls and Unicode digit tests, among them digit one of each of the 37 runs below U+10000.
  • tests/test_query_value_shapes.py (dual target): 113 tests: TestShapeFaultsAreReportedFirst, TestValuesTheServiceCannotReadAsOneType, TestMembersTheServiceReadsAreNotShapeFaults and TestExpressionAttributeNamesOrder. The 11 rows of 2026-11-23 are in SHAPE_FAULTS (5 rows) and NO_SHAPE_FAULT (6 rows). On a SQLite server built from e2d90f1, 7 of the 11 fail. The 18 rows of 2026-11-24 are in NO_SHAPE_FAULT (3 rows) and UNREADABLE (15 rows). On a SQLite server built from d7e6ff3, 15 of the 18 fail. The 3 that pass there answer the numeric text and pin what does not change.
  • tests/test_query_leading_keys_values.py (ExtendDB only): 2 tests. Under ForAllValues, ForAnyValue, Null false, StringEquals, StringLike and StringNotEquals fences and as the owner, {"N": "bob"} as the key value, beside an invalid Select, only in the filter, or unused, gets ValidationException and no items. A partition key written with Unicode digits returns no item of a partition outside the caller's ForAllValues fence.

Merge of main

4b5125a merges main at 44cd436 with no conflict. Main's four commits change the PostgreSQL backup code, the SQLite management store, tests/conftest.py and five test files. This branch changes none of these files. The runs of this round above are on 35910e9, before this merge.

5cd089d merges main at 8c64333 with no conflict. On the merged tree, before the other commits of this round, cargo test -p extenddb-engine --lib passed (913 tests). The three Python files above passed (300 tests) on a SQLite server built from 5cd089d.

Gates

At 35910e9, the head:

  • cargo +1.97.0 fmt --all -- --check: clean.
  • cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine --all-targets -- -D warnings: 0 warnings. cargo +1.97.0 clippy -p extenddb-engine --all-targets --features backup-test-hooks -- -D warnings: 0 warnings. cargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warnings: 0 warnings. cargo +1.97.0 clippy -p extenddb-core --all-targets --no-default-features -- -D warnings: 0 warnings.
  • cargo +1.91.1 check -p extenddb-core -p extenddb-engine --all-targets and cargo +1.91.1 check -p extenddb-server --all-targets: 0 warnings. cargo +1.97.0 check -p extenddb-engine --no-default-features: 0 warnings.
  • cargo test -p extenddb-engine --lib: 914 passed, 0 failed. cargo test -p extenddb-core --lib: 1146 passed, 0 failed, 1 ignored. The same with --no-default-features: 885 passed, 1 ignored.
  • The three Python files above: 329 passed on a SQLite server built from 35910e9. pytest --collect-only collects tests/ (6916 tests) and tests/python (672 tests) with no error.
  • CI runs the workspace tests and the PostgreSQL, MongoDB and Cassandra tests.

At d7e6ff3, the same gates passed with 914 engine tests, 1146 core tests and 311 Python tests. The server clippy run also passed with --features backup-test-hooks,mongodb-test-hooks.

Earlier runs: at bf3f970, tests/test_query_value_shapes.py passed against DynamoDB (84 tests) on two runs. At cd7e8e8, the commit before bf3f970, the three files passed on a PostgreSQL server (296). They also passed against DynamoDB on two runs (294 passed, and the 2 ExtendDB-only tests skipped).

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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. There is no wire, Storage trait, auth model or on-disk change.

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.

…rules

A Query with a KeyConditionExpression did not check a key condition value's
type against the key attribute's AttributeDefinitions type, and did not check
that an N value in ExpressionAttributeValues is a number. The storage layer
compared the value's inner text with the stored key and ignored the type tag,
so {"N": "bob"} on an S partition key read the bob partition while
authorization bound no dynamodb:LeadingKeys value to it, and a sort key value
of another type answered InternalServerError on SQLite.

Add the two checks the service applies before it reads a row, on the
expression path (crates/engine/src/query_key_values.rs):

- an N value in ExpressionAttributeValues that is not a number answers
  "The parameter cannot be converted to a numeric value: <value>" (the
  overflow and 38-digit texts for those cases; an empty value answers the
  message with the colon). The check covers the whole map, including NS
  members and values nested in L and M, whether the key condition, the
  filter or nothing reads them, with the walk PutItem and UpdateItem already
  use. It runs at request time after the Limit and expression parameter mix
  checks and before the table lookup, which moves those two checks ahead of
  the table lookup as well. The server runs the same request-time checks
  ahead of the IAM decision, so a principal under any LeadingKeys fence form
  gets ValidationException and no items;
- a key condition value whose type is not the key attribute's type answers
  "One or more parameter values were invalid: Condition parameter type does
  not match schema type", for the partition key, the sort key under every
  comparison operator, both BETWEEN bounds, the begins_with prefix and
  multi-attribute index keys, after the key schema, filter, projection,
  unused value and Select checks and before the ExclusiveStartKey check. When
  a compared placeholder is undefined the check returns without a verdict and
  the undefined placeholder is reported.

Measured on the service on 2026-10-24 (113 requests, each sent twice). The
legacy KeyConditions path is unchanged; its checks land with #507. Scan is
unchanged. Unit tests at the checks and a dual-target wire test file,
tests/test_query_key_value_types.py, which fails on main.
… service's order

The server ran its pre-IAM checks only when the body deserialized as
QueryInput, and the engine checked the ReturnConsumedCapacity and Select
enums before them, so a Query carrying an invalid Select and an N value
that is not a number answered the Select message, or AccessDeniedException
for a principal whose LeadingKeys fence needs a value. The checks now read
the raw body in the service's order, measured 2026-10-24: Limit, the
expression and non-expression parameter mix, ReturnConsumedCapacity, every
number in ExpressionAttributeValues, then Select. The engine and the server
run the same function.
…ort a shape fault ahead of the request-time checks

The request-time number check refused an N value written with a Unicode
decimal digit (fullwidth, Arabic-Indic, Devanagari) that the service accepts
as the digit it stands for, so a Query that returns rows on the service
answered ValidationException here. The check now folds every general
category Nd digit to ASCII before the number rules run and echoes the value
as the request wrote it when the rules refuse it; the Nd zero code points of
Unicode 15.0 live in a module of their own. The fold applies to the check
only: the handler and the server's key binding read the value as written.
The write paths are unchanged.

The checks run on the raw body before deserialization, so a field of the
wrong JSON type elsewhere in the body (a string ExpressionAttributeValues
beside a Limit of 0, a string ExpressionAttributeNames beside a malformed N,
a numeric Select) answered the check's ValidationException where the service
and the previous release answered SerializationException. When a check fails,
the body is now deserialized as the typed input and a SerializationException
from that is returned instead; a ValidationException the deserializer raises
does not preempt the check, and a body that passes every check is not
deserialized twice. The server's call before dispatch goes through the same
function.

Measured against the service on 2026-10-25 (11:31 UTC) on tables with S/N
and S/S keys, each request twice. Unit tests cover the digit table, the
folded check and the shape-fault order; the wire file gains the measured
rows for both.
…ks, and assert only acceptance for Unicode digits

The shape-fault pass returned the deserializer's SerializationException for an
AttributeValue with an unknown type descriptor, so Limit 0 beside {"X": "1"}
changed class. The service answers the Limit ValidationException for that
body (measured 2026-10-25), and the check's answer is returned again.

The Unicode digit tests asserted that a key condition or filter written with
a Unicode digit reads the item stored with the ASCII digit. This change makes
the request-time check accept such a value; it does not change how the
handler reads it, so the tests assert only that the value is accepted. A new
test checks that a partition key value written with Unicode digits returns no
item of a partition a ForAllValues LeadingKeys fence keeps the caller from.
Conflict in crates/server/src/request_helpers.rs (authorize_request): main
moves the ARN shape checks and the GetRecords iterator decode ahead of the
dev-mode return. The resolution keeps the main version and puts the Query
request checks of this branch after the tag ARN shape check and before
validate_operation_arns. Thus the Query checks also run in dev mode.
Main changes resolve_multipart to take the HASH and the RANGE attribute
names (#429). The multi-attribute HASH test now gives r as the RANGE
attribute, as its attribute definitions do.
…l as the service does

On a single-attribute key schema, the later check of this branch now reports a
wrong type in a key condition expression, as the service does. The early check
from main still runs there for legacy KeyConditions, which the later check
skips. The begins_with refusal now reads the type of the value instead of the
type of the sort key.
…rder comments

Two new rows send begins_with with an N value on an attribute that is not in
the key schema. One row uses a table with an S sort key and the other uses a
table with an N sort key. The service refuses both requests with the
begins_with operand type message.

The comments in handle_query now say that the classifier checks the values of
legacy KeyConditions. They also say which attribute definitions it uses for
each kind of key schema. The doc of resolve_key_schema_with now says where the
service reports a wrong type on a single-attribute key schema (measured
2026-11-06).
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, eight commits after the last merge (#596, #1173,
#398, #428, #544, #567, #584 and #588). One file conflicted:
crates/engine/src/query.rs.

#544 moves the Limit check and the parameter mix check of Query into
validate_query_request_body, which reads the raw body before
deserialization. This branch moves the same two checks to the start of
the handler, after deserialization. The merge keeps the checks of #544
and drops the copies of this branch, which no request can reach. It
keeps has_cond_op for the ConditionalOperator check.

The conflict hunks in handle_query:

- At the old Limit check, both sides remove the check. The merge keeps
  the comment of #544.
- Next, this branch keeps the variables of the mix check, and main
  keeps the index key schema. The merge keeps the key schema where this
  branch has it. It drops the mix check variables, which nothing reads
  now, and keeps the comment of #544 and has_cond_op.
- Before the ExclusiveStartKey check, this branch removes the filter
  operand checks, because its semantic pass runs them at parse time.
  #544 adds validate_key_condition_types there. The merge keeps the
  type check and drops the filter checks.

#544 refuses a begins_with value that is not an S or a B ahead of an
unused value (rows q5 and p4 of tests/test_query_key_value_types.py,
measured 2026-11-06). This branch checks unused values before the
table lookup, so the merged code gave the unused value message for
those two rows. The merge calls refuse_begins_with_on_number after the
key condition parse and removes the later call. The values of legacy
KeyConditions pass validate_legacy_conditions before that point.

Git merged four other files that both sides change, with no overlap:
crates/core/src/expression/key_condition.rs, crates/engine/src/lib.rs,
crates/storage-cassandra/tests/common/mod.rs and
docs/differences-from-dynamodb.md.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, six commits after the last merge (#398, #428,
#544, #567, #584 and #588). Two files conflicted.

crates/engine/src/lib.rs: this branch adds query_key_size_tests and
#544 adds query_key_values to the module list. The merge keeps both in
name order.

crates/engine/src/query.rs, two hunks in handle_query:

- This branch moves validate_query_select_index_support after the start
  key checks, and #544 replaces the Limit check with a comment. The
  merge removes the early Select check and keeps the comment of #544.
- Before the ExclusiveStartKey check, this branch adds
  validate_query_key_sizes and #544 adds validate_key_condition_types.
  The merge runs the type check first, because the key size comment
  records a wrong-typed key value ahead of the size (measured
  2026-10-23). On a single-attribute key schema #544 checks the type
  there and not in resolve_key_schema_with, so the key size comment now
  says "checked above".
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
…te tests

#544 adds a TableKeyInfo literal to the test context of
crates/engine/src/query_gate_tests.rs. This branch adds the
creation_date_time field to TableKeyInfo, so the engine tests do not
compile after the merge of main at 80490c6. The literal now sets
creation_date_time to 0.0, as the other test literals on this branch do.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 80490c6, six commits after the last merge (#398, #428,
#544, #567, #584 and #588). One file conflicted:
crates/engine/src/query.rs.

This branch moves the table lookup, the index lookup and the index key
schema below the request-stage checks. #544 moves the Limit check and
the parameter mix check into validate_query_request_body, which reads
the raw body before deserialization. Three conflict hunks in
handle_query follow from this:

- After deserialization, this branch keeps the Limit check and main
  keeps the table lookup. The merge keeps the lookup where this branch
  has it and puts the comment of #544 in place of the Limit check.
- Next, this branch keeps the variables of the mix check and main keeps
  the index key schema. The merge keeps the key schema where this
  branch has it. It drops the mix check variables, which nothing reads
  now, and keeps the comment of #544 and has_cond_op.
- Before the ExclusiveStartKey check, this branch removes the filter
  operand checks, because its semantic pass runs them at parse time.
  #544 adds validate_key_condition_types there. The merge keeps the
  type check and drops the filter checks.

#544 refuses a begins_with value that is not an S or a B ahead of an
unused value (rows q5 and p4 of tests/test_query_key_value_types.py,
measured 2026-11-06). This branch checks unused values before the
table lookup, so the merged code gave the unused value message for
those two rows. The merge calls refuse_begins_with_on_number after the
key condition parse and removes the later call. The values of legacy
KeyConditions pass validate_key_conditions before that point.

Git merged four other files that both sides change, with no overlap:
crates/core/src/expression/key_condition.rs, crates/engine/src/lib.rs,
docs/differences-from-dynamodb.md and crates/engine/src/decimal_digits.rs,
which both sides add with the same content.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
…te tests

#544 adds a TableKeyInfo literal to the test context of
crates/engine/src/query_gate_tests.rs. The commits of #399 on this
branch add the creation_date_time field to TableKeyInfo. So the engine
tests do not compile after the merge of main at 80490c6. The literal
now sets creation_date_time to 0.0, as the other test literals on this
branch do.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/engine/src/query_key_values.rs: this branch makes two
  constants and four functions pub(crate) for the Scan checks, and
  re-exports three functions of unreadable.rs. It reads a number in
  Segment and TotalSegments as it reads one in Limit, with the dates
  in the doc comment of shape_fault_first. It passes
  validate_no_parameter_mix to unreadable_value_checks.
- crates/engine/src/query_key_values/unreadable.rs: this branch makes
  three functions pub(crate). unreadable_value_checks takes the
  parameter mix check as a parameter, so this branch deletes the
  import of validate_no_parameter_mix.
- crates/server/src/request_helpers.rs: this branch runs the Scan
  request checks before the IAM decision, as main does for Query.
- tests/test_query_leading_keys_values.py: this branch moves the setup
  of TestLeadingKeysWithAnInvalidKeyValue to the base class
  ManagementPrincipals, which
  tests/test_scan_checks_before_authorization.py imports.

Git merged crates/engine/src/lib.rs with no conflict. Main compiles
three modules only off wasm32 (backup, import_export_io and
private_fs), and adds the modules backup_requests and pre_dispatch.
This branch adds the module scan_request and changes the doc comment
of validate_enum_fields.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/engine/src/query_key_values.rs: the dates and the order in
  the module and function doc comments, the call of
  validate_condition_value_numbers, and the two functions
  validate_condition_value_numbers and refuse_first_fault.
- crates/engine/src/query_key_values/request_order_tests.rs: the
  import of Value and the test
  legacy_condition_values_get_the_number_check.
- tests/test_query_key_value_types.py: the dates in the docstring, the
  nn_table fixture and the helpers eq, N1, KC_ABC and QF_BOB. The merge
  also keeps the rows k1 to k16, and nn_table in the tables fixture and
  the control test.

Git merged crates/engine/src/lib.rs with no conflict. This branch
changes that file only through the commits of #544, so the merged file
is the file of main.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is at 14ade59. This branch last had main at 018715e, through
fix/query-key-value-types. Since then, these eleven commits merged
into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584,
#588 and #864.

#544 is the squash of fix/query-key-value-types, which was the base
branch of this PR. This branch already holds the last head of that
branch, 31c5f3d. Main has the same version of each conflicted file as
31c5f3d. So each conflict hunk has the lines of #544 on one side.
The other side has the change of this branch to the same lines. The
merge keeps the version of this branch in each file:

- crates/core/src/partiql/params.rs: this branch deletes the two
  base64 imports, because decode_base64 replaces check_base64.
- crates/core/src/types/attribute_value.rs: this branch adds
  BASE64_TEXTS, decode_base64 and is_base64_refusal after the two
  constants that #544 makes public.
- crates/core/src/types/mod.rs: this branch adds decode_base64 and
  is_base64_refusal to the names that #544 re-exports.
- tests/test_query_leading_keys_values.py and
  tests/test_query_value_shapes.py: this branch moves _raw_query to
  tests/raw_signed_request.py as client_post, and calls client_post in
  its place. No other test file on main calls _raw_query.

Git merged crates/engine/src/lib.rs with no conflict. Main compiles
three modules only off wasm32 (backup, import_export_io and
private_fs), and adds the modules backup_requests and pre_dispatch.
This branch adds serialization_exception and calls it from
deserialize_error.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict. No file has changes on both
sides.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict. No file has changes on both
sides.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864.

One file conflicted: crates/engine/src/import_export.rs. #1009 moves
the body of handle_import_table to import_table in the new file
crates/engine/src/import_export/files.rs. The wasm32 build replaces
that file with a stand-in that refuses the operation.
handle_import_table keeps the enabled check and calls
files::import_table.

This branch changes the body that #1009 moves. When read_items finds a
line that it cannot read, the import keeps the items before that line.
It counts the line as one error and reads no more of the file.

The merge keeps the code of main in import_export.rs, with the doc
comment of this branch on handle_import_table. It makes the three
changes of this branch to the body in files.rs:

- The variable read holds the result of read_items: the items and the
  line that the reader cannot read.
- The loop takes the items, then that line. At that line it logs the
  line number and the fault, counts one error and ends the import.
- The comment over the FAILED status adds the date 2026-11-22, for the
  lines that the import cannot read.

The body of import_table in files.rs is now the same as the body of
handle_import_table at the head of this branch.

Git merged docs/manuals/07-upgrade-manual.md with no conflict. #398
adds its v1.1.0 entry at the top of "Behavior Changes by Release".
This branch adds its v1.1.0 entry at the end of that section.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The base merges main at 14ade59. That brings #544 as a squash and
ten other commits: #1280, #1009, #596, #1173, #398, #428, #567, #584,
#588 and #864. The merge has no conflict.

Git merged crates/engine/src/lib.rs, the one file with changes on both
sides. Main compiles three modules only off wasm32 (backup,
import_export_io and private_fs), and adds the modules backup_requests
and pre_dispatch. This branch adds single_write_refusal after
deserialize_error.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
#544 moved the enum checks of handle_query into
query_key_values::validate_query_request_body, which runs before typed
deserialization. The merge takes that call from main and keeps this
branch's query_scan_deserialize_error for the deserialization error.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
#544 moved the enum checks of handle_query into
query_key_values::validate_query_request_body, which runs before typed
deserialization. The merge takes that call from main and keeps this
branch's read_input, which answers a missing TableName before the other
members.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
#544 moved has_equal_numbers and NUMBER_SET_DUPLICATES from
partiql/params.rs to validation::number, and this branch moved
check_parameter_types to serde_helpers. After the merge, params.rs uses
neither the base64 imports from main nor the HashSet import from this
branch. The merge drops both.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
Main is 10 commits ahead of the branch. Two files conflicted.

docs/manuals/07-upgrade-manual.md: both sides add a v1.1.0 entry at the
same place. Both stay, main's #398 entry first.

crates/engine/src/query.rs: #544 (1ddc087) moved the Limit, enum,
parameter mix, names and number checks of a Query into
query_key_values::validate_query_request_body. That function reads the
raw body before deserialization and before the IAM decision. This branch
runs its checks in query::request_checks::check_request. The three
conflict regions take this branch's side. handle_query reads the request
through check_request, and the empty key condition, parameter usage and
ConditionalOperator checks stay in check_request_parameters.
check_request now starts with validate_query_request_body and drops its
own copies of the ReturnConsumedCapacity enum check and the Limit check.
check_request_parameters drops its copy of the parameter mix check.
The copies of #544 merged first.

The Select enum check moves out of validate_query_request_body into
validate_query_select, which check_request runs after the
FilterExpression and KeyConditionExpression checks, with the same shape
fault rule. The measured rows settle the order. An undefined filter name
(H3) and a second condition on one key attribute (B4) answer ahead of an
invalid Select. An N value that is not a number (f1 of #544) and a Limit
of 0 (L7, f3) answer ahead of it. The server's check before the IAM
decision no longer includes Select. A principal the policy denies, with
an invalid Select, now gets AccessDeniedException where main gave the
Select text. That answer is not measured.

Both PRs refuse a begins_with value that is not a string or a binary
value. This branch's parser check stays, because the measured rows put
that refusal ahead of the duplicate check (D3) and in the parse (E1,
P1). handle_query now calls refuse_begins_with_on_number (#544) for a
legacy KeyConditions request only, so a KeyConditionExpression is not
checked twice.

Two unit tests of #544 that read the Select answer from
validate_query_request_body now read it from validate_query_select.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The merge of main moved the Select check behind the FilterExpression and
KeyConditionExpression checks. The check that the server makes before
the IAM decision then no longer covered Select. A principal the policy
denies got AccessDeniedException for an invalid Select. Main gives that
principal the Select text, because #544 checks Select before the IAM
decision.

refuse_duplicate_key_condition now runs check_request for an invalid
Select too. Every principal gets the Select text, or a fault that
check_request reports ahead of it. The measured rows still hold. An
undefined filter name (H3) and a duplicate (B4) answer ahead of an
invalid Select. No row measures the answer for a principal the policy
denies.

The new test an_invalid_select_is_refused_before_authorization sends
pk = :own and pk > :own with Select BOGUS, and the shape of H3.

It also deletes the three comment lines above the
validate_query_request_body call in check_request, which repeated the
list of checks in that function's doc.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
The branch of #484 merged main at 5252eda, which adds #544 (1ddc087).
Its next commit, 468b256, refuses an invalid Select before the IAM
decision. One file conflicted, crates/engine/src/query.rs, in three
places.

The key schema checks of handle_query: this branch runs them only when
the key condition has an equality on the HASH attribute. #544 runs the
classifier's type check only on a multi-attribute key schema or for
legacy KeyConditions, and #484's branch calls refuse_begins_with_on_number
for legacy KeyConditions only. The resolution keeps this branch's guard
around their code, and this branch's missed_key_schema_element helper.

refuse_without_hash_equality, beside the new doc of
check_request_parameters: both stay. The engine refusal drops its call
of refuse_begins_with_on_number. With #544 that function refuses a
begins_with value that is not a string or a binary value. The parse
refuses that value before the table lookup, and lacks_hash_equality
holds only for a KeyConditionExpression, so the call could not fail.
Rows 6 and the two begins_with rows of 1 November in
test_query_lone_non_equality.py stay, and the parse answers them.

The test modules: all three stay.

The code that only that call needed goes too.
KeyCondition::without_equality put a second clause that is a
begins_with into sk_condition, where the engine refusal read it. It now
keeps the first clause there. Two engine tests called the refusal with a
begins_with on a number key: this merge deletes one, and the other keeps
its row 6b.
@robinnsc robinnsc mentioned this pull request Nov 25, 2026
6 of 8 tasks
robinnsc added a commit that referenced this pull request Nov 26, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has two features (#468,
#1009) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #503,
#544, #567, #765 and #774, #588, #596, #690, #1144, #1173 and #1194,
next to the existing entries for #398 and #526. The #526 entry now
gives the old TransactWriteItems mismatch message, and the entries are
in PR order. Current Status, the General Upgrade Procedure and the
Rollback Procedure cover 1.0.0 to 1.1.0: no migrate step, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
robinnsc added a commit that referenced this pull request Nov 26, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has two features (#468,
#1009) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194 and #1375, next to the existing entries for #398, #526 and
#1166. The #526 entry now gives the old TransactWriteItems mismatch
message, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
* chore(release): bump version to 1.1.0

Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.

* docs(upgrade): add the v1.1.0 entry of #1290, put #1349's in order

#1290 merged after this branch was rebased. It changes the answer to a
request with no Authorization header, so it gets a v1.1.0 entry. The
merge of main put the #1349 entry after the #1523 entry. It moves to
the place of its number, beside the new #1290 entry.

---------

Co-authored-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
parsnips pushed a commit to parsnips/extenddb that referenced this pull request Dec 4, 2026
…endDB#481)

* fix(query): refuse key condition values over the key size limits

Closes ExtendDB#435.

The service refuses a Query whose key condition values exceed the key
size limits before it reads anything; ExtendDB ran the Query. Measured on
2026-10-23, every row repeated with identical answers:

- A HASH value over 2048 bytes: "One or more parameter values were
  invalid: Size of hashkey has exceeded the maximum size limit of2048
  bytes" (no space after "of", as the service writes it). 2048 bytes is
  accepted.
- HASH values that each fit but add up to more than 2048 bytes (an index
  with two HASH attributes): "One or more parameter values were invalid:
  Aggregated size of all hash keys has exceeded the size limit of 2048
  bytes". A sum of exactly 2048 is accepted. A single oversized value
  gets the single sentence even when the sum is also over.
- RANGE values adding up to more than 1024 bytes, one clause or several:
  "One or more parameter values were invalid: Aggregated size of all
  range keys has exceeded the size limit of 1024 bytes". 1024 is
  accepted. Every operator is sized (=, <, <=, >, >=, begins_with);
  BETWEEN contributes its larger bound, not the sum of both.
- The HASH checks are reported before the RANGE check.
- Strings are sized by UTF-8 bytes (683 U+20AC characters, 2049 bytes,
  refused; 682 plus "xx", 2048 bytes, accepted) and binary values by
  byte length. Base tables, LSIs, GSIs and legacy KeyConditions behave
  the same.
- An undefined #name or :value in the key condition is reported before
  the size check.

Ordering, measured with a 2049-byte value: filter syntax, unused names
and values, index name, ConsistentRead on a GSI, missing table, Limit,
projection syntax and overlap, the Select conflicts and the filter
operand type are all reported first; the ExclusiveStartKey checks after.

The check is crates/core/src/validation/key_size.rs, called from
handle_query after the expression validations and before the start key
checks. The limits come from the configuration and the sentences name
them.

Tests: unit tests in validation/key_size/tests.rs and the engine;
tests/python/test_query_key_size.py, test_query_key_size_values.py and
test_query_key_size_order.py (64 rows) pass against the service. On
ExtendDB alone, five rows with two or more RANGE clauses on one index
skip until the multi-attribute range change in ExtendDB#429 merges (the handler
refuses the shape earlier today); they pass on the merged tree. The
undefined-name row stays unit level because the undefined-name refusal
for a sort key clause arrives with ExtendDB#479.

Pre-existing, measured, not changed here: a BETWEEN with the lower bound
above the upper bound is refused by the service with a bound-order
sentence; two conditions on one key are refused with "KeyConditionExpressions
must only contain one condition per key"; a Number with 39 or more digits
is refused with "Attempting to store more than 38 significant digits in a
Number"; a FilterExpression on a key attribute is refused with "Filter
Expression can only contain non-primary key attributes". ExtendDB accepts
all four.

* fix(cassandra): pass the bare index name in IndexNotFound so the Query sentence matches the other backends

* test(query): skip the idx accept rows on a backend that cannot read a multi-RANGE index

The Cassandra backend answers InternalServerError to any Query on an index
with several RANGE attributes: its ORDER BY lists sk_* then base_pk and skips
the sk2_* to skN_* clustering columns, which Cassandra refuses with
"Order by currently only supports the ordering of columns following their
declared order in the PRIMARY KEY". require_multi_range now also skips on
InternalServerError, so test_one_600_byte_range_value_is_accepted carries the
probe like the other idx rows.

* test(query): skip later-RANGE accept rows on first-RANGE-only backends

Since ExtendDB#429, the MongoDB and Cassandra backends refuse a key condition on
a later RANGE attribute of a multi-attribute index with a
ValidationException. Two rows of TestGsiQueryKeySize expect such a Query
to be served, and they failed on MongoDB. They now skip when a probe
gets that refusal, as the multi-range tests on main do. The refusal rows
still run on those backends, because the size check answers first.

* fix(core): read the key byte size through the key_size module in restorable_item

Main added validation/restorable_item.rs, which sizes a backup item's key with key_value_byte_size from the validation module. This branch moved that function into validation/key_size.rs. The call now names the new module, as check_key_size does.

* fix(core): check the number rules before sizing a Query key value

Query sized an N value in a key condition by its digit string, so an invalid
number got the key size sentence. The service checks the number first.
Measured 2026-11-20 in us-east-1 on a GSI with HASH n (N), each shape twice:

- 2049 or 39 digits answer "Attempting to store more than 38 significant
  digits in a Number", in KeyConditionExpression and in KeyConditions.
- 1 followed by 2100 zeros answers "Number overflow. Attempting to store a
  number with magnitude larger than supported range".
- The service serves 2100 zeros followed by 1.

validate_query_key_sizes now passes each N value it reads to
validate_and_normalize_number and sizes the normalized digits. Query served
a 39-digit value before and refuses it now, as the service does.

The doc comment of validate_query_key_sizes no longer lists two shapes as
not measured. The wire tests assert both, a HASH sum of exactly 2048 bytes
and the aggregated hash sentence over an oversized RANGE value. Both pass
against the service.

The comment also names a request that ExtendDB serves and the service
refuses. The request has an undefined #name in a second clause, on a key
schema with one HASH attribute and at most one RANGE attribute.

* fix(query): check Select against the GSI projection after the key size

With no ExclusiveStartKey, Query checked Select=ALL_ATTRIBUTES against the
index projection before the other request checks. The service makes that
check after the key size check. With a start key, it also comes after the
start key checks. Measured 2026-11-20 in us-east-1 on a KEYS_ONLY GSI with
Select=ALL_ATTRIBUTES, each shape twice:

- A 2049-byte key value answers the size sentence, with and without an
  ExclusiveStartKey.
- A 1-byte value answers the Select sentence.
- Without a start key, Limit 0 and a parameter mix each answer their own
  refusal ahead of the Select sentence. So do an empty or invalid
  KeyConditionExpression, a missed key schema element, a wrong-typed key
  value and a filter or projection fault. ProjectionExpression with
  ALL_ATTRIBUTES and an unused name or value also come first. ExtendDB
  answered the Select sentence for all of them.

The check now runs once, after the size and start key checks. The comment
above the size check no longer says that the type check is still to come.
The type check runs above it, in resolve_key_schema_with. The engine test
comments cite the measurement dates and region, not local files.

* test(query): add the number and Select rows and keep refusal rows visible

- test_query_key_size_values.py: rows on a GSI with HASH n (N) for 2049
  digits, 39 digits, 1 followed by 2100 zeros and 2100 zeros followed by 1.
  Each row runs in KeyConditionExpression and in KeyConditions.
- test_query_key_size_order.py: rows on a KEYS_ONLY GSI for
  Select=ALL_ATTRIBUTES with a 2049-byte and a 1-byte value, with and
  without an ExclusiveStartKey. The Limit 0 row uses the raw_client fixture
  from conftest.py in place of its own copy.
- This commit removes require_multi_range. Neither of its skips fires on any
  backend at this head. On a refusal row, a 500 or a classifier change
  turned the row into a skip.
- The BETWEEN row is two tests. The refusal half reports its result on
  MongoDB and Cassandra, where the accept half skips.
- The docstrings cite the measurement dates and region, not local files.

* docs(core): cite ExtendDB#1214 for the undefined name that Query serves

The doc comment of validate_query_key_sizes names one request that ExtendDB
serves and the service refuses: an undefined #name in a second key
condition clause. ExtendDB#1214 tracks that request.

* docs(query): split the long sentences in four new comments

Four new comments now use shorter sentences. They are the number rules in
sized_clause and its unit test, the undefined #name in
validate_query_key_sizes and the Select check in handle_query. They state
the same measurements.

* fix(core): size a Query key number the validator does not read by its text

001fe29 sized each N value of a key condition after
validate_and_normalize_number, so a number written in other Unicode
decimal digits got a 400. DynamoDB reads U+FF11 and U+0967 U+0968 as
digits. It serves `n = :v` and the KeyConditions form with those values
(200, Count 0, measured 2026-11-20 in us-east-1, twice each), and so did
the previous head.

The size check now calls normalize_number and refuses only the digit
count and magnitude faults. A value the validator does not read as a
number is sized by its text again, as before 001fe29. The unit table
and TestNumberKeyValues gain the two values, in both syntaxes.

The Select test uses the shared refused helper. Its 1-byte row without a
start key goes, because test_query_start_key_partition.py sends the same
request. Two comments are shorter.

* fix(core): do not size a Query key N value that is not a number

31159a2 sized an N value that normalize_number does not read as a
number by its text. So 2049 `x` or 2049 U+FF11 in a key condition got
the hash size sentence. DynamoDB refuses such a value with a number
sentence before it looks up the table (measured 2026-11-24 in us-east-1,
twice each). 2049 `x` gets `The parameter cannot be converted to a
numeric value: ` and the value, in KeyConditionExpression and in
KeyConditions. 39 U+FF11 get `Attempting to store more than 38
significant digits in a Number`.

Such a value now adds nothing to the size, and ExtendDB serves the Query
as main does. The number check of key condition values is ExtendDB#544's. The
unit table gains a 2049 `x` row and a 2049 U+FF11 row.

* test(query): fold the key size rows into two tables

query_key_size_tests.rs had 19 tests that sent rows of the core tests
through the expression parser. The wire files send the same rows end to
end. The file keeps the two tests that add a path: the clause order in
the expression, and the KeyConditions desugaring. The comments of two
deleted index tests named a gate that b116a46 took out.

In the core tests, one table holds the equality rows on the base table,
on `idx` and on `two-hash`. A second table holds the six
undefined-reference rows. Each row keeps its measurement comment. Two
rows have measurements from 2026-11-20 on `two-hash`, and their comments
no longer say "Not measured". They are a HASH sum of exactly 2048 bytes, and
the aggregated hash sentence with a 1025-byte RANGE value. Two tests
checked the end of a sentence that a table row asserts in full, and they
are gone.

* fix(core): count each key attribute once in the Query key size

The size check added every clause into the HASH or RANGE total,
including a second clause on one key attribute. `pk = :a AND pk = :b`
with 1025 bytes in each value got the aggregated hash sentence.
`pk = :p AND sk = :a AND sk = :b` with 600 bytes in each got the range
sentence. Main serves both. DynamoDB refuses both with `Invalid
KeyConditionExpression: KeyConditionExpressions must only contain one
condition per key`. The `pk` shape is from a measurement on 2026-11-24
in us-east-1 (sent twice), and ExtendDB#489 records the `sk` shape.

Each key attribute now contributes its largest value once, and the
single hash check reads that value. The one-condition-per-key refusal is
ExtendDB#484's. Two rows join the equality table.

* style(core): clear the clippy warnings in the Query key size code

The pedantic clippy run flagged `ExtendDB` without backticks in the doc
comment of validate_query_key_sizes (doc_markdown). The two tables of
762d4a8 tripped type_complexity, a default lint that CI's
`-D warnings` refuses. Each table now names its row type. After this
commit, clippy with `-W clippy::pedantic` and `--all-targets` on
extenddb-core and extenddb-engine reports no warning on a line this PR
adds.

* test(query): rename the isrefused tests and reuse assert_validation

Nine test names in test_query_key_size.py read `isrefused`, and they now
read `is_refused`. `refused` in query_key_size_support.py repeated the
three asserts of helpers.assert_validation. It now calls that helper and
takes its `code` argument. In test_query_key_size_order.py, `_first` and
five tests made the same three asserts after `_error`, and they now call
`refused`. `_error` stays for the two syntax error tests, which check
the start of the message.

* docs(query): count one sort key value per attribute in the limits table

482bf8a counts the largest value of each key attribute once. The sort
key row of docs/dynamodb-limits.md said that the Query check adds up
every sort key clause. It now says that the check adds up the sort key
values of the key condition, one per attribute.

* fix(core): refuse a Query key N value that is not a number

a3f733d sized an N value that normalize_number does not read as a
number as 0 bytes, so the Query went on to storage. On SQLite at
1e5f4bc, `abc`, 2049 `x`, `" 1"` and the empty value answered HTTP
200 with Count 0. That was the answer on a GSI keyed on an N attribute,
in KeyConditions and on the base table's N partition key. On the base
table's N sort key they answered InternalServerError, and the server
log shows `invalid numeric sort key: invalid digit found in string`.

DynamoDB refuses each of these values with `The parameter cannot be
converted to a numeric value: ` followed by the value as sent. The
empty value gets the colon too (measured 2026-11-24 in us-east-1, twice
each, in KeyConditionExpression and in KeyConditions). sized_clause now
refuses such a value with that text when the value holds ASCII
characters only. NumberFault::Empty has no colon, so the refusal uses
the text of NumberFault::Malformed.

A value with a character outside ASCII still adds nothing to the size.
The service reads Unicode decimal digits as digits, and the number rules
do not (ExtendDB#565). A refusal here would refuse one U+FF11, which the service
reads as the number 1.

The unit table now expects the sentence for 2049 `x`. It gains rows for
`abc`, `" 1"`, the empty value, and `1e-131` as a partition key value
and as a sort key value.

* test(query): pin the number sentences in each Query key position

test_query_key_size_values.py gains a table for N values that the
service refuses as numbers: `abc`, 2049 `x`, `" 1"`, the empty value and
`1e-131`. Each row runs in four forms. Two are on a GSI keyed on an N
attribute, in KeyConditionExpression and in KeyConditions. The other two
use the N partition key and the N sort key of a new `number_table`
fixture. Each row asserts status, code and message by equality. The
service gives these answers before the table lookup (measured
2026-11-24 in us-east-1, twice each, on a table that does not exist).

Two more rows, 39 and 683 U+FF11, assert the service's 38-digit
sentence. They are expected failures on ExtendDB, because the number
rules do not read U+FF11 as a digit (ExtendDB#565). The mark is not strict, so
a check that reads these digits makes the rows of its form pass.

The existing number test now builds its Query with the same helper.

On a server built from 1e5f4bc, the 16 rows for `abc`, 2049 `x`,
`" 1"` and the empty value fail. 12 of them get HTTP 200, and the 4 on
the sort key get InternalServerError. The 4 underflow rows pass there
too. With 1fe3f0c, the three wire files pass on SQLite: 99 passed and
8 expected failures.

* test(query): leave the U+FF11 rows to ExtendDB#565

The files in tests/python hold no expected failures (tests/python/README.md,
Design Principles). The rows for 39 and 683 U+FF11 assert the service's
38-digit sentence. ExtendDB gives that sentence only once its number rules
read Unicode decimal digits, which is ExtendDB#565, so the rows and their mark go.
The measurements of 2026-11-24 are on ExtendDB#565.

* test(query): pin the Select order on a KEYS_ONLY GSI without a start key

On a KEYS_ONLY GSI with Select ALL_ATTRIBUTES and no ExclusiveStartKey,
DynamoDB answers each of these refusals before the Select sentence:

- Limit 0
- a key condition on the base table's partition key
- an N value on the S key
- an unused expression value
- an empty KeyConditionExpression
- FilterExpression `#`

A reviewer measured each shape twice on 2026-11-24.

These shapes are now rows of
test_select_all_attributes_on_a_keys_only_gsi_is_reported_after. Each
row asserts status, code and message by equality, except the `#` row.
ExtendDB words that syntax error in its own way (ExtendDB#1419), so the row
checks the `Invalid FilterExpression: ` label. The table now sends its
requests through raw_client, because the SDK refuses Limit 0.
FILTER_LABEL, LIMIT_MESSAGE and MISSED_G_MESSAGE hold the three texts
that a new row shares with an existing test.

With the Select check moved above the Limit check, the six new rows
fail. The two 2049-byte rows of the table and two start key rows in
test_query_start_key_partition.py fail too. On SQLite, the three wire
files and test_query_start_key_partition.py give 136 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants