Skip to content

fix(query): refuse a key condition with no HASH equality the way the service does - #479

Open
LeeroyHannigan wants to merge 22 commits into
fix/key-condition-one-per-keyfrom
fix/427-lone-non-equality
Open

LeeroyHannigan wants to merge 22 commits into
fix/key-condition-one-per-keyfrom
fix/427-lone-non-equality

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

The last review was of af51f01. This branch now contains #484's branch (fix/key-condition-one-per-key), and #484 merges first.

What

A Query whose KeyConditionExpression has no equality clause on the HASH attribute now gets the service's message. The key schema of the table or index queried selects the message:

Shape Answer
One HASH attribute, and a clause names it (pk > :x, pk BETWEEN :x AND :y, begins_with(pk, :x), pk > :x AND sk = :y, sk = :x AND pk > :y, zz = :x AND pk > :y, the GSI forms) Query key condition not supported
One HASH attribute, and no clause names it (sk > :x, zz > :x, sk > :x AND zz > :y, the GSI forms) Query condition missed key schema element: <HASH>
Two HASH attributes, or one HASH attribute and several RANGE attributes, for any operator and attribute HASH key attributes h1, h2 must have equality conditions specified in the query

The changes:

  • crates/core/src/expression/key_condition.rs: the parser records one or two clauses with no equality instead of refusing them, so the engine can choose the message.
  • crates/core/src/expression/key_condition/no_hash_equality.rs: KeyCondition::lacks_hash_equality, refuse_without_hash_equality, which chooses the message by the key schema, and operands_naming, which the engine's type check reads. Its attr_of keeps its own #name lookup: resolve_name is an ExpressionMaps method, the KeyCondition methods get only the names map, and resolve_path_attr clones the name.
  • crates/core/src/error/messages.rs: QUERY_KEY_CONDITION_NOT_SUPPORTED, missed_key_schema_element and hash_attributes_without_equality.
  • crates/engine/src/query.rs: handle_query finds a key condition with no HASH equality before the Select index check. Such a key condition skips that check and the classification of fix(query): classify and order key conditions on a multi-attribute GSI the way the service does #429. After validate_select_projection, handle_query passes it to the engine's refuse_without_hash_equality. On a schema with one HASH attribute, that function first runs the type check on the clause that names the HASH attribute. A begins_with value that is not a string or a binary value never reaches it. fix(core): refuse a second condition on a key in KeyConditionExpression #484's parse refuses that value with the service's operand type message. The parse and fix(query): check Query values against the key schema and the number rules #544's refuse_begins_with_on_number call the same helper. Every other key condition goes through the classification as on main.
  • crates/server/src/request_attributes.rs: a key condition with no equality adds no name to dynamodb:Attributes. Main's parser refused such a key condition, so main added no name either.

Ahead of the key schema's message, the service reports:

  • three faults that fix(core): refuse a second condition on a key in KeyConditionExpression #484's parse refuses when it reads the key condition:
    • an undefined #name or :value
    • two conditions on one attribute
    • a begins_with value that is not a string or a binary value, such as begins_with(pk, :n) on a number HASH attribute (row 6)
  • an unused value, an invalid FilterExpression or ProjectionExpression, and the Select conflicts
  • on a schema with one HASH attribute, a wrong-typed value in the clause on the HASH attribute
  • the refusal of a Query on a vector index (V1, V2)

After the key schema's message, the service reports an ExclusiveStartKey fault and an oversized key value. The key schema's message also comes ahead of the Select index check: Query key condition not supported (W5), Query condition missed key schema element: g (A3) and HASH key attributes h1, h2 must have equality conditions specified in the query (D1, D3). The engine skips that check for every key condition with no HASH equality.

Why

Closes #427.

ExtendDB refused these key conditions with parser messages of its own: Invalid KeyConditionExpression: partition key condition must use equality (=) for one clause, and Invalid KeyConditionExpression: one condition must be an equality on the partition key for two. An equality on another attribute with a non-equality on the HASH attribute (sk = :x AND pk > :y) got Query condition missed key schema element: pk. The service chooses the message from the key schema, as the table in What shows.

The service gave the rows of the wire file on 2026-10-21, 2026-10-23 and 2026-11-01, two samples each with the same answer. The table below gives the order on a schema with one HASH attribute, measured on 1 November. One table had HASH pk and RANGE sk (strings). The other had HASH pk (N) and RANGE sk (S). The index had HASH gsi1_pk and RANGE SK:

Request Service answer
pk > :x AND pk < :n, pk > :n AND pk < :m Invalid KeyConditionExpression: KeyConditionExpressions must only contain one condition per key
pk > :n AND sk > :y, sk = :x AND pk > :n, pk BETWEEN :n AND :m One or more parameter values were invalid: Condition parameter type does not match schema type
pk > :x AND sk > :n Query key condition not supported
sk > :n, zz > :n Query condition missed key schema element: pk
On the index, PK > :n and SK > :n Query condition missed key schema element: gsi1_pk
On the table with HASH pk (N), begins_with(pk, :n) AND sk > :x and sk > :x AND begins_with(pk, :n) Invalid KeyConditionExpression: Incorrect operand type for operator or function; operator or function: begins_with, operand type: N

:x and :y are strings, :n and :m numbers. With an unused :y, pk > :n answered the unused value message, and with FilterExpression nope( it answered the filter syntax error (rows 5a and 5b, 23 and 31 October).

On 24 November, two sends each, on a table with HASH pk, RANGE sk and the KEYS_ONLY index g-keys on g: g > :a on g-keys with Select ALL_ATTRIBUTES answered Query key condition not supported (row W5). #1208 records more rows of that day, each with an equality in the key condition. On the service, these faults also answer ahead of the Select index check:

  • a missed key schema element
  • a wrong-typed key value
  • an unused value
  • a ProjectionExpression conflict

ExtendDB answers them after it, on main, on #484 and on this branch.

On 25 November, two sends each, every answer HTTP 400 ValidationException. bk10-484-1 is the table above. bk10-507-sn has the KEYS_ONLY index mkidx with HASH h1 and h2 and RANGE r1. bk10-507r-vec has HASH pk, RANGE sk and the vector index vidx. :a and :b are strings:

Row Table Request Service answer
A3 bk10-484-1 sk > :a on g-keys, Select ALL_ATTRIBUTES Query condition missed key schema element: g
A4 bk10-484-1 zz > :a on g-keys, Select ALL_ATTRIBUTES Query condition missed key schema element: g
D0 bk10-507-sn h1 = :a AND h2 = :b on mkidx, Select ALL_ATTRIBUTES One or more parameter values were invalid: Select type ALL_ATTRIBUTES is not supported for global secondary index mkidx because its projection type is not ALL
D1 bk10-507-sn h1 > :a on mkidx, Select ALL_ATTRIBUTES HASH key attributes h1, h2 must have equality conditions specified in the query
D3 bk10-507-sn r1 > :a on mkidx, Select ALL_ATTRIBUTES HASH key attributes h1, h2 must have equality conditions specified in the query
V0 bk10-507r-vec pk = :a on vidx Query operation not supported on this index type.
V1 bk10-507r-vec pk > :a on vidx Query operation not supported on this index type.
V2 bk10-507r-vec zz > :a on vidx Query operation not supported on this index type.
V1h VecProbePR_1786053330 pk > :a on vidx Query operation not supported on this index type.
V2h VecProbePR_1786053330 zz > :a on vidx Query operation not supported on this index type.

A3 and D1 without Select gave the same answers. VecProbePR_1786053330 has HASH pk alone and the vector index vidx, the key schema of the vector test fixture. The wire files test A3, V1 and V2. No wire fixture has a KEYS_ONLY index with two HASH attributes, so D1 and D3 have no test.

Stack on #484

#484 refuses a second condition on one key attribute and an undefined reference when it parses the key condition, for every key schema. This branch had its own copies of both checks. With #484 merged in, the copies could not answer a request, so aeec7b0 removes them. The wire rows for two conditions on one attribute stay, because #484's wire file has no such row without an equality.

#484 merges first. Its branch and this one conflict in crates/engine/src/query.rs, and the merge commits 125e1de and b60edf4 resolve that conflict. b60edf4 merges 468b256, the head of #484's branch, so this branch has one merge base with #484's branch.

Against #484's branch at 468b256, this branch changes 13 files. It adds 407 production lines, 159 of them comments, and removes 40. It adds 1054 test lines and removes 38. At a13cc4b, against 8b43195, the counts were 421 (162 comments) and 36, and 1080 and 38.

At fbce34a this branch merges with main at 5252eda without a conflict, and so does #484's branch at 468b256. At 16:40 UTC on 25 Nov, 105 other open PRs changed a file of this PR or of #484. 42 of them conflict with main themselves and were not checked. The other 63 give the same result with this branch as with #484's branch. 48 merge without a conflict, and 15 conflict in files that #484 changes:

What stays different from DynamoDB

Testing done

At fbce34a, which contains #484's branch at 468b256: the merge of main at 5252eda (bf57850) and the Select change on top of it.

  • cargo +1.97.0 fmt --all -- --check: pass.
  • cargo +1.97.0 clippy --locked -p extenddb-core -p extenddb-engine --all-targets -- -D warnings, and the same for extenddb-engine with --features extenddb-engine/backup-test-hooks: pass.
  • cargo +1.91.1 check --locked -p extenddb-core -p extenddb-engine --all-targets: pass.
  • cargo +1.97.0 test --locked --no-fail-fast -p extenddb-core -p extenddb-engine --lib: core 1189 passed and 1 ignored, engine 942 passed.
  • cargo +1.97.0 test --locked -p extenddb-wasm-adapter --test parity: every_case_gives_its_expected_answer passed.
  • On a SQLite server on 127.0.0.1:
    • tests/python/test_query_lone_non_equality.py: 83 passed.
    • tests/test_query_key_condition_one_per_key.py, tests/test_vector_index_query_scan.py and tests/test_fgac_leading_keys.py: 146 passed, W5, A3, V1 and V2 included.
    • fix(query): check Query values against the key schema and the number rules #544's tests/test_query_key_value_types.py, tests/test_query_leading_keys_values.py and tests/test_query_value_shapes.py: 329 passed.
  • python3 -m pytest --collect-only -q of tests/ and of tests/python: 7257 and 755 tests, no error.
  • cargo +1.97.0 clippy --locked -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -W clippy::pedantic: no warning on the 836 lines that this PR adds against 468b256, in 10 Rust files.

At ee8a156, which contains #484's branch at 8b43195 (98d09b3 with main at a417b2f merged in). The head, a13cc4b, changes only a test comment after it.

  • cargo +1.97.0 fmt --all -- --check: pass.
  • cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -D warnings, and the same for extenddb-engine with --features extenddb-engine/backup-test-hooks: pass. With -W clippy::pedantic, clippy gives no warning on a line that this PR adds.
  • cargo +1.91.1 check -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets: pass.
  • cargo +1.97.0 test --locked -p extenddb-core --lib: 1178 passed, 1 ignored.
  • cargo +1.97.0 test --locked -p extenddb-engine --lib: 899 passed.
  • cargo +1.97.0 test --locked -p extenddb-server --lib: 515 passed. Five backup_store tests failed because /tmp, the parent of their temporary directories, belongs to another user on the test host, as their message says. This PR does not change backup_store.rs.
  • On SQLite and PostgreSQL 16 servers on 127.0.0.1, with the same counts on each:
    • tests/python/test_query_lone_non_equality.py: 83 passed.
    • tests/test_query_key_condition_one_per_key.py: 100 passed, W5 and A3 included.
  • On the SQLite server:
    • tests/test_vector_index_query_scan.py: 14 passed, V1 and V2 included.
    • tests/test_gsi_multi_range_query.py, tests/test_fgac_leading_keys.py, tests/test_query_scan.py, tests/test_multipart_gsi.py, tests/test_read_paging.py, tests/test_fgac_attributes.py and the three tests/test_dynamodb_attributes_*.py files: 338 passed, 1 skipped. tests/python/test_query_scan.py: 27 passed.
    • tests/test_conditional_operator.py and tests/test_select_all_projected_attributes.py, which also send legacy KeyConditions: 46 passed. tests/python/test_query_start_key_range.py: 103 passed.
  • Controls on SQLite builds with the production files of the base (fix(core): refuse a second condition on a key in KeyConditionExpression #484 and main):
    • test_query_lone_non_equality.py fails 61 of its 83 rows. Of the 22 rows that pass, fix(core): refuse a second condition on a key in KeyConditionExpression #484's checks answer 15:
      • 6 undefined reference rows
      • 4 rows with two conditions on one attribute
      • 3 begins_with rows on a number key
      • 2 filter syntax rows
    • The other 7 rows that pass on the base are 2 legacy KeyConditions rows and 5 rows with an equality clause.
    • test_query_key_condition_one_per_key.py fails W5 and A3 only, with the Select index message.
    • test_vector_index_query_scan.py fails V1 and V2 only, with the parser's message.
  • With the production files of this branch and the Select index check run for every key condition again, W5 and A3 fail with the Select index message.
  • Unit controls: the test for a key schema with no HASH attribute fails with the old unwrap_or_default() line. The dynamodb:Attributes test fails with main's line in Names::key_condition. A mutant that drops the operands of the second clause fails two of the new tables.
  • python3 -m pytest --collect-only -q of tests/ and of tests/python: 6846 and 755 tests, no error.

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

Breaking changes

ExtendDB refuses each of these requests before and after this change, with HTTP 400 and ValidationException. Only the message changes:

  • One clause with no equality, such as pk > :x or sk > :x: Invalid KeyConditionExpression: partition key condition must use equality (=) becomes the key schema's message from the table in What.
  • Two clauses with no equality, such as pk > :x AND sk > :y: Invalid KeyConditionExpression: one condition must be an equality on the partition key becomes the key schema's message.
  • An equality on another attribute with a non-equality on the HASH attribute, such as sk = :x AND pk > :y: Query condition missed key schema element: pk becomes Query key condition not supported. On g-keys, sk = :a AND g > :b without Select changes from Query condition missed key schema element: g to Query key condition not supported (A6).
  • A wrong-typed value in the clause on the HASH attribute, such as pk > :n on a string key: the parser's message becomes One or more parameter values were invalid: Condition parameter type does not match schema type.
  • A key condition with no HASH equality and Select ALL_ATTRIBUTES on a global secondary index whose projection is not ALL: the Select index message becomes the key schema's message.
  • A request with no HASH equality that also has one of these faults now gets the fault's message first, in the order What gives. Before, it got the parser's message or the Select index message.
    • an unused value
    • a ProjectionExpression or Select conflict
    • a wrong-typed value in the clause on the HASH attribute
  • A key condition with no equality clause on a vector index, such as pk > :x or zz > :x: the parser's message, Invalid KeyConditionExpression: partition key condition must use equality (=) for one clause, becomes Query operation not supported on this index type.

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.

…service does

Closes #427.

A Query whose KeyConditionExpression has no equality clause on the HASH
attribute was refused with a parser sentence of ExtendDB's own. The service
chooses the sentence from the key schema. Measured on 2026-10-23, every row
repeated with identical answers:

- Single HASH attribute, any clause names it (so the clause on it is a
  non-equality): "Query key condition not supported". Rows: pk > :x,
  pk BETWEEN :x AND :y, begins_with(pk, :x), pk > :x AND sk = :y,
  sk = :x AND pk > :y, zz = :x AND pk > :y, and the GSI forms.
- Single HASH attribute, no clause names it: "Query condition missed key
  schema element: <HASH>". Rows: sk > :x, zz > :x, sk > :x AND zz > :y,
  zz = :x AND yy = :y, and the GSI forms naming the index HASH attribute.
- Several key attributes (two HASH attributes, or one HASH with several
  RANGE attributes): "HASH key attributes h1, h2 must have equality
  conditions specified in the query", naming every HASH attribute, for
  every operator and for an N value on the HASH attribute.
- Two conditions on one attribute: "Invalid KeyConditionExpression:
  KeyConditionExpressions must only contain one condition per key".
- An undefined #name or :value in the key condition is refused first, with
  the "Invalid KeyConditionExpression: " prefix. The rows include pk = :x
  with no values.
- Single HASH attribute, a value of the wrong type: pk > :n with an N value
  on an S key answers "One or more parameter values were invalid: Condition
  parameter type does not match schema type", and begins_with(pk, :n) on an
  N key answers "Invalid KeyConditionExpression: Incorrect operand type for
  operator or function; operator or function: begins_with, operand type: N".
- Legacy KeyConditions is desugared with every reference defined and an
  equality clause, or refused there; no change.

Measured on 2026-11-01, two samples each, on a single HASH attribute
schema: two conditions on one attribute answer the one condition per key
sentence whatever their value types (pk > :x AND pk < :n). A wrong-typed
value is reported only in the clause on the HASH attribute:
pk > :n AND sk > :y, sk = :x AND pk > :n and pk BETWEEN :n AND :m answer
the type sentence, and pk > :x AND sk > :n answers "Query key condition not
supported". With no clause on the HASH attribute no value is checked:
sk > :n answers "Query condition missed key schema element: pk", and on an
index with HASH gsi1_pk and RANGE SK, PK > :n (PK the table's HASH
attribute) and SK > :n answer "Query condition missed key schema element:
gsi1_pk". On a table with HASH pk (N) and RANGE sk (S),
begins_with(pk, :n) AND sk > :x and sk > :x AND begins_with(pk, :n) answer
the begins_with operand type sentence, as begins_with(pk, :n) alone does.

Ordering, measured: unused values, filter syntax, projection syntax, the
Select conflicts and undefined key references are reported before this
refusal; an ExclusiveStartKey fault and an oversized key value after it.
An unused value and an invalid FilterExpression are also reported before
the type sentence for pk > :n (measured again on 2026-10-31).

The refusal is in crates/core/src/expression/key_condition/no_hash_equality.rs,
with KeyCondition::lacks_hash_equality, refuse_two_conditions_on_one_attribute,
operands_naming and refuse_without_hash_equality, and
KeyCondition::validate_references is in key_condition/references.rs. The
parser now records one or two clauses with no equality instead of refusing
them, so the engine can choose the sentence. When only the second of two
such clauses is a begins_with, the parser keeps that clause whole as the
sort key condition, which the begins_with check reads.

handle_query skips the classification from #429 for a key condition with no
equality clause, and on a single HASH attribute schema for an equality on
another attribute paired with a non-equality on the HASH attribute
(sk = :x AND pk > :y). Every other key condition goes through that
classification as before. After validate_select_projection, handle_query
calls the engine's refuse_without_hash_equality. It checks the references
of every key condition and refuses the ones the classification skipped. It
refuses two conditions on one attribute first. Then, on a single HASH
attribute schema and only when a clause names the HASH attribute, it runs
the type check and the begins_with check from #429 on that clause, against
that attribute's definition. Then it refuses with the key schema's wording.
On a multi-attribute key schema no value is checked, because the service
answers h > :n with the HASH sentence.

LeadingKeys keeps the binding from #511.
query_kce_without_a_partition_key_equality_binds_only_a_partition_operand
asserts the values it binds for the shapes the parser now records, and
the_engine_still_refuses_every_shape_whose_operand_is_now_bound asserts that
the core refusal answers "Query key condition not supported" for each shape
it binds.

Tests: unit tests in no_hash_equality/tests.rs, references.rs and
crates/engine/src/query/no_hash_equality_tests.rs. The wire file
tests/python/test_query_lone_non_equality.py has 83 rows. 67 of them passed
against the service as a file; the other 16 repeat requests measured on
2026-10-23 (427-8c, row 6, and rows 5a and 5b with the N value) and on
2026-11-01 (the ten rows of TestValueTypes, two of them on the file's
single-idx in place of the measured index, and the two begins_with rows on
a table with HASH pk (N) and RANGE sk). All 83 pass on SQLite and
PostgreSQL 16 builds of this commit, and a SQLite build of main at f49c5f8
fails 76 of them.

Related behaviour, measured: "<>", NOT, OR, IN and contains in
a key condition get "Invalid operator used in KeyConditionExpression" on the
service; pk = :x AND z > :x gets "missed key schema element: sk" on the
service and 200 here; the Select ALL_PROJECTED_ATTRIBUTES text lacks the
"1 validation error detected: " prefix here. A key condition with an
equality clause and a HASH attribute without one (sk = :x on a table,
g1 = :x on an index with HASH g1, g2) is refused by the key schema checks
handle_query runs before it parses the FilterExpression. The service
reports an unused value or an invalid FilterExpression first (measured
2026-10-31).
@LeeroyHannigan
LeeroyHannigan force-pushed the fix/427-lone-non-equality branch from 9fc4ba3 to af51f01 Compare November 1, 2026 11:27
@navareamol navareamol added the v1 Needed for the 1.0 release label Nov 3, 2026
@navareamol navareamol added this to the 1.0 milestone Nov 3, 2026
@pdf-amzn pdf-amzn self-assigned this Nov 10, 2026
@pdf-amzn

Copy link
Copy Markdown
Collaborator

Either land this after 484 (and put this one on hold in the meantime), or combine this and 484 into a single PR.

This review is AI generated. I reviewed this together with #484, since the two overlap. I tested main (cbc3680) merged with both PRs on PostgreSQL: the full pytest suite shows no regressions against main, and tests/python/test_query_lone_non_equality.py passes (83/83), as does test_fgac_leading_keys.py (31/31). The new wire files also pass against DynamoDB (30/30 and 83/83).

Size. +1948/-39 is mostly tests. Net against the merge base: 282 lines of production code, 216 of comments, 1382 of tests (597 Python, 538 core, 215 engine, 32 server). The engine tests and the Python file each cover things the others can't: the engine tests cover the value-type and begins_with-on-N order, and the Python file covers the order against unused values, filter, projection, Select, ExclusiveStartKey and key size. The overlap is the wording rows (Query key condition not supported / missed key schema element / HASH key attributes ... must have equality conditions), which no_hash_equality/tests.rs asserts row by row and the Python file asserts against the service. Keeping one representative per sentence plus the lacks_hash_equality, operands_naming and two-condition cases in core would take that file from 463 to about 200 lines. The measured-wording table also appears three times (the no_hash_equality.rs module doc, the Python docstring and this PR's description); a pointer from the module doc to the Python file would save about 45 comment lines.

Should-fix: name resolution is reimplemented twice. attr_of (crates/core/src/expression/key_condition/no_hash_equality.rs:316) and resolve_clause_attr (:330) both resolve a path's first element through names, one returning Option and one Result, and resolve_clause_attr and validate_references (references.rs:30-35) each hand-write the undefined-name sentence. resolver.rs already has resolve_name and resolve_name_ref (resolver.rs:54, :121) for this. Add a prefixing resolve_name_for next to resolve_value_for (resolver.rs:76), use it in references.rs and resolve_clause_attr, and build attr_of on the same helper.

Nit-or-follow-up: attr_of clones the name, and its callers only compare it (.as_deref() == Some(..)). Returning Option<&str> avoids the clones.

Nit-or-follow-up: hash_attrs.first().copied().unwrap_or_default() (no_hash_equality.rs:197) silently yields "" in a state lacks_hash_equality has already ruled out. An expect with the invariant would say so.

Overlap with #484. This PR's refuse_two_conditions_on_one_attribute (no_hash_equality.rs:219) and its ONE_CONDITION_PER_KEY const (:60) refuse the message #484 refuses at parse time. #484's check covers every schema and operator and runs earlier, so it should own the refusal. If #484 merges first, drop refuse_two_conditions_on_one_attribute, its calls in the core and engine refuse_without_hash_equality, the const, and the tests that pin it (two_conditions_on_one_key_are_refused_as_such, two_conditions_on_one_attribute_are_refused_only_without_an_equality, the engine's two_conditions_on_one_attribute_are_refused_before_a_wrong_typed_value, and the one-per-key Python rows, which #484's file covers). If this merges first, #484 should remove them. Keep operands_naming; the HASH-clause type check uses it.

I found no path that executes a key condition with no HASH equality now that the parser records those clauses: handle_query skips #429's classification exactly when lacks_hash_equality holds and always calls refuse_without_hash_equality before the read, legacy KeyConditions always carries an equality or is refused, and the LeadingKeys extraction reads no items.

…lity

The branch that refuses a second condition on one key attribute merges
first, and this branch now builds on it. One file conflicted,
crates/engine/src/query.rs: both sides add functions after
refuse_begins_with_on_number, and the merge keeps both.
crates/core/src/expression/key_condition.rs and
crates/server/src/leading_keys/tests.rs merged without a conflict.
Main is 13 commits ahead of the branch after the previous merge, and
this merge is clean. Three files changed on both sides, and none of them
is a file this branch changes: crates/core/src/expression/resolver.rs,
crates/engine/src/lib.rs and docs/manuals/07-upgrade-manual.md.
The branch merged before parses the key condition with the request's
maps. That parse refuses an undefined #name or :value and a second
condition on one key attribute before it classifies any clause. Legacy
KeyConditions holds one condition per attribute name, and its desugar
defines every value it names. So the copies of those checks here could
not answer any request.

This removes KeyCondition::validate_references and its file,
refuse_two_conditions_on_one_attribute and its constant, and their
calls in the core and engine refusals. It also removes the three unit
tests that pinned them. The wire rows for two conditions on one
attribute stay, because the other branch's wire file has no such row
without an equality. The doc comments now say where the parse refuses
these faults.
resolve_clause_attr read a clause's attribute like attr_of, and refused
an undefined #name with its own copy of the service's sentence. The
parse with the request's maps now refuses every undefined reference
before it classifies any clause, so that refusal could not answer a
request. resolve_clause_attr goes.

attr_of returns the name borrowed from the path or the names map, and
its callers compare it with == Some(..). refuse_without_hash_equality
asks operands_naming whether a clause names the HASH attribute.
operands_naming reads the same clauses through attr_of, so
clause_attrs and clause_paths go too. clause_path goes because
SortKeyCondition::path returns the same path. The unit test for the
undefined #name refusal goes with that refusal. The wire file still
sends those requests, and the parse answers them.
…l error

refuse_without_hash_equality read the HASH attribute with
hash_attrs.first().copied().unwrap_or_default(). On a key schema with
no HASH attribute it answered a ValidationException with an empty
attribute name. The message was Query condition missed key schema
element: with nothing after it.

It now reads the attribute with single_hash_attr and answers
InternalServerError when the schema has none. A table or index created
through the API always has a HASH attribute. So a request gets this
answer only when the catalog holds a damaged key schema. A unit test
sends such a schema and fails with the old line.
The refusal of a key condition with no HASH equality wrote its own
copies of three sentences that main already writes in other places.
The sentences are Query key condition not supported, Query condition
missed key schema element, and HASH key attributes ... must have
equality conditions specified in the query.

The error module now holds one constant or function for each sentence,
beside the other message templates. refuse_without_hash_equality uses
all three, and handle_query uses the missed key schema element function
in the check that this branch moved. The other copies on main keep
their text.
no_hash_equality/tests.rs asserted the service's sentences row by row
in 17 functions, and the wire file asserts the same rows against a
server. The file now has one table for each sentence. Each table has
one row for each path through the code. The rows cover a clause on the
HASH attribute in either place, an equality on another attribute, a
#name and each kind of key schema. Two more tables cover
lacks_hash_equality and operands_naming, and the test for a key schema
with no HASH attribute stays. The file goes from 407 to 202 lines.

The module doc listed the sentences in a table that the wire file
docstring repeats. It now points to
tests/python/test_query_lone_non_equality.py.
…tributes

Names::key_condition reads the attribute names of a Query's key
condition for the dynamodb:Attributes condition key, through
parse_key_condition. Main's parser refuses a key condition with no
equality clause, so such a request added no name. This branch makes the
parser accept it, so pk > :v started to add pk after the merge of main,
and a server unit test failed.

A key condition with no equality clause now adds no name, and the
dynamodb:Attributes set for it is the one main gives. The engine
refuses such a request once it knows the key schema. The doc comment
says so, and the test gets a row with two clauses and no equality.
Some rows were measured on 2026-10-23 for shapes outside the first
table. The wire file and one engine test comment labelled them with the
issue number: 427-1 to 427-9 and 427-8c. The labels are now M1 to M9
and M8c. The rows and their answers do not change.
The wire file compared the end of this refusal only, because ExtendDB
answered without the 1 validation error detected: prefix. Main now adds
the prefix. The row compares the whole text with the service's answer,
which the row records. _refused_suffix had no other caller and goes.
The branch of #484 merged main at a417b2f, the main commit that
0c4ddaf merged into this branch. The tree does not change. With this
merge, this branch has one merge base with the branch of #484.
…is missing

handle_query computes lacks_hash_equality before the Select index
check. The call to the engine's refuse_without_hash_equality now runs
only when that boolean is true, and the function no longer computes it
again. Legacy KeyConditions never lacks the equality, so the call does
not run for it. Before, the function returned Ok for it.

The unit test a_key_condition_with_a_hash_equality_is_left_to_the_classification
covered that check, and this commit removes it.
The doc comment of the engine's refuse_without_hash_equality had 33
lines of measured rows and dates. The core module doc and the wire
file's docstrings give the same order. The comment now names the two
steps in the service's order and points to
tests/python/test_query_lone_non_equality.py, as the core module doc
does.
…ct index check

Row A3 sends sk > :a to the KEYS_ONLY index g-keys with Select
ALL_ATTRIBUTES. On 25 November the service answered Query condition
missed key schema element: g to both sends. The engine skips the Select
index check for every key condition with no HASH equality. W5 covers
only the Query key condition not supported message. On #484 merged with
main, ExtendDB answers A3 with the Select index message.
…ty check

The new test sends pk > :v and zz > :v to the vector index. The
measured table has HASH pk, RANGE sk and a vector index. On 25 November
the service answered Query operation not supported on this index type
to each of two sends. This branch parses such a key condition and
refuses it after the vector index check. On #484 merged with main,
ExtendDB answers both with the parser's message: Invalid
KeyConditionExpression: partition key condition must use equality (=).
The fixture's table is keyed on pk alone. The rows were first measured on
a table keyed on pk and sk. On 25 Nov a table keyed on pk alone gave the
same vector refusal for pk > :a and zz > :a, two sends each. The comment
now says so.
@LeeroyHannigan
LeeroyHannigan changed the base branch from main to fix/key-condition-one-per-key November 25, 2026 05:52
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

Thanks for going through both. I kept them apart, and this one lands after #484. 125e1de merges #484's branch at 98d09b3 into this branch.

  • aeec7b0 drops validate_references with references.rs, refuse_two_conditions_on_one_attribute with ONE_CONDITION_PER_KEY, and the three unit tests you listed. operands_naming stays for the type check. The four one-per-key wire rows stay, because fix(core): refuse a second condition on a key in KeyConditionExpression #484's wire file has no duplicate without an equality.
  • 5e08d02 removes resolve_clause_attr. fix(core): refuse a second condition on a key in KeyConditionExpression #484's parse refuses an undefined #name before it classifies any clause, so that error arm could not fire. With references.rs gone too, this PR's code has no copy of the undefined-name sentence left, so I did not add resolve_name_for. attr_of returns Option<&str>, and the callers compare with == Some(..). It keeps its own lookup: resolve_name is an ExpressionMaps method, the KeyCondition methods get only the names map, and resolve_path_attr clones the name.
  • 060e499 reads the HASH attribute with single_hash_attr and answers InternalServerError when the schema has none. An expect would panic there, and the error fails the request with a 500.
  • 5144771 makes no_hash_equality/tests.rs one table per sentence, plus lacks_hash_equality and operands_naming. The file is 202 lines instead of 463. The module doc points to tests/python/test_query_lone_non_equality.py instead of repeating its table.

The description lists the other commits of this round.

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.
…efusal

refuse_without_hash_equality copied the HASH attribute's definition into
a one-element Vec and passed it to check_key_value_type. That function
finds the definition by the attribute name that the clause's path
resolves to. operands_naming returns only the clauses whose path
resolves to the HASH attribute, and its attr_of resolves a path as
resolve_path_attr_name does. So a search of the whole list finds the
same definition. The refusal now passes the whole list, and no answer
changes.
The module docstring of test_query_lone_non_equality.py placed a
begins_with on a number HASH attribute after an unused value and an
invalid FilterExpression. No row sends that shape beside either fault,
and #484's parse refuses that begins_with value ahead of the unused
value check of handle_query. Its sentence that no other value is checked
also left out the parse's begins_with refusal, which covers any
attribute.

The docstring now gives each order with the rows that measure it:

- two conditions on one attribute ahead of a wrong-typed value
- that value ahead of the key schema wording, and after an unused value
  and an invalid FilterExpression
- the operand type message for a begins_with number on a number HASH
  attribute, in either clause

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WebAssembly check is red at this head. The job reports mismatched types in crates/core/src/metrics/collector.rs, expected std::time::Instant and found web_time::Instant. This PR does not touch that file and main's later WebAssembly runs are green, so I think a merge with main fixes it. Could you merge main and show the check passing?

The description keeps the full history of earlier heads, and its test counts are tied to commits that are not the head. Could you rewrite the Testing done section for the current head so the counts match what the head runs?

This also stacks on #484, which is still open. I think the branch needs to be rebased after #484 lands so the diff shows only this change.

I will approve once main is merged and the WebAssembly check is green, and the Testing done section states the runs at the head.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query: a lone non-equality condition on the partition key gets the parser's message, not the service's

3 participants