Repository navigation
fix(engine): refuse ProjectionType and StreamViewType outside their sets - #1110
LeeroyHannigan wants to merge 12 commits into
Conversation
CreateTable and UpdateTable answered a ProjectionType or StreamViewType outside its set with SerializationException and the deserializer's text. DynamoDB answers ValidationException with the enum text, the member path and the set in its own order. On UpdateTable it answers before the table lookup. Measured in us-east-1 on 13, 14 and 17 Nov 2026. ExtendDB now records each such member before the read and gives it the first value of its set. The read then goes on past it. Every read error is still answered first, so a member that the typed read refuses gets SerializationException, as on DynamoDB. Then ExtendDB refuses the recorded members in one message, in DynamoDB's order. The typed read takes a JSON array in place of a structure (#1106). A body with such an array and a refused member gets the ValidationException, where DynamoDB answers SerializationException. UpdateTable now reads ReplicaUpdates as a list, so a value of another type is refused with SerializationException, as on DynamoDB. A list is still accepted and not acted on. Fixes #1051.
Each row of the two row tables had one refused member. No test saw the order of two recorded faults or the "2 validation errors detected" envelope. Add the five two-fault rows measured on 17 Nov 2026. On CreateTable the faults are in two GSIs, in a GSI and the stream view type, and in a GSI and an LSI. On UpdateTable of a missing table they are in a GSI Create and the stream view type, and in two GSI Creates. Each row expects DynamoDB's text by equality. The row test runs only with the partiql feature, which is on by default. A comment on its module declaration now says so.
DynamoDB answers SerializationException to an UpdateTable whose ReplicaUpdates list holds a string (measured 25 Nov 2026, us-east-1). UpdateTableInput read each element as any JSON value, so ExtendDB accepted the list and answered the "At least one of" text. Now it reads each element as a JSON object, the element type that #1262 gives the same member, and the read refuses the string.
demohan
left a comment
There was a problem hiding this comment.
ProjectionType and StreamViewType outside their sets get the service's text, path and set order at e5301b0. With 158 rows sent twice to us-east-1 and to this head, main and this head merged into main on SQLite and PostgreSQL, every target answered alike both rounds and the backends agree on every row: lowercase, empty, unknown and trailing-space values and several faults at once match the service, wrong JSON types still answer SerializationException, the new ReplicaUpdates read refuses what the service refuses, and a refused UpdateTable on an existing table leaves no stream and no GSI. Tables main created with every ProjectionType and StreamViewType still describe, query, update and delete on the merged build. Nine of ten controls fail as they should, the Python test passes 21 of 21 here and fails 17 of 21 on main, and fmt, clippy, the 1.91.1 check and the tests are clean; the red wasm check is main's, since fixed. The branch now conflicts with main at 222d80a in partiql/test_context.rs:33; taking main's version as pub(crate) passes fmt, clippy, the 1.94.0 check, the wasm build and clippy, and the core and engine tests.
I will approve once a wrong-shape member beside a refused enum answers SerializationException as on main (here or by landing after #1106), the message lists at most ten faults, and a test holds the stream view type ahead of the LSIs.
| let constraint = crate::enum_constraint(valid); | ||
| self.0.push((sent.to_owned(), path, constraint)); | ||
| *value = Value::from(valid[0]); | ||
| } |
There was a problem hiding this comment.
Replacing the refused value before the request is read lets the reader accept a JSON array where a structure belongs (#1106), so the wrong-shape member is no longer caught: on 10 shapes, such as a GSI ProjectionType all with Tags: [["k","v"]], KeySchema: [["pk","HASH"]] or SSESpecification: [true], and an UpdateTable stream view type x with ProvisionedThroughput: [1,1], the service and main answer SerializationException and this head the enum ValidationException. The body says so; fixing #1106 first, or reading the request before replacing the value, would keep main's answer.
There was a problem hiding this comment.
Fixed in 87e5eaf, in crates/engine/src/nested_enums.rs. When EnumFaults replaces a refused value, it now refuses these members with SerializationException, as DynamoDB and main do:
- a structure that is not a JSON object
- an element of a list of structures that is not an object
- an enum written as an object
A body with no refused value reads as before, and the rest of #1106 stays with that issue.
The rows hold the six bodies of the 18 Nov comment on #1106. They also hold two shapes from your list, KeySchema: [["pk","HASH"]] and SSESpecification: [true], beside a GSI ProjectionType of EVERY_ATTRIBUTE. Five more rows are UpdateTable bodies that DynamoDB answered with SerializationException on 2 Dec 2026, each twice. Beside a stream view type x the bodies carry ProvisionedThroughput: [1,1], SSESpecification: [true], BillingMode: {"PROVISIONED": null}, or a GSI Create with ProjectionType: {"ALL": null}. The fifth body has AttributeDefinitions: [["g","S"]] beside a GSI Create with ALL_ATTRIBUTES.
| .iter() | ||
| .map(|(value, path, constraint)| (value.as_str(), path.as_str(), constraint.as_str())) | ||
| .collect(); | ||
| let message = validation_errors(&faults); |
There was a problem hiding this comment.
With 12 refused GSI ProjectionTypes, the service answers 10 validation errors detected and lists ten; this lists all twelve. The PartiQL checks already cap at ten. Separately, the service lists the stream view type ahead of the LSIs on a two-fault CreateTable too (LSI keys_only with stream new_image), not only on four-fault rows as the body says, and this head matches; with those two lines swapped the row test still passes, so a row for it would hold the order.
There was a problem hiding this comment.
Both are in 9efe6a0, with the formatting in 8d1c0d2.
EnumFaults::checklists the first ten faults (MAX_FAULTSincrates/engine/src/nested_enums.rs). On 2 Dec 2026 DynamoDB answered twelve refused GSICreateentries with10 validation errors detectedand the first ten, twice. The rowut-twelve-gsi-createsand its Rust twin hold that answer. With the oldcheck, the Rust row test fails on that row.- The row
ct-lsi-streamsends your two-fault CreateTable, an LSIkeys_onlywith a streamnew_image, and expects the stream view type first. With the two lines ofEnumFaults::create_tableswapped, the Rust row test now fails on that row. The body's sentence about the four-fault rows is gone.
The PartiQL checks keep their cap in MAX_PARTS, in a module behind the partiql feature, so nested_enums.rs has its own MAX_FAULTS.
After EnumFaults replaces a refused ProjectionType or StreamViewType, the typed read no longer stops at that value. It then takes a structure written as a JSON array and an enum written as a JSON object (#1106). DynamoDB and origin/main answer such a body with SerializationException. When the record replaced a value, it now refuses these members with SerializationException: - a structure that is not a JSON object - an element of a list of structures that is not an object - an enum that is an object A body with no refused value reads as before, and the rest of #1106 stays open. The rows hold the six bodies of the 18 Nov 2026 comment on #1106. They also hold two CreateTable bodies of the same kind (measured 30 Nov 2026) and five UpdateTable bodies (measured 2 Dec 2026).
DynamoDB lists the first ten faults of a refused body, and its count then says 10. It answered so on 2 Dec 2026 to twelve refused GSI Creates. EnumFaults listed all of them. Also add a CreateTable row with an LSI fault and a stream view type fault. DynamoDB lists the stream view type first.
cargo fmt wraps the rows that list ten faults and the row with an LSI fault and a stream view type fault.
|
@demohan The replies in the two threads cover the three points of the review. The branch conflicted with main in |
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 8d1c0d2. 1 finding: 1 Docs.
The change makes CreateTable and UpdateTable answer a ValidationException for a ProjectionType or StreamViewType outside its set, records the faults before the typed read, lists at most ten, and reads ReplicaUpdates as a list of objects. Confirmed: of 21 requests sent to DynamoDB (us-east-1) and to this head on SQLite, a refused projection with duplicate index names, a refused view type with StreamEnabled false, a refused view type in UpdateTable on a missing table, and an enum or structure of the wrong JSON type beside a refused value returned the same status and exception type (and the same text for the first three). With the ten-fault cap, the wrong-type refusal or the list constants removed, refused_enum_members fails each time (12 faults listed instead of 10 at nested_enums_tests.rs:322; failures at :325). Engine (979 lib), the 36-test pytest file, and engine (981) plus core (1259) on the head merged with current main pass.
- Docs
docs/manuals/07-upgrade-manual.md:385— The PR's own Breaking changes text is not in the upgrade manual's Behavior Changes by Release.
Docs — outside the diff
docs/manuals/07-upgrade-manual.md:385
Docs
The body lists two client-visible changes under Breaking changes: a refused ProjectionType/StreamViewType now answers ValidationException instead of SerializationException, and a non-list-of-objects ReplicaUpdates is refused. docs/manuals/07-upgrade-manual.md (section starting at line 385) has no entry, and the PR changes no file under docs/.
Fix: add one entry there with those two lines.
Evidence: git diff 01556cf..8d1c0d2 --stat -- docs prints nothing.
Main is at c8e66fb, six commits past 01556cf: #481, #1137, #1403, #1465, #1515 and #1411. #1403 and #1411 add v1.2.0 entries at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, where the entry of this branch goes next. The merge has no conflict. Git merged crates/core/src/types/table.rs and crates/engine/src/lib.rs at other lines. In table.rs, main changes the members of a DELETING table in TableDescription, and this branch adds the ReplicaUpdates member of UpdateTableInput. In lib.rs, main declares a test module, and this branch declares nested_enums and adds enum_constraint. The lines that this branch changes are the same before and after the merge.
Add a v1.2.0 entry at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, above the entries of main. It gives the two changes that a client sees. A ProjectionType or StreamViewType outside its set gets ValidationException in place of SerializationException. UpdateTable refuses a ReplicaUpdates value that is neither null nor a list of JSON objects.
Add a v1.2.0 entry at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, above the entry of #1110. It gives the SSESpecification values that CreateTable now refuses and the TableClass refusal of CreateTable and UpdateTable, with the texts of DynamoDB. It also gives the read of an Enabled string.
The base merges main at c8e66fb, which brings #481, #1137, #1403, #1465, #1515 and #1411, and adds the v1.2.0 entries of #1110 and #1114 to docs/manuals/07-upgrade-manual.md. The merge has no conflict. Git merged two files at other lines. In crates/core/src/types/table.rs, main changes the members of a DELETING table in TableDescription, and this branch changes the doc comment of the SSESpecification member of UpdateTableInput. In crates/storage-mongodb/src/table_engine.rs, main makes the creation time of a table description optional, and this branch records the specification in update_table.
|
@LJMart11 Docs, Before the entry, 4a91f04 merges main at c8e66fb with no conflict, so the entry sits above the v1.2.0 entries of #1411 and #1403. |
Main is at c057660, one PR after the last merge of main into this branch. #1446 added its v1.2.0 entry at the top of Behavior Changes by Release in docs/manuals/07-upgrade-manual.md, where this branch had its entry. The merge keeps main's entries in main's order and puts the entry of this branch after main's v1.2.0 entries. Main adds each new entry at the top, so the entry no longer conflicts with the next one.
LJMart11
left a comment
There was a problem hiding this comment.
Checked at 2792dee against the list from 8d1c0d2.
The follow-up merges main into the branch and adds the upgrade-manual entry for the new ValidationException answers. The head is the merge with the current base tip. On it, extenddb-core (1260 passed, 1 ignored) and extenddb-engine (982 passed) tests pass under 1.94.0, including nested_enums::tests::refused_enum_members. Replacing the wrong-JSON-type check in EnumFaults::member_types with a pass-through makes that test fail on a CreateTable row, so the guard is pinned. docs/manuals/07-upgrade-manual.md:419-426 now lists both client-visible changes.
Previous items: 3 fixed.
Main is at 5826e1b, three commits past c057660: #1531, #1466 and #1087. In docs/manuals/07-upgrade-manual.md, #1531 adds a v1.2.0 entry at the top of "Behavior Changes by Release", and git merged it with no conflict. #1087 adds its v1.2.0 entry after the other v1.2.0 entries of main, where this branch has its entry. That is the one conflict. The merge keeps both entries without change: the entry of #1087 first, then the entry of this branch, before the v1.1.0 entries. No other file has changes on both sides.
|
Checked at Fixed:
Disputed: none. Needs-human: none. |
Changes since the last review
docs/manuals/07-upgrade-manual.md, fix(storage-cassandra): retry a lost UpdateItem version check over the PutItem and DeleteItem window #1531 adds a v1.2.0 entry at the top of "Behavior Changes by Release", and git merged it with no conflict. fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 adds its v1.2.0 entry after the other v1.2.0 entries of main, where this PR has its entry. That is the one conflict. The merge keeps both entries without change: the entry of fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 first, then the entry of this PR, above the v1.1.0 entries. No other file has changes on both sides, and the lines that this PR changes against main are the same before and after the merge. The gates on 7dfc63b:cargo +1.97.0 fmt --all -- --checkis clean. The two clippy commands of.github/workflows/clippy.ymlwith-D warnings, on the whole workspace as CI runs them, are clean.extenddb-core1260 passed and 1 ignored,extenddb-engine982,extenddb-storage-mongodb197 and 86 ignored (on a replica set),extenddb-storage-cassandra194,extenddb-storage-postgres94.cargo test -p extenddb-wasm-adapterpasses, with itsparitycorpus test.cargo test -p extenddb-storage-postgres --test doc_version_literalspasses.tests/test_table_enum_members.pypassed 36 tests on each.python3 -m pytest --collect-only -qcollects 7377 tests intests/and 820 intests/pythonwith no error.crates/core/src/types/table.rsandcrates/engine/src/lib.rsat other lines. The lines that this PR changes are the same before and after the merge.docs/manuals/07-upgrade-manual.md, above the entries of main. The entry is "aProjectionTypeorStreamViewTypeoutside its set getsValidationException, and UpdateTable readsReplicaUpdates". It gives the two changes of the Breaking changes section.cargo +1.97.0 fmt --all -- --checkis clean. The core lib and integration tests give 1260 passed and 1 ignored, and the engine lib tests 982 passed.cargo +1.94.0 check, the wasm-adapter tests, the WebAssembly clippy step and the testdoc_version_literalspass, as the body of fix(engine): read SSESpecification in UpdateTable #1126 lists them.What
CreateTable and UpdateTable now refuse a
ProjectionTypeor aStreamViewTypeoutside its set with DynamoDB'sValidationExceptiontext, where ExtendDB answeredSerializationException. The message names each refused member at its path, for example1 validation error detected: Value 'EVERY_ATTRIBUTE' at 'globalSecondaryIndexes.1.member.projection.projectionType' failed to satisfy constraint: Member must satisfy enum value set: [ALL, INCLUDE, KEYS_ONLY]. UpdateTable answers before the table lookup, so a refused request leaves an existing table without a stream.EnumFaults(crates/engine/src/nested_enums.rs) records these members before ExtendDB reads the request. It puts the first value of the set in place of each refused value, so the read continues. A read error still answers first. A member of the wrong JSON type getsSerializationException, as on DynamoDB, and aKeyTypeoutside its set gets theValidationExceptionof its reader (#1109). After the read, the record answers in DynamoDB's order: on CreateTable the GSIs, thenstreamViewType, then the LSIs, and on UpdateTable theCreateentries, thenstreamViewType. It lists the first ten faults, and its count then says 10.extenddb_core::error::validation_errorswrites the envelope. The constraint text moves out ofvalidate_enum_fieldsintoenum_constraint, which both callers use.The typed read takes a structure written as a JSON array and an enum written as a JSON object (#1106). So when
EnumFaultsreplaced a value, it refuses such a member itself withSerializationException, as DynamoDB does. The members are the structures, the lists of structures and the enums of a CreateTable or UpdateTable body, at any depth. A body with no refused value goes to the typed read as before, and the rest of #1106 stays with that issue.UpdateTableInputnow readsReplicaUpdatesas a list of JSON objects. A value that is not such a list, such as"x"or["x"], fails the read and answersSerializationExceptionahead of the record, as on DynamoDB. ExtendDB accepts a list of objects and does not act on it, as before.The
BillingMode,TableThroughputMode, nullStreamEnabledand table name checks keep their places.The PartiQL request checks cap their faults at ten too, in
MAX_PARTS. That module is behind thepartiqlfeature, sonested_enums.rshas its ownMAX_FAULTS.The message of 454c768 says that "a member that the typed read refuses gets SerializationException". The
KeyTypereader refuses with aValidationExceptionof its own, as this section says. Whoever merges: please use the What section of this body as the squash message.Why
These are DynamoDB's answers, measured in us-east-1. DynamoDB answered the rows of the issue on 13 and 14 November 2026. On 17 November 2026, 172 requests on these members went out twice each, with the same answer both times. ExtendDB at 454c768 gives DynamoDB's answer on 104 of them, and origin/main on 38. Each of the 172 requests that origin/main answered as DynamoDB keeps its answer. The only one of the 172 with
ReplicaUpdatessends a string, which both element types refuse. On 25 November 2026, DynamoDB answered"ReplicaUpdates": ["x"]withSerializationExceptiontwice.On 18 November 2026, six bodies had a refused enum value and a member of the wrong JSON type. DynamoDB answered each with
SerializationException, twice (the comment on #1106). On 2 December 2026, five more UpdateTable bodies of that kind gotSerializationException, twice each. On the same day, UpdateTable with twelve refused GSICreateentries got10 validation errors detectedand the first ten faults, twice.Closes #1051
Testing done
cargo +1.97.0 test -p extenddb-enginepassed 979 lib tests and 1 integration test.cargo +1.97.0 test -p extenddb-corepassed 1245 tests, with 2 ignored, in its lib, integration and doc tests.cargo +1.97.0 test -p extenddb-wasm-adapterpassed its 3 unit tests and theparitycorpus test.cargo +1.97.0 clippy --all-targets -- -D warningsonextenddb-coreandextenddb-enginewith--features extenddb-engine/backup-test-hooksis clean. So is the same command on the four storage crates with--features extenddb-storage-cassandra/test-hooks,extenddb-storage-mongodb/test-hooks, andcargo +1.94.0 check --all-targetson the core and the engine. The clippy step of the WebAssembly workflow is clean on this branch.tests/test_table_enum_members.pysends the issue's rows and the rows with two refused members. It also sends the rows with a member of the wrong JSON type, with and without a refused value. It also sends the twelve GSICreateentries. After the refused UpdateTable of an existing table, the same UpdateTable withNEW_IMAGEenables one stream, which ListStreams reports. Against ExtendDB on SQLite, built from 8d1c0d2, this file passed 36 tests. The two Python suites collect with no error.ReplicaUpdateselement type, it fails on the["x"]row. With the production files of 0a3e466, it fails on the first row with a wrong JSON type beside a refused value. Without the cap of ten, it fails on the twelveCreateentries.Line counts: production +207 -6, tests +623 -1. The five lines that declare the row test module count as tests. The round of 2 December: production +97 -6, tests +149 -5. This round adds 9 lines to the upgrade manual.
Other open PRs:
crates/engine/src/partiql/mod.rsandcrates/engine/src/partiql/test_context.rs, so the two PRs merge in either order.crates/engine/src/create_table.rs. fix(tagging): validate tag keys and values against the service grammar #485 reads the CreateTable body earlier, ahead of the table name and tag checks. The resolution records the enum members before that read and checks them after it.crates/core/src/types/table.rs,crates/engine/src/create_table.rs,crates/engine/src/update_table.rs,crates/storage-cassandra/tests/direct/index.rs,crates/storage-cassandra/tests/ttl_integration.rs,crates/storage-mongodb/src/backup_live_tests.rsandcrates/storage-postgres/tests/vector_control_plane.rs. The two PRs add the same field,UpdateTableInput.replica_updates, with the same type, and the samereplica_updates: Noneline in the four test files. The PR that merges second drops its copy of these lines. In the two handlers the resolution keeps the enum record and check of this PR beside the nullTableNamehandling and the read of fix(engine): answer a missing TableName, Key or Item as DynamoDB does #1262.docs/manuals/07-upgrade-manual.md, above the v1.1.0 entries. Other open PRs add their entries at the same place. Whichever PR merges second keeps both entries.git merge-treecompared 7dfc63b and main with each of the 221 open PRs.Not in this PR, each with origin/main's answer: DynamoDB lists
BillingMode,TableThroughputModeand a nullStreamEnabledwith these faults in one message. It answers a member of the wrong JSON type ahead of them, and a table name of a bad length first. #1109 lists those requests. A body with no refused value still reads a structure written as a JSON array or an enum written as a JSON object without error. DynamoDB answersSerializationException(#1106).Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
A client that sends CreateTable or UpdateTable with a
ProjectionTypeor aStreamViewTypeoutside its set getsValidationExceptionwith DynamoDB's text, where it gotSerializationException. An UpdateTable with aReplicaUpdatesvalue that is not a list of JSON objects getsSerializationException. The previous release did not read the member. The v1.2.0 entry ofdocs/manuals/07-upgrade-manual.mdgives both changes.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.