Repository navigation
fix(core): refuse a document path of more than 32 elements - #597
LeeroyHannigan wants to merge 16 commits into
Conversation
9e2754c to
90b673b
Compare
Amazon DynamoDB refuses a document path of more than 32 elements, each attribute name and each list index counting as one, in every expression kind, with `Invalid <Kind>: The document path has too many nesting levels; nesting levels: <n>` (measured 2026-10-26 at 02:26, 02:29, 03:38 and 03:39 UTC, each request twice). It checks each path's `#name` references and then its length, path by path in text order. ExtendDB had no limit: a 33-element path was evaluated, and an ADD on one created the missing maps. The check runs where each path's names are resolved: in the semantic walk's `check_path_refs` for update and condition expressions, in `resolve_paths` for projections, and in the key condition parser before the nested-attribute refusal. The grammar pass still runs first, so a syntax error is reported before the length. Two checks move to the service's position so the new refusal does not answer ahead of them (measured 2026-10-26 at 04:40, 04:41 and 04:43 UTC): - The BETWEEN bounds check (both bounds placeholders of different types, or the lower above the upper) runs in the semantic walk, so it answers at request time on a missing key, after a false AND and on an empty Query, as the service does; it ran only while evaluating an item. - UpdateItem and PutItem check the nesting depth of ExpressionAttributeValues right after the table name, before the expressions, the table lookup and the key, as DeleteItem already did.
Dual-target wire tests from the 2026-10-26 measurements: 32 elements accepted and 33 or more refused in every expression kind and operation; an undefined `#name` before or inside a long path, and a filter or condition fault, reported before the length; a value nested too deep reported before a long path or a syntax error; BETWEEN bounds refused on a missing key, after a false AND and on an empty Query. The at-the-limit condition uses `size()` of the 32-element path. PutItem, UpdateItem and DeleteItem prefix expression errors with `1 validation error detected: `, so those tests accept the message either way.
The service reports an invalid number in the Item or the Key, then legacy and expression parameters used together, before an ExpressionAttributeValue nested more than 32 levels (measured 2026-10-26 at 05:15 and 05:20 UTC, each request twice). The earlier move put the nesting check ahead of both: UpdateItem now runs it right after the check for mixed parameters, and PutItem checks the Item's numbers just before it. DeleteItem already ran it after the mixed-parameter check. The path_length module comment now says the key condition parser checks the length before the names are checked, and a unit test covers the BETWEEN bounds in the semantic walk.
UpdateItem with `AttributeUpdates`, `Expected` or `ConditionalOperator`
beside an expression and a 32-level value answers the mixed-parameter
error, and PutItem with `{N: abc}` in the Item, at the top level or
nested, answers the number error (measured 2026-10-26 at 05:15 and 05:20
UTC).
17b805d to
1454cc9
Compare
90b673b to
8549bc0
Compare
demohan
left a comment
There was a problem hiding this comment.
I measured the cases below on the service in us-east-1 on 2026-11-11, each request twice, and against SQLite servers built from this head and from 1454cc9. Three request shapes that 1454cc9 answered as the service does now answer differently. They are inline. Before merge, these three need to change, the KeyConditionExpression order needs to match the service, and the new branches need tests.
| } | ||
| } | ||
| // The length after the path's names, as the service checks it. | ||
| if let Some(msg) = super::path_length::too_many_levels(path) { |
There was a problem hiding this comment.
GetItem and Scan with ProjectionExpression: "#k, #k, #m.#k..." (33 elements in the last path) answer Invalid ProjectionExpression: Two document paths overlap with each other; must remove or rewrite one of these paths; path one: [k], path two: [k] on the service and at 1454cc9. This head answers the length error. The service checks each path's overlap with the earlier paths before it reads the next path. Query, BatchGetItem and TransactGetItems answer the same way.
There was a problem hiding this comment.
Fixed in d508588. resolve_paths checks each path against the earlier paths right after its length, so #k, #k, <33 elements> answers the overlap on GetItem, Scan, Query, BatchGetItem and TransactGetItems.
| Ok(()) | ||
| // The service checks the length after the path's names (measured | ||
| // 2026-10-26). | ||
| match super::super::path_length::too_many_levels(path) { |
There was a problem hiding this comment.
TransactWriteItems with one Update, SET #m.#k... = :v (33 elements) and ConditionExpression: attribute_exists(#zz) with #zz undefined, answers Invalid ConditionExpression: An expression attribute name used in the document path is not defined; attribute name: #zz on the service and at 1454cc9. This head answers Invalid UpdateExpression: The document path has too many nesting levels; nesting levels: 33. On the service the transaction Update's ConditionExpression is checked first for every UpdateExpression defect I sent: syntax, undefined name, undefined value, overlap, reserved word and length. The PR description states the opposite order.
There was a problem hiding this comment.
Fixed in 617ab86. A TransactWriteItems Update checks its ConditionExpression before its UpdateExpression, as UpdateItem does. The Check order section of the description states that order.
| // after an invalid number in the Item and before the ConditionExpression | ||
| // and the table lookup (measured 2026-10-26), so the Item's numbers are | ||
| // checked here first; `validate_put_item` checks them again later. | ||
| if let Some(values) = &input.expression_attribute_values { |
There was a problem hiding this comment.
PutItem with Item n: {N: "abc"}, ConditionExpression: attribute_exists(<33 elements>) and no ExpressionAttributeValues answers 1 validation error detected: The parameter cannot be converted to a numeric value: abc on the service. With an Item attribute 33 maps deep and the same condition, or with a BETWEEN :hi AND :lo (5 and 1), the service answers Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit. 1454cc9 gives the same answers. This head answers the length error or the BETWEEN error, because this block checks the Item's numbers only when values are present and does not check its nesting. TransactWriteItems Put with the deep Item answers the nesting error on the service and the length error here.
There was a problem hiding this comment.
| // path (`attr.sub` or `attr[i]`) on a key is rejected, matching Amazon | ||
| // DynamoDB. Runs after the reserved-word check and before key-schema checks. | ||
| for clause in &clauses { | ||
| if let Some(msg) = super::path_length::too_many_levels(raw_clause_path(clause)) { |
There was a problem hiding this comment.
The service checks a key condition's names and values before the length, clause by clause. pk = :p AND #zz.#k... = :s (33 elements, #zz undefined) answers the undefined name, and pk = :nope AND <33 elements> = :s answers the undefined value. This head answers the length error for both. The module comment in path_length.rs describes the order this head uses.
| format_attribute_value(h) | ||
| ))); | ||
| } | ||
| if let Some(msg) = between_bounds_fault(low, high, maps) { |
There was a problem hiding this comment.
No test fails with this call removed. Without it, PutItem with Expected: {n: {ComparisonOperator: BETWEEN, AttributeValueList: [{N: "5"}, {N: "1"}]}} answers ConditionalCheckFailedException where this head answers ValidationException.
There was a problem hiding this comment.
Fixed in 4cacd55. A unit test calls evaluate_condition with bounds out of order, and a wire test sends your Expected BETWEEN on PutItem.
| let (Some(l), Some(h)) = (maps.values.get(l_name), maps.values.get(h_name)) else { | ||
| return None; | ||
| }; | ||
| let bounds = format!( |
There was a problem hiding this comment.
This text is built for every item the evaluator checks, also when the bounds are valid. A Scan of 6000 items with two 380,000-character bounds took 1.196 s here against 0.155 s at 1454cc9 on SQLite, and 0.659 s against 0.045 s on PostgreSQL. A >= and <= filter took the same time on both. Building it only on a fault removes the difference.
There was a problem hiding this comment.
Fixed in 4cacd55. between_bounds_fault finds the fault first and builds the sentence only when it finds one. The description has the Scan times.
| // single-item write paths, condition-only placeholders included: measured | ||
| // 2026-08-24 (us-east-1), a 32-level value referenced solely by a | ||
| // ConditionExpression is rejected on PutItem, DeleteItem, and UpdateItem | ||
| // alike, while 31 levels is accepted. TransactWriteItems deliberately does |
There was a problem hiding this comment.
The service now refuses a 32-level condition-only value in TransactWriteItems Put and ConditionCheck with the nesting error and accepts 31 levels, so this sentence is no longer true.
There was a problem hiding this comment.
Fixed in 91060d0. The comment now names validate_value_map_nesting, the function that checks the nesting of a TransactWriteItems value.
| walk_condition_operand(high, maps, kind)?; | ||
| validate_ordering_operand_types(expr, maps).map_err(|e| with_kind(e, kind)) | ||
| validate_ordering_operand_types(expr, maps).map_err(|e| with_kind(e, kind))?; | ||
| // The bounds are checked at request time, so a condition that |
There was a problem hiding this comment.
In TransactWriteItems this head checks the UpdateExpression first, so SET <33 elements> = :s with #x BETWEEN :hi AND :lo answers the length here and the bounds error on the service.
There was a problem hiding this comment.
Fixed in 617ab86. The condition's BETWEEN bounds error now comes before a 33-element SET path, and test_transact_write_items_update_checks_the_between_bounds_first sends that request.
| | Condition expression size | 4 KB | Enforced | `check_expression_size`, `LimitsConfig::max_expression_length_bytes` | | ||
| | Update expression size | 4 KB | Enforced | `check_expression_size`, `LimitsConfig::max_expression_length_bytes` | | ||
| | Key condition expression size | 4 KB | Enforced | `check_expression_size`, `LimitsConfig::max_expression_length_bytes` | | ||
| | Document path length in an expression | 32 elements (each attribute name and list index counts as one) | Enforced | Every expression kind: `Invalid <Kind>: The document path has too many nesting levels; nesting levels: <n>`. Checked path by path in the order the paths appear, after each path's `#name` references, so an undefined `#name` in an earlier path or inside the long path is reported first, as on the service. A syntax error anywhere in the expression is reported first. ExtendDB checks reserved words on the whole expression before any path, where the service checks them in the same walk, so a long path followed by a reserved word answers the reserved word error | |
There was a problem hiding this comment.
A KeyConditionExpression checks the length before the names on this head (#zz = :p AND <33 elements> = :s answers the length), so the row's name-first statement does not hold for that kind.
| } | ||
|
|
||
| /// The BETWEEN bounds are checked at request time (measured 2026-10-26, | ||
| /// HBTW-1: refused on a missing key and after a false AND). |
There was a problem hiding this comment.
HBTW-1 is an identifier from the probe runs. The sentence reads the same without it.
The service checks projection paths one after another in text order. It checks a path's names, then its length, then its overlap with an earlier path. GetItem, Scan, Query, BatchGetItem and TransactGetItems with `#k, #k, <33 elements>` answer the overlap of the two `#k` paths. `#k, <33 elements>, #k` and `#m, <33 elements>` answer the length. Measured 2026-11-12 in us-east-1, each request twice. ExtendDB checked the length in `resolve_paths` and the overlap after it resolved every path, so the first request answered the length. `resolve_paths` now checks each path against the earlier paths right after its length, and the separate overlap pass is gone. The update overlap check uses the same loop. Both now name the first path that overlaps an earlier one. On the service, `a, b, b.y, a.x` answers `[b]` and `[b, y]` for a projection and for an UpdateExpression. ExtendDB named `[a]` and `[a, x]`.
On the service, a TransactWriteItems Update whose ConditionExpression names an undefined `#zz` answers the undefined-name error for `#zz` first. That error comes before each of these UpdateExpression defects: - a path of 33 elements - a syntax error - an undefined name or an undefined value - overlapping paths - a reserved word - an ADD of a string With BETWEEN bounds out of order in the condition and a 33-element SET path, the service answers the bounds error. Measured 2026-11-12 in us-east-1, each request two or six times. On 2026-10-14 the service answered the UpdateExpression first, and the transaction path kept that order. With the new path length check, a long SET path beside an undefined name in the condition answered the length. Before the check, it answered the condition's error. The transaction path now checks the condition first, as UpdateItem does. test_expression_semantics.py expected the old order, and its transaction rows now expect the condition's error.
On the service, PutItem with `n: {N: "abc"}` in the Item and the
condition `attribute_exists(<33 elements>)` answers the number error.
This holds with no ExpressionAttributeValues in the request. The answer
is `1 validation error detected: The parameter cannot be converted to a
numeric value: abc`. An Item attribute 33 maps deep answers the nesting
error beside the same condition. It also answers the nesting error
beside `a BETWEEN :hi AND :lo` with 5 and 1. A TransactWriteItems Put
with that Item answers the nesting error too.
The Item's numbers and nesting also come before these condition faults:
- a syntax error
- an undefined name or value
- an unused value
- a reserved word
The nesting also comes before the item size. A Put whose Item nests 32,
33 or 40 lists, or 32, 33 or 40 maps, answers the nesting error. It does
so beside a condition with an undefined value and beside an item over
400 KB. Measured 2026-11-12 in us-east-1, each request twice.
PutItem checked the Item's numbers early only when the request carried
ExpressionAttributeValues. It checked the nesting after the table lookup.
So the new path length check and the BETWEEN bounds check answered first.
PutItem now checks both right after the table name, with or without
values. A TransactWriteItems Put now checks its Item's nesting before the
item's expressions instead of after its size.
test_transact_write_phase_order.py expected the earlier order (measured
2026-10-27) in two rows. Both rows now expect the nesting error.
A comment said that TransactWriteItems does not check the nesting of its
values. The comment now points at `validate_value_map_nesting`. On the
service, a TransactWriteItems Put or ConditionCheck refuses a value 32
maps deep that only the condition reads, and accepts 31 maps. Measured
2026-11-12.
The service checks a KeyConditionExpression's `#name` and `:value` references and each document path's length in one pass in text order. Then it refuses a nested attribute, and then the clause shapes. Measured 2026-11-12 in us-east-1, each request twice: - `pk = :p AND #zz.#k... = :s` (33 elements, `#zz` undefined) and `#zz = :p AND <33 elements> = :s` answer the undefined `#zz`. - `pk = :nope AND <33 elements> = :s` answers the undefined `:nope`. - `<33 elements> = :s AND pk = :nope`, `<33 elements> = :s AND #zz = :p` and `pk = :p AND <33 elements> = :nope` answer the length. - `#zz = :p AND <32 elements> = :s`, `<32 elements> = :s AND pk = :nope` and `#m.#k = :s AND #zz = :p` answer the undefined reference ahead of the nested-attribute refusal. - `pk < :nope` and `begins_with(pk, :nope)` answer the undefined `:nope` ahead of the clause shape. ExtendDB's parser checked the length of every path, then the nested attributes and the shapes. The references ran after the whole parse. The key condition parse now takes the request's maps and walks the tokens once. It checks each path's names, then its length, and each value. The walk is the engine's former `check_key_condition_refs` with the length added. It moves into `parse_key_condition_with_maps` in core, so it can run before the nested-attribute refusal. `parse_key_condition` without maps, which authorization reads, refuses a long path as a nested attribute.
`between_bounds_fault` formatted both bounds into the sentence before it checked them. The evaluator calls it for every item a condition or filter reads. A Scan of 6,000 items with `#x BETWEEN :lo AND :hi` and two 380,000-character bounds in order took 0.45 s on a SQLite debug build. The same Scan with `#x >= :lo AND #x <= :hi` took 0.23 s (median of five runs). The function now finds the fault first. It builds the sentence only when the bounds differ in type or the lower is above the upper. After the change the BETWEEN Scan takes 0.26 s, and the `>=` and `<=` Scan takes 0.26 s. New tests cover the evaluator's own call and the type branch, which no test reached: - `evaluate_condition` refuses bounds out of order and bounds of different types, on an item with the attribute and on an empty item. - The wire tests send both faults through UpdateItem on a missing item, on an existing item and after a false AND. - They send both through a Query FilterExpression, on an empty partition and on one with items. - They send bounds out of order through a legacy `Expected` on PutItem. On the service each of these answers ValidationException (measured 2026-11-12 in us-east-1, each request twice). The `Expected` row compares the class and the operator only, because the service gives `Expected` its own sentence.
The limits row and the path_length module comment now say that a KeyConditionExpression checks its names before the length. They also say that it checks its values in the same pass. The key condition change made both statements true. The BETWEEN walk test no longer carries the label of the run it came from.
The key condition pass restated the undefined-name and undefined-value messages and the path length call. It now calls `check_path_refs` and `check_value_defined`, the checks the update and condition walk uses, with the KeyConditionExpression kind. ExtendDB answers the 78 measured requests the same way before and after the change.
The comments and doc comments that this change adds now use sentences of 25 words or fewer and no semicolons. The code is unchanged.
`handle_put_item` checks the Item's numbers and nesting right after the table name, before the condition and the table lookup. `validate_put_item` then checked both again on the same Item. `handle_put_item` is the only caller of `validate_put_item`, so the second pair of checks could not fail. `validate_put_item` no longer runs them, and the handler comment no longer says that it does. The comment on the ExpressionAttributeValues nesting check said "It comes after an invalid number in the Item". The pronoun read as `validate_value_map_nesting`, the function that the sentence before names. The comment now starts with "This check". It also says that the check comes after the Item's nesting as well as its numbers.
crates/core/src/expression/evaluator.rs keeps between_bounds_fault from this branch and the placeholder_numeric doc line from the base branch, which reads a pre-parsed number through ParsedNumber. crates/engine/src/transact_write_items.rs keeps both sides of the phase 1 comment. The number checks come from the base branch. The position of a Put's item nesting comes from this branch: after the numbers and before the ExpressionAttributeValues nesting, as the code runs them.
…main Main (#620) checks a PutItem Item's numbers and nesting in put_item_item, ahead of the mixed-parameter check. It checks the ExpressionAttributeValues nesting and numbers in put_item_values, after that check. This branch ran the same three checks again after validate_table_name. The second copies could not fail after the first ones. They are gone. The behaviour this branch added, the Item's error ahead of every condition fault, holds through main's checks. The two comments from main said that validate_put_item and a later nesting check repeat these checks. This branch removed both repeats, so the comments now say that the checks run once. They also carry the measurements this branch recorded. The Item's error comes beside a condition fault, with or without ExpressionAttributeValues. TransactWriteItems checks its values in validate_value_map_nesting.
demohan
left a comment
There was a problem hiding this comment.
I sent the requests from my review of 12 November to the service again in us-east-1 on 19 November, each at least twice. I compared the answers with servers built from 7029242 on SQLite, PostgreSQL, MongoDB and Cassandra, and they match:
- ProjectionExpression
#k, #k, <33 elements>answers the overlap on GetItem, Scan, Query, BatchGetItem and TransactGetItems. - A TransactWriteItems Update answers an undefined name in its ConditionExpression before the 33-element path and the other six UpdateExpression faults, and the BETWEEN bounds error before a 33-element SET.
- PutItem and a TransactWriteItems Put answer the Item's invalid number or nesting before the condition's length or BETWEEN error, with or without ExpressionAttributeValues.
- A KeyConditionExpression answers an undefined name or value before the length.
With each of these fixes reverted alone, the new wire tests fail. The BETWEEN tests fail without the evaluator's call and without the type branch. The Scan with two 380,000-character bounds now takes 0.069 s on SQLite, and the >= and <= filter takes 0.071 s.
One sentence in the description no longer matches the service. On 19 November it accepted a condition-only value 32 maps deep in a TransactWriteItems Put and in a ConditionCheck on every send. So the first bullet under "Not changed here" describes no difference at 32 maps. The service also accepted that value in a PutItem condition, where ExtendDB refuses it. That predates this PR.
|
Thanks @demohan. I sent the three requests again on 19 November, twice each, and the service accepted the condition-only value 32 maps deep in all three. The first bullet under "Not changed here" now says so, and it says that ExtendDB refuses the value in PutItem. #1170 tracks that difference, with DeleteItem and UpdateItem, where the service accepts the value too. The third bullet now also cites #960 for the missing prefix on the PutItem number error. |
…copy tests (ExtendDB#1059) Two copy tests in refusal_tests.rs read this process's locks on the database from /proc/locks. The kernel returns /proc/locks one page per read, and each read starts again at an index into the lock list. A lock that another test or process takes or releases between two pages moves the entries after it. So a read can skip an entry or list one twice. CI run 43873705049 for ExtendDB#597 failed the setup check "the runner's connection holds no lock" this way. posix_locks now reads the lock: lines of /proc/self/fdinfo. The kernel writes the locks of one file there in one pass, under the spinlock of that file's lock list. A read of fdinfo opens no descriptor on the database, so it releases no lock. The helper returns a set, because a duplicated descriptor lists its file's locks again. Four other processes took and released locks during each loop of 100 runs. With the old helper the two tests failed 10 and 14 times. With this helper both passed 100 of 100. Without the other processes, both helpers passed 100 of 100.
What
This PR refuses an expression document path of more than 32 elements with the error that Amazon DynamoDB returns,
Invalid <Kind>: The document path has too many nesting levels; nesting levels: <n>. Each attribute name and each list index counts as one element. The check applies to UpdateExpression, ConditionExpression, ProjectionExpression, FilterExpression and KeyConditionExpression. It runs after each path's#namereferences, path by path in text order, as on the service.Check order
The service checks these requests in the order below (measured on 2026-11-12 in us-east-1). ExtendDB now does the same.
ProjectionExpression: for each path in turn, its names, then its length, then its overlap with the earlier paths.
#k, #k, <33 elements>answers the overlap, and<33 elements>, #k, #kanswers the length. The overlap error names the first path that overlaps an earlier one, and the earlier path comes first in the message. Soa, b, b.y, a.xanswers[b]and[b, y]. An UpdateExpression names its overlapping paths by the same rule.TransactWriteItems Update: the ConditionExpression comes before the UpdateExpression, and the BETWEEN bounds of the condition come before a long update path. An undefined name in the condition comes before each of these UpdateExpression faults:
ADDoperand of the wrong typefix(expressions): validate in the service's order, with its messages #399's head checks the UpdateExpression first.
PutItem: the Item's numbers and nesting come before the ConditionExpression checks and before the table lookup, with or without ExpressionAttributeValues. Since fix(engine): validate numbers on every key and item path #620, main runs both checks at that position, in
put_item_item. So a PutItem on a missing table with an invalid number or an Item nested too deep answers the Item's error, as the service does. The nesting case is one of the two parts of PutItem and UpdateItem: the nesting refusal at 32 and 33 levels has no1 validation error detected:prefix, and PutItem reports a missing table first #814.validate_put_itemno longer repeats the two checks.TransactWriteItems Put: the Item's nesting comes before the nesting of its values, its expressions and its item size.
KeyConditionExpression: one pass in text order checks each path's names, then its length, and each value placeholder. The pass comes after the syntax check and before the refusal of nested attributes and the checks of the clause shapes. So
#zz = :p AND <32 elements> = :swith#zzundefined answers the undefined name.BETWEEN bounds
The BETWEEN bounds check applies when both bounds are placeholders. It refuses bounds of different types and a lower bound above the upper bound. The semantic walk runs it at request time, and the evaluator calls it too. The check now builds its error sentence only when it finds a fault. The first revision built the sentence for every item it evaluated. The times below are medians of 5 runs on ExtendDB SQLite debug builds. Each run is a Scan of 6,000 items with the filter
#x BETWEEN :lo AND :hiand two 380,000-character bounds in order:1454cc932)69e64151d)375c1ad1b)New tests cover both faults. A unit test calls the evaluator on an item with the attribute and on an empty item. Wire tests send UpdateItem on a missing item, on an existing item and after a false
AND. They also send a Query filter on an empty and on a full partition. Another wire test sends a PutItem with legacyExpectedBETWEEN bounds out of order. It checks the error type and the word BETWEEN, because the service's text differs from ExtendDB's (see Not changed here).Comments and docs
docs/dynamodb-limits.mdhas a row for the limit. The row and thepath_length.rsmodule comment state the KeyConditionExpression order.validate_value_map_nesting, the function that does.Changes to #399's tests
Three of #399's dual-target test functions expected answers that the service no longer gives (measured on 2026-11-12):
test_transaction_checks_the_update_firstintests/test_expression_semantics.pyis nowtest_transaction_checks_the_condition_first. Its five rows expect the condition's error.tests/test_transact_write_phase_order.py, a Put with a deep Item and a 410 KB pad now expects the nesting error. So does a Put with a deep Item and the conditionnote = :q. The two functions have new names that state the order.Overlap with other PRs
check_referencesandparse_key_condition_with_mapstokey_condition.rs. Its walk runs after the refusal of nested attributes, and the service answers the references first. The second of the two PRs to merge keeps onecheck_references, at this PR's position and with the length check.a0f2a6be3contains it. Itsput_item_itemruns the same two Item checks inhandle_put_item, before the check for legacy and expression parameters used together. The service answers the Item first at that position too. Itsput_item_valueschecks the ExpressionAttributeValues after that check. This branch ran the three checks again aftervalidate_table_name. Commit70292427aremoves those copies, so each check runs once, at fix(engine): validate numbers on every key and item path #620's position.Not changed here
ExtendDB answered these requests the same way before this PR:
ExpressionAttributeValues contains invalid value: ... for key :d.ExpectedBETWEEN bounds out of order, the service answers1 validation error detected: One or more parameter values were invalid: The BETWEEN condition was provided a range where the lower bound is greater than the upper bound. ExtendDB answers the evaluator's sentence.1 validation error detected:prefix. PutItem and UpdateItem: the nesting refusal at 32 and 33 levels has no1 validation error detected:prefix, and PutItem reports a missing table first #814 covers the nesting error, and PutItem: item number errors have no1 validation error detected:prefix, and DynamoDB adds it #960 covers the number error.pk < :p, the service answersQuery key condition not supported. Forpk = :p OR sk = :nopeandpk = :p AND sk <> :nope, it answers the undefined:nope. ExtendDB answers its own texts for all three.pk = :nope AND name = :sanswers the undefined:nopeon the service and the reserved word on ExtendDB.Against #399's head
a0f2a6be3, the PR changes 20 files. It adds 261 production lines and removes 155, comment lines included. It adds 800 test lines and removes 25, and it adds 1 line of docs.Why
DynamoDB refuses a document path of more than 32 elements. ExtendDB had no limit. It evaluated a 33-element path, and an UpdateItem
ADDon one created the missing maps and stored the result.This PR targets #399's branch,
fix/transact-validation-order. The branch merges #399's heada0f2a6be3, because the change uses #399's expression code: the length check runs in #399's per-path semantic walk. After #399 merges, the base changes tomain.This revision follows demohan's review of 12 November. In the first revision, some requests answered the length error where the service, and ExtendDB before this PR, answer another error. Examples are a ProjectionExpression
#k, #k, <33 elements>, and a PutItem with an invalid Item number beside a long path in its condition.Testing done
The limit, and the way the service counts path elements, were measured against Amazon DynamoDB in us-east-1 on 2026-10-26. The orders and the differences listed in What were measured on 2026-11-12, in runs between 17:30 and 19:39 UTC. The last run sent 174 cases as 388 requests. It sent each case twice, and 40 cases three times: the cases on the order of a condition and an UpdateExpression, and #399's transaction rows. Each case got the same answer on every send, apart from one of #399's rows, where the service answers either of two errors.
The same requests went to SQLite servers built from three commits: #399's head of 31 October (
1454cc932), the first revision merged with #399's head (69e64151d), and375c1ad1b. Wherever one of the other two matched the service,375c1ad1bmatches it too. It matches the service in 114 cases exactly, and in 146 cases apart from the1 validation error detected:prefix. The last commit,519f20062, removes the two repeated checks and changes two comments. It answers all 388 requests as375c1ad1bdoes.With each fix reverted in turn, the tests written for that fix fail. The counts are 2 wire tests for the projection order, 8 for the transaction order, 7 for PutItem and 1 for each BETWEEN fault. Against the first revision's server (
69e64151d), the three wire files that this revision changes have 23 failing tests.At
519f20062, on 2026-11-12:cargo +1.97.0 fmt --all -- --check: clean.cargo +1.97.0 clippy --locked --all-targets --features extenddb-storage-cassandra/test-hooks,extenddb-storage-mongodb/test-hooks -- -D warnings: no warnings.cargo +1.97.0 clippy --locked --all-targets --features extenddb-engine/backup-test-hooks -- -D warnings: no warnings.cargo +1.97.0 test --locked -p extenddb-core -p extenddb-engine --lib: core 1,078 passed and 1 ignored, engine 630 passed.tests/test_document_path_length.py(82 passed) and the files that test PutItem's Item numbers and nesting, PartiQL writes and the transaction phase order.At
375c1ad1b, 83 wire files on a SQLite server gave 4,595 passed, 4 skipped and 8 xfailed. They are the files for expressions, conditions, projections, Query and Scan, the item and batch writes, transactions, PartiQL and request validation.The branch then merged #399's head
a0f2a6be3(mergedea363eaa). After the merge,70292427aremoved the branch's copies of the three PutItem checks that #620 runs. The service comparison above was not run again on this head. At70292427a, on 2026-11-16:cargo +1.97.0 fmt --all -- --check: clean.cargo +1.97.0 clippy --all-targets --features extenddb-storage-cassandra/test-hooks,extenddb-storage-mongodb/test-hooks -- -D warnings: no warnings.cargo +1.97.0 clippy --all-targets --features extenddb-engine/backup-test-hooks -- -D warnings: no warnings.cargo +1.97.0 test -p extenddb-core --lib: 1,157 passed and 1 ignored.cargo +1.97.0 test -p extenddb-engine --lib: 877 passed.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
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.