Skip to content

fix(engine): validate numbers on every key and item path - #620

Merged
jcshepherd merged 27 commits into
mainfrom
fix/618-number-validation-all-ops
Nov 13, 2026
Merged

jcshepherd merged 27 commits into
mainfrom
fix/618-number-validation-all-ops

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

This PR checks the N and NS values on every key and item path below, with the text DynamoDB gives on each path. Main checked only the PutItem item and UpdateItem's update values. On the other paths, main stored or looked up an N value such as abc or 1E126 as written.

Path Answer for a bad number
GetItem, BatchGetItem and TransactGetItems keys the number message, no prefix
DeleteItem and UpdateItem keys 1 validation error detected: and the number message
PutItem, DeleteItem and UpdateItem ExpressionAttributeValues 1 validation error detected: and the number message
PutItem, DeleteItem and UpdateItem legacy Expected (Value and AttributeValueList) 1 validation error detected: and the number message
BatchWriteItem put items (attributes, NS members, nested L and M) and delete keys the number message, no prefix
TransactWriteItems Put items, Update, Delete and ConditionCheck keys, and ExpressionAttributeValues (on Put and Delete only with a ConditionExpression) the number message, no prefix
ImportTable rows a value that is not a number ends the import of that file. A number out of range skips the row.

A refused batch or transaction writes nothing. Main stored the whole request, invalid values included.

Details of this round:

  • The branch merges main at 4a74103 (main 9c3fbfb), with fix(core): range check number exponents as DynamoDB does #619 in it. The branch is not rebased, so the commits under review keep their hashes.
  • Every path above reads the exponent as a 64-bit value, the same as PutItem. ImportTable is the exception and keeps a 32-bit reader (validate_number_i32_scale).
  • ExpressionAttributeValues numbers no longer get the ExpressionAttributeValues contains invalid value: <message> for key :v wrapper. This changes main's UpdateItem text too.
  • An empty N answers The parameter cannot be converted to a numeric value: with the colon on every path in the table except BatchWriteItem and ImportTable. BatchWriteItem leaves out the colon.
  • An import that refused any row ends FAILED with FailureCode ItemValidationError and keeps the rows it imported. Main reported COMPLETED for every import.
  • Order against a second fault: DeleteItem and UpdateItem report an over-long ExpressionAttributeNames name before a bad value number. TransactWriteItems reports a ClientRequestToken over 36 characters first. An item with both an over-long attribute name and a bad number gets the name error here. DynamoDB gives either error for the same request (counts below).
  • import_row and arithmetic_operand return a NumberFault enum. They no longer sort errors by message text.
  • The branch carries fix(expression): range check numbers before bigdecimal arithmetic and comparison #803 and fix(import): check the numbers in each ImportTable row as the service does #804. Since fix(expression): range check numbers before bigdecimal arithmetic and comparison #803, a stored N that DynamoDB cannot store compares as another type, so only <> is true. fix(import): check the numbers in each ImportTable row as the service does #804 checks the numbers in ImportTable rows.
  • tests/test_backup_job.py stored items with invalid numbers through BatchWriteItem, TransactWriteItems, UpdateItem and ImportTable, and those paths refuse them now. Since 0daa2b8, the tests write those items straight into each backend's storage and check the same backup failure.

Not changed here:

Why

Part of #618.

DynamoDB refuses these values, so ExtendDB has to refuse them with the same text. The service's answers changed during the review. On 9 Nov, BatchWriteItem read a 32-bit exponent. On 11 Nov, it read a 64-bit exponent like the other item operations. The expected answers in the tests come from DynamoDB in us-east-1, except where a test comment names a choice. Each request went out at least twice and got the same answer each time, unless a count says otherwise.

Measured on 11 Nov 2026, between 06:34 and 09:06 UTC:

  • PutItem, BatchWriteItem, TransactWriteItems and TransactGetItems give the same answer for 11 values, for example:
    • 10E2147483647 and 1E9223372036854775807 answer Number overflow.
    • 1E-9223372036854775808 answers Number underflow.
    • 1E9223372036854775808 cannot be converted.
  • BatchWriteItem repeated 10E2147483647 and 1E2147483648 six times each, with Number overflow every time.
  • abc and 1E2147483648 in Expected answer the prefixed number message on PutItem, DeleteItem and UpdateItem, ahead of the condition.
  • UpdateItem and TransactWriteItems answer ExpressionAttributeValues numbers with no wrapper. This holds for abc, 12e, 1E126, an empty N and numbers inside M, L and NS.
  • The same item with a 65,536-byte attribute name and 1E2147483648 gave the name error 6 times and the number error 2 times on PutItem (8 sends). BatchWriteItem gave the same counts. TransactWriteItems gave 8 and 4 (12 sends), and 2 and 6 with the attributes in the other order (8 sends).
  • Two imports (ImportTable) still read a 32-bit exponent, as on 3 Nov. 1E2147483648 and 1E-2147483648 ended their files with Expected a valid numeric. Remainder of the file will not be processed. and the import skipped 1E2147483647 as Number underflow. A file whose only refused row had a number key on a string-key table ended FAILED with ItemValidationError, 2 rows imported and 1 error.

The message forms and the other order rows come from the 27 Oct measurements in the wire tests.

Testing done

At the tip 47c32b9, with nice -n 19 and CARGO_BUILD_JOBS=2:

  • 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: exit 0. The other CI clippy command, with extenddb-engine/backup-test-hooks, gave exit 0 at 732ebee.
  • cargo +1.97.0 test --locked -p extenddb-core --lib: 1,132 passed, 1 ignored. -p extenddb-engine --lib: 767 passed.
  • devtools/run-tests --extenddb --rust-integration --filter number_validation, against a SQLite server: 61 passed.
  • devtools/run-tests --extenddb --pytest --filter "number_validation or TestImportTableNumbers": 34 passed.
  • Full wire suite at 470655f: 564 of 567 passed. The 3 capacity throttling tests then passed 7 of 7 with throttling on, as CI runs them.

For 0daa2b8, the changed backup tests passed 3 of 3 on SQLite, PostgreSQL and MongoDB, in local containers. The other MongoDB, PostgreSQL and Cassandra suites ran in CI only.

CI at 0daa2b8: 64 of 64 checks passed. The Rust unit test job passed on a rerun. Its first attempt failed two timing tests in crates/cache, which this PR does not change: panicking_refresh_does_not_leak_inflight_flag (#910) and concurrent_stale_hits_spawn_only_one_refresh.

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

  • A request with an N value that DynamoDB refuses now gets a ValidationException on the paths above. Main stored or looked up such a value as written.
  • UpdateItem's message for a bad ExpressionAttributeValues number loses the ExpressionAttributeValues contains invalid value: ... for key :v wrapper.
  • An ImportTable that refuses any row now ends FAILED with ItemValidationError. Main reported COMPLETED.

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.

validate_and_normalize_number parsed the exponent as an i32. #394 moved
its exponent sums to saturating i64 arithmetic, which fixed the overflow
panics of #616, but an exponent outside the i32 range was still refused
as malformed.

The exponent is now parsed as an i64 and the sums are done in i128
instead of saturating i64, so none of them can overflow. DynamoDB reads
the exponent the same way: 1E2147483648 is a Number overflow and
1E9223372036854775808 cannot be converted. A zero whose exponent does
not fit in an i32 is range checked too; main refused those as malformed.

A zero whose exponent fits in an i32 stays accepted as 0, although
DynamoDB refuses 0E126 and 0.0E-130. A refused zero keeps its raw
spelling in AttributeValue, and only the PutItem item and UpdateItem's
update values are validated afterwards, so UpdateItem's key and the
other operations would store 0E126 as a key separate from 0. #618
covers both.

Closes #616
@LeeroyHannigan
LeeroyHannigan force-pushed the fix/616-number-exponent-overflow branch from 95997b6 to bfde5fd Compare October 30, 2026 09:07
Only the PutItem item and UpdateItem's update values were checked.
AttributeValue keeps a number it cannot read as written, so GetItem,
DeleteItem and UpdateItem keys, BatchGetItem and TransactGetItems keys,
BatchWriteItem writes, every TransactWriteItems action, and PutItem and
DeleteItem condition values used values such as abc and 1E126 as
written, where DynamoDB refuses them with a ValidationException.

Each of those paths now checks its N and NS values with the text that
operation answers. PutItem, UpdateItem and DeleteItem start the message
with "1 validation error detected: ", the other operations do not, and
a TransactWriteItems value names its placeholder. BatchWriteItem,
TransactGetItems and TransactWriteItems read a number with a 32-bit
exponent and scale, as DynamoDB does on those operations, so
10E2147483647 is a Number underflow there and a Number overflow on the
others.

Each check is placed where DynamoDB reports it, unless that position
would change the answer to a request with a second fault that main
already answers as DynamoDB does. The ClientRequestToken check now runs
before the actions, as on DynamoDB.

A zero whose exponent fits in an i32, such as 0E126, stays accepted as
0 until Query, Scan and ImportTable validate numbers. A zero whose
exponent does not fit is range checked on its magnitude, which makes
0E9223372036854775807 a Number underflow, as on DynamoDB.

Part of #618
number_validation_all_ops covers each validated path with DynamoDB's
message for abc, 1E126 and the 32-bit edge values, a refused batch or
transaction writing nothing, and valid zeros stored as 0.
number_validation_order pins the position of each check against a
second fault in the same request: an absent table, a mixed-parameter
error, an unused name, a projection or condition syntax error in another
item, a duplicate key and a long ClientRequestToken. Each expectation
is a DynamoDB answer measured twice on 2026-10-27.

Part of #618
@LeeroyHannigan
LeeroyHannigan force-pushed the fix/618-number-validation-all-ops branch from 909482b to 41bc6e4 Compare October 31, 2026 17:00
@LeeroyHannigan LeeroyHannigan added the v1 Needed for the 1.0 release label Nov 3, 2026
… comparison

SET a = b + c, SET a = b - c and a number ADD parsed both operands with
bigdecimal and range checked only the result. bigdecimal aligns operands
to the larger scale before adding them, so the cost of a sum grows with
the gap between their exponents, and an operand read from an item stored
without the number checks (#618) could build an integer of about 10^9
digits.

Each operand is now range checked and parsed from its normalized text. A
stored operand that is not a number answers the service's text without
the stored value. The result is stored as the service spells it (2.25 -
0.25 is 2, not 2.00), and a result out of range keeps the Number overflow
answer, as measured on DynamoDB on 2026-11-03.

Numbers in condition and filter comparisons are parsed the same way,
which bounds bigdecimal's quadratic parse for values that are not checked
before the expression maps are built. A placeholder the check refuses is
recorded once per request, and a number the service cannot store compares
as a value of another type, so only <> is true for it.
… does

ImportTable stored a row's numbers as written. Each row's numbers are now
read as BatchWriteItem reads them, before the other row checks: a value
that is not a number ends the import of the file, and a number out of
range skips the row. Either counts as one error, and an import with any
error answers FAILED with ItemValidationError and keeps the rows it
imported, as measured on DynamoDB on 2026-11-03.

Each refused row is logged with the import ARN, the table name and its
item number, with the error text escaped.

A zero with an out-of-range exponent and a Unicode decimal digit are still
read differently from the service; both are recorded in
docs/differences-from-dynamodb.md.
LeeroyHannigan and others added 3 commits November 3, 2026 22:42
The MongoDB fast path for a number ADD adds a Decimal128 in an update
pipeline and does not read the stored value first. A Decimal128 keeps 34
digits and holds magnitudes DynamoDB refuses. After 5E125 + 5E125,
GetItem returned 1.000000000000000000000000000000000E+126, where the
update evaluator answers Number overflow. After 38 nines + 1, it
returned 99999999999999999999999999999999990000, where the exact sum is
1E38.

The fast path now takes a delta whose normalized text is an integer of
at most 33 digits, or has at most 20 digits before the decimal point and
13 after it. Its filter admits a stored value written without an
exponent, within limits that keep the sum within 34 digits: an integer
of up to 33 digits when both operands are integers, and up to 20 and 13
digits when either has a fraction. Any other ADD takes the session path,
where the update evaluator range checks both operands and the sum. The
delta is the Decimal128 of its normalized text, so 1E3 is added as 1000.

On MongoDB 7, fifty threads sending 20 ADD calls each to one item, with
SDK retries off, gave no errors and the exact total for deltas of 1, 0.5
and 0.001, for 1 added to a stored 0.5 and to a stored 21-digit integer,
and for a 25-digit delta.
fix(expression): range check numbers before bigdecimal arithmetic and comparison
fix(import): check the numbers in each ImportTable row as the service does
@jcshepherd jcshepherd added security release-blocker Must ship for its milestone's release labels Nov 9, 2026
@eliseong eliseong self-assigned this Nov 9, 2026
@eliseong

eliseong commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

@LeeroyHannigan Reviewed so far -- status while this waits on #619.

The core change is good on the backends I ran. Every path that this change
covers refuses an invalid number, and a refused batch or transaction stores
nothing. I ran this on three of the four backends. I could not run the fourth
one here, so it still needs that check.

Three things block a merge.

  1. This change sits on top of fix(core): range check number exponents as DynamoDB does #619, and fix(core): range check number exponents as DynamoDB does #619 now needs changes and a rebase. So
    this one waits for fix(core): range check number exponents as DynamoDB does #619 to land, and then it needs a rebase onto current main.

  2. Two of the number paths now read the exponent a different way on live
    DynamoDB. This change reads the exponent as a 32-bit value on BatchWriteItem,
    TransactWriteItems, and TransactGetItems. I measured each path on live
    DynamoDB, two sends each, with the same answer both times.

    BatchWriteItem still reads the exponent as a 32-bit value, so this change is
    correct for it. TransactWriteItems and TransactGetItems now read the exponent
    as a 64-bit value, the same as PutItem. For those two paths, this change
    gives the wrong message at exponents outside the 32-bit range:

    • 10E2147483647: BatchWriteItem answers Number underflow.
      TransactWriteItems and TransactGetItems answer Number overflow.
    • 1E2147483648: BatchWriteItem answers cannot be converted.
      TransactWriteItems and TransactGetItems answer Number overflow.

    Please keep the 32-bit reader on BatchWriteItem, and move TransactWriteItems
    and TransactGetItems to the 64-bit reader. Then change the test that lists the
    differences so it covers BatchWriteItem only. This behavior is moving on live
    DynamoDB, so please measure all three paths again just before merge.

  3. The rebase onto current main should also clear a MongoDB error that main
    already fixed. Please confirm that after the rebase, and run the MongoDB
    checks again.

One open decision. After this change, an item that was stored under an invalid
number key before the change can no longer be read, updated, or deleted through
the normal paths. Only Scan and a table delete still reach it. The description
notes this. Please decide how a user removes such an item.

I will review again once #619 lands, this change is rebased on current main, the
batch and transaction answers are measured again, and the open decision is
settled.

@pdf-amzn pdf-amzn 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.

needs rebase, I suggest you wait until 619 lands then revisit this PR

@pdf-amzn

Copy link
Copy Markdown
Collaborator

AI generated:

This waits on #619 and a rebase, as @eliseong said. I reviewed the core and engine changes only, not the MongoDB commit (5803642), and skipped what she already raised. I haven't run the tests, since the branch doesn't merge.

Rebase notes. Against main the conflicts are in resolver.rs, import_export.rs, put_item.rs and transact_write_items.rs; against #619's head, number.rs too.

  • number.rs: fix(core): range check number exponents as DynamoDB does #619's zero handling and this PR's check_zero_magnitude give the same answers on the measured rows. Keep one and drop the other's duplicate test rows.
  • resolver.rs and import_export.rs: keep both sides.
  • put_item.rs and transact_write_items.rs: main's new attribute-name-size checks land at the same spot as this PR's number checks, so someone has to pick an order (see the second should-fix).
  • batch_write_item.rs, delete_item.rs and update_item.rs auto-merge, but their order against main's name-size checks needs the same look.

Should-fix: legacy Expected values are not checked. operations::put_item_values (crates/core/src/validation/number/operations.rs:119) and delete_item_values (:99) cover ExpressionAttributeValues only, so Expected[].Value and Expected[].AttributeValueList on PutItem, DeleteItem and UpdateItem still reach the evaluator as written. Either measure and add the checks, or list them in #618 with the Query/Scan inputs that also stay unchecked (KeyConditions, QueryFilter, ScanFilter, ExclusiveStartKey, ExpressionAttributeValues).

Should-fix: order against main's attribute-name-size checks is unmeasured. Every measurement in this PR predates them. After the rebase, PutItem, DeleteItem, UpdateItem, BatchWriteItem and TransactWriteItems each have a new two-fault case (an over-long attribute name plus a malformed number) whose order git picked textually. TransactWriteItems also has the client token against a name-size fault. Measure one two-fault row per operation and add it to tests/rust/src/number_validation_order.rs.

Should-fix: there are now two Java-BigDecimal 32-bit readers, and they disagree. Main's crates/core/src/partiql/number.rs:171 check_number and this PR's validate_number_i32_scale (operations.rs:393) parse the same grammar with the same limits, but PartiQL checks the 38-digit count before the magnitude and accepts any zero whose scale fits, while this PR checks the magnitude first and range-checks zeros. Either the service differs between PartiQL and BatchWriteItem, which needs a measured note in both files, or one of them is wrong. After the rebase, implement it once and keep the per-operation message formatting at the call sites.

Should-fix: import row errors are classified by message text. import_row (operations.rs:281) and arithmetic_operand (crates/core/src/expression/update_evaluator.rs:201) tell "not a number" from "out of range" with message.starts_with(NUMERIC_VALUE). Return an error enum and format at the edge, so a wording change can't silently move a row from skipped to ending the import.

Should-fix: ImportTable now marks any import with row errors FAILED/ItemValidationError (import_export.rs:233), not only number errors. Imports with key-type, nesting, size or name-size errors also change from COMPLETED to FAILED. Only number rows are tested (tests/test_import_export.py:505-680). Add one test with a key-type-mismatch row and no bad numbers, and say so in the PR body.

Should-fix: no Python dual-target tests for the data-plane paths. The new Python tests cover ImportTable only, which runs against ExtendDB only. The key, ExpressionAttributeValues, batch and transaction paths, "a refused batch writes nothing", and the comparison/arithmetic change are covered only by the Rust wire tests. Those are dual-target, but add at least one Python test per message form (no prefix, 1 validation error detected: , the TransactWriteItems ExpressionAttributeValues wrapper) plus the batch-writes-nothing row.

Should-fix: the PR body is stale. It says ImportTable doesn't validate numbers, but 979c750 (#804) does. It says the branch merges cleanly, but it now conflicts in 4 files. It doesn't mention d3a5b1c (#803), which changes comparisons: a stored out-of-range N now makes only <> true (crates/core/src/expression/evaluator.rs:147), where main made every operator false.

Nit-or-follow-up: operations.rs:193-204. transact_write_item names the condition expression values and gates it with values.and(...). put.expression_attribute_values.as_ref().filter(|_| put.condition_expression.is_some()) reads more directly.

Nit-or-follow-up: value_numbers (operations.rs:326) duplicates validate_expression_attribute_value_numbers (crates/core/src/validation/mod.rs:1198). Share one.

Nit-or-follow-up: put_item_item (operations.rs:140) walks the item for numbers and nesting, then validate_put_item walks it again, up to 400 KB. The same goes for the nesting walk in delete_item_values and put_item_values. Pass a flag or drop the later walk.

Nit-or-follow-up: comparison_number (evaluator.rs:147) now validates and normalizes every non-placeholder N in every comparison, so a filtered Scan pays it per item per comparison. Fine as a bound; a benchmark note would help.

Nit-or-follow-up: validate_number_i32_scale allocates format!("{int_part}{frac_part}") (operations.rs:416) only to trim zeros. Count over the two slices instead.

Nit-or-follow-up: the thread-plus-timeout test harness appears three times (eval_within_10_s in evaluator_tests.rs, inline in a_refused_placeholder_is_read_once_per_request, update_n in update_evaluator_tests.rs). Factor it into one helper.

Base automatically changed from fix/616-number-exponent-overflow to main November 10, 2026 20:51
…he wire

The backup-failure note said DeleteItem deletes an item stored under an
invalid number key. On this branch every write that names such a key is
refused for the key number. So the item cannot be rewritten or deleted
through the wire. #982 tracks a way to delete it.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

Pushed 0daa2b8..7527dcd. This push merges current main (511d6c7) and fixes the TransactWriteItems crash.

@eliseong 8b2504f fixes the crash. The per-action number check now runs before prepare_write_op, the way BatchWriteItem already does it. So the item is never sized while it holds a number the service cannot read. A Put with 1E9223372036854775807 now answers Number overflow. A Put with 1E-9223372036854775808 answers Number underflow. The server stays up. I measured both on the service and on a local SQLite build on 2026-11-12, each value six times.

Within an action the service answers a number ahead of the action's other faults. The reorder matches that. The same holds beside a missing table, a syntax error, an unused value, an empty key, a key update or an oversize item. Each went out six times on 2026-11-12. The number_validation_order and number_validation_all_ops suites carry these as new cases.

BatchWriteItem keeps the 64-bit reader, as you asked.

The docs said DeleteItem deletes an item stored under an invalid number key. On this branch every write that names such a key is refused for the key number. So the item cannot be deleted through the wire. 7527dcd updates both docs. #982 tracks how to delete such an item.

@pdf-amzn The re-merge had one conflict, in batch_write_item.rs. The number check stays after the attribute name size checks and before the table lookups, where #475 moved the table reads into write_batch.

eliseong
eliseong previously approved these changes Nov 12, 2026

@eliseong eliseong 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.

LGTM

The TransactWriteItems Put that ended the server is fixed. Each action's numbers
are now checked before the item is sized, the same as BatchWriteItem. I
confirmed on a debug build: a Put with 1E9223372036854775807 or
1E-9223372036854775808 now answers Number overflow or Number underflow and the
server stays up, as a plain attribute, nested in a list and a map, and as the
sort key. A valid Put still writes.

BatchWriteItem reads the exponent in 64 bits, the same as PutItem,
TransactWriteItems and TransactGetItems: a positive out-of-range exponent is
Number overflow and a negative one is Number underflow. That is the correct
answer and it is deterministic in the local tests.

The branch is rebased on current main and merges clean.

The merge of main dropped the _write_batch, _write_transact,
_write_update and _write_import helpers and the WRITE_PATHS map from
test_backup_job.py. It kept the tests that call them. The backup suite
then failed with NameError: name '_write_batch' is not defined, which
is why every job that runs the backup suite went red.

This takes main's test_backup_job.py whole. Main's backup suite is
newer, and its parametrized write-path tests cover the one older branch
test they replace. #620 does not change backup behaviour and adds
nothing to this file.
A merge took main's test_backup_job.py, which seeds the #618 items through
BatchWriteItem, TransactWriteItems, UpdateItem and ImportTable. This branch
refuses those writes, so the setup raised ValidationException and the backup
tests failed. Seed the items into storage, as this branch did before the merge,
and keep the new migrate-legacy tests.

Verified on SQLite (5 target tests pass) and on MongoDB (tests/test_backup_job.py:
28 passed, 18 skipped, 0 failed).
@jcshepherd jcshepherd self-assigned this Nov 13, 2026

@jcshepherd jcshepherd 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.

Okay. A few minor comment inconsistencies but not holding it up for that.

@jcshepherd
jcshepherd added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 3a5c84b Nov 13, 2026
64 checks passed
@jcshepherd
jcshepherd deleted the fix/618-number-validation-all-ops branch November 13, 2026 04:51
LeeroyHannigan added a commit that referenced this pull request Nov 13, 2026
This commit merges main at 3a5c84b (#620), four commits past
ce3a51a. #620 adds number checks on the key, item and value paths.
Five files conflicted with the #399 commits that this branch carries.

crates/core/src/expression/mod.rs: both sides added a module. The merge
keeps the #399 semantics module and the test_timeout module from main.

crates/core/src/expression/evaluator.rs: both sides added a function
after placeholder_numeric. The merge keeps compare_orderable from #399
and comparison_number from main.

crates/engine/src/put_item.rs and crates/engine/src/delete_item.rs: main
added the ExpressionAttributeValues and Expected number checks above the
validate_expression_param_usage call. #399 added a comment about that
call in the same place. The merge puts the number checks first, then
the #399 comment and the call that it describes.

crates/engine/src/transact_write_items.rs: main moved the client request
token check to the start. On main, the handler also checks the numbers
of each action before it prepares that action. #399 checks the items in
phases, and phase 1 checks each item without a table lookup. The token
check stays at the start. The number check moves into phase 1, after
the attribute name sizes and before the item size. ExtendDB still does
not size a Put item that holds a number the service cannot read. A
number in a later action now comes before a missing table in an earlier
action. #620 measured that order on the service. The phase list in the
comment names the number check. The duplicate check stays after the key
pass, as in #399.

Signed-off-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
LeeroyHannigan added a commit that referenced this pull request Nov 13, 2026
validate_legacy_number called validate_attribute_number and matched the
text it gives for an empty number, to add the separator. #620, now in
main, added attribute_numbers(EmptyText::WithColon, ..) to
crates/core/src/validation/number/operations.rs. That function gives
the text with the separator for an empty number in N or NS, and inside
L and M.

validate_legacy_condition now calls condition_values, a new pub function
in operations.rs that runs attribute_numbers on each value in the list.
This commit removes validate_legacy_number. validate_attribute_number
is private again, as it is on main, because the engine no longer calls
it.

ExtendDB's answers do not change. The engine unit tests and
tests/test_legacy_condition_parity.py pass with no change to the tests.
That includes the empty number rows in N, NS, L, M and an M in an L.

Signed-off-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
LeeroyHannigan added a commit that referenced this pull request Nov 14, 2026
Main (#620) added number_value, which reads a number from the text the number check normalizes, at most 170 characters. Parsing the text as written takes time quadratic in its length, and a request body can carry 16 MiB. compare_orderable, which the legacy BETWEEN bound check calls for ScanFilter, QueryFilter and KeyConditions, still parsed both bounds as written. It now reads them with number_value, as comparison_number does.

For a number the check accepts, the value and the answer do not change. For a bound that the check refuses, compare_orderable now returns None, as it did for a value that is not a number. The range check then does not refuse the request. A new test in evaluator_tests.rs sits beside the test that #620 added. It checks that a bound of 1 with two million trailing zeros compares equal to 1 within 10 seconds.

The phase comments in transact_write_items.rs and transact_get_items.rs now say where the number checks from main run. TransactWriteItems checks the ExpressionAttributeValues of a Put or Delete only with a ConditionExpression. TransactGetItems checks the numbers of each key in its first loop.
LeeroyHannigan added a commit that referenced this pull request Nov 14, 2026
Main (#620) added number_value, which reads a number from the text the number check normalizes, at most 170 characters. Parsing the text as written takes time quadratic in its length, and a request body can carry 16 MiB. compare_orderable, which the legacy BETWEEN bound check calls for ScanFilter, QueryFilter and KeyConditions, still parsed both bounds as written. It now reads them with number_value, as comparison_number does.

For a number the check accepts, the value and the answer do not change. For a bound that the check refuses, compare_orderable now returns None, as it did for a value that is not a number. The range check then does not refuse the request. A new test in evaluator_tests.rs sits beside the test that #620 added. It checks that a bound of 1 with two million trailing zeros compares equal to 1 within 10 seconds.

The phase comments in transact_write_items.rs and transact_get_items.rs now say where the number checks from main run. TransactWriteItems checks the ExpressionAttributeValues of a Put or Delete only with a ConditionExpression. TransactGetItems checks the numbers of each key in its first loop.
LeeroyHannigan added a commit that referenced this pull request Nov 16, 2026
…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.
robinnsc added a commit that referenced this pull request Nov 18, 2026
Moves the workspace version from 0.1.15 to 1.0.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 14
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (version and the five platform pins), the
four licence-notice files (regenerated with cargo-about 0.9.0), and the
example `extenddb version` and `serve` output in docs/getting-started.md
and docs/manuals/04-quickstart-setup-guide.md.

RELEASED_THROUGH stays 12: migration 12 is still the last one, so 1.0.0
carries the catalog of 0.1.15 and freezes nothing new.

Upgrade manual:

- Behavior Changes by Release gets a v1.0.0 entry for #945: the
  Cassandra backend reads and writes at LOCAL_QUORUM where 0.1.15 ran
  many of them at ONE, so a request fails with HTTP 500 while fewer
  than a quorum of its keyspace's replicas are up. It says what to do
  before upgrading: a replication factor of 3, as cassandra-setup.md
  describes.
- Current Status, the General Upgrade Procedure and the Rollback
  Procedure cover 0.1.15 to 1.0.0, with that Cassandra step. Current
  Status says which of its paragraphs are for 0.1.14 and earlier and
  that the backup store notes apply to every deployment.
- A v0.1.15 entry for the request validation of #619, #620, #830 and
  #1000, which had none. It says the expression depth limit is
  ExtendDB's own.
- The rollback to 0.1.14 or earlier states what a binary of those
  releases does on a migrated catalog, as measured on PostgreSQL with
  0.1.14 and 0.1.10: exit status 1, "invalid catalog version '12'".

docs/versioning.md: the 0.1.x releases get no more fixes. The Docker Hub
pages name 0.1.15 as the first keyless-signed release.
docker/README-mongodb.md ran extenddb/extenddb-mongodb:0.1.8; it now
runs X.Y.Z, as the other image READMEs do.

doc_version_literals now reads docker/ as well, so a stale image tag
there fails it. It reports each image tag once, and skips another
project's image tag and a link to a release. The npm launcher test now
checks that the launcher refuses the release line before an X.0.0
launcher, which it skipped at patch 0.

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

RELEASED_THROUGH stays 12: migration 12 is still the last one, so 1.0.0
carries the catalog of 0.1.15 and freezes nothing new.

Upgrade manual:

- Behavior Changes by Release gets a v1.0.0 entry for #945: the
  Cassandra backend reads and writes at LOCAL_QUORUM where 0.1.15 ran
  many of them at ONE, so a request fails with HTTP 500 while fewer
  than a quorum of its keyspace's replicas are up. It says what to do
  before upgrading: a replication factor of 3, as cassandra-setup.md
  describes.
- A v1.0.0 entry for #1003. Without key_file the stored format and the
  catalog key stay as they are, and 0.1.15 and 1.0.0 each read the
  access keys the other wrote. serve and the backup commands refuse a
  catalog key that is not 32 bytes in base64, where 0.1.15 started and
  failed every signed request with HTTP 500; the entry says how to
  check the key before upgrading. The key moves into a locked key
  store, with a warning when the memlock limit is too low. key_file and
  the encryption-key commands are opt-in and link to the admin guide.
- The rollback section of #1003 now gives the PostgreSQL refusal of
  0.1.15 on a switched catalog: the encrypted connection string row
  stops it with exit status 1 before the missing key does.
- Current Status, the General Upgrade Procedure and the Rollback
  Procedure cover 0.1.15 to 1.0.0, with the Cassandra step, the key
  check, and the rollback after encryption-key switch. Current Status
  says which of its paragraphs are for 0.1.14 and earlier and that the
  backup store notes apply to every deployment.
- A v0.1.15 entry for the request validation of #619, #620, #830 and
  #1000, which had none. It says the expression depth limit is
  ExtendDB's own.
- The rollback to 0.1.14 or earlier states what a binary of those
  releases does on a migrated catalog, as measured on PostgreSQL with
  0.1.14 and 0.1.10: exit status 1, "invalid catalog version '12'".

docs/versioning.md: the 0.1.x releases get no more fixes. The Docker Hub
pages name 0.1.15 as the first keyless-signed release.
docker/README-mongodb.md ran extenddb/extenddb-mongodb:0.1.8; it now
runs X.Y.Z, as the other image READMEs do.

doc_version_literals now reads docker/ as well, so a stale image tag
there fails it. It reports each image tag once, and skips another
project's image tag and a link to a release. The npm launcher test now
checks that the launcher refuses the release line before an X.0.0
launcher, which it skipped at patch 0.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
LeeroyHannigan added a commit that referenced this pull request Nov 18, 2026
docs/manuals/07-upgrade-manual.md keeps the v0.1.15 entry that main adds for the request validation of #619, #620, #830 and #1000. The ClientRequestToken entry of this branch follows it.
amrith pushed a commit to amrith/extenddb that referenced this pull request Nov 20, 2026
Moves the workspace version from 0.1.15 to 1.0.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 14
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (version and the five platform pins), the
four licence-notice files (regenerated with cargo-about 0.9.0), and the
example `extenddb version` and `serve` output in docs/getting-started.md
and docs/manuals/04-quickstart-setup-guide.md.

RELEASED_THROUGH stays 12: migration 12 is still the last one, so 1.0.0
carries the catalog of 0.1.15 and freezes nothing new.

Upgrade manual:

- Behavior Changes by Release gets a v1.0.0 entry for ExtendDB#945: the
  Cassandra backend reads and writes at LOCAL_QUORUM where 0.1.15 ran
  many of them at ONE, so a request fails with HTTP 500 while fewer
  than a quorum of its keyspace's replicas are up. It says what to do
  before upgrading: a replication factor of 3, as cassandra-setup.md
  describes.
- A v1.0.0 entry for ExtendDB#1003. Without key_file the stored format and the
  catalog key stay as they are, and 0.1.15 and 1.0.0 each read the
  access keys the other wrote. serve and the backup commands refuse a
  catalog key that is not 32 bytes in base64, where 0.1.15 started and
  failed every signed request with HTTP 500; the entry says how to
  check the key before upgrading. The key moves into a locked key
  store, with a warning when the memlock limit is too low. key_file and
  the encryption-key commands are opt-in and link to the admin guide.
- The rollback section of ExtendDB#1003 now gives the PostgreSQL refusal of
  0.1.15 on a switched catalog: the encrypted connection string row
  stops it with exit status 1 before the missing key does.
- Current Status, the General Upgrade Procedure and the Rollback
  Procedure cover 0.1.15 to 1.0.0, with the Cassandra step, the key
  check, and the rollback after encryption-key switch. Current Status
  says which of its paragraphs are for 0.1.14 and earlier and that the
  backup store notes apply to every deployment.
- A v0.1.15 entry for the request validation of ExtendDB#619, ExtendDB#620, ExtendDB#830 and
  ExtendDB#1000, which had none. It says the expression depth limit is
  ExtendDB's own.
- The rollback to 0.1.14 or earlier states what a binary of those
  releases does on a migrated catalog, as measured on PostgreSQL with
  0.1.14 and 0.1.10: exit status 1, "invalid catalog version '12'".

docs/versioning.md: the 0.1.x releases get no more fixes. The Docker Hub
pages name 0.1.15 as the first keyless-signed release.
docker/README-mongodb.md ran extenddb/extenddb-mongodb:0.1.8; it now
runs X.Y.Z, as the other image READMEs do.

doc_version_literals now reads docker/ as well, so a stale image tag
there fails it. It reports each image tag once, and skips another
project's image tag and a link to a release. The npm launcher test now
checks that the launcher refuses the release line before an X.0.0
launcher, which it skipped at patch 0.

Signed-off-by: Scott Robinson <robinnsc@amazon.com>
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
This branch changes two ImportTable answers that an existing client can
see. A file of lines without an Item member imported its lines, and now
it imports nothing. A file with a line the import cannot read answered
HTTP 400 and left the new table empty. Now the request answers HTTP 200
with ImportStatus FAILED, and the items before the line stay imported.

The upgrade manual gets a v1.1.0 entry for both changes, as the earlier
ImportTable change of #620 has an entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-blocker Must ship for its milestone's release security v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants