Skip to content

fix(core): list the pattern clause for an empty name member - #1228

Merged
LeeroyHannigan merged 9 commits into
mainfrom
fix/1135-empty-name-pattern
Dec 4, 2026
Merged

LeeroyHannigan merged 9 commits into
mainfrom
fix/1135-empty-name-pattern

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the review at 8e16e4d20

  • 268cc3dca2 merges main at e8b5f109c. fix(core): count an index name in characters and report its member path #1137 is now in main as one squashed commit, so the merge takes its change from main. After the merge, the branch differs from main only by the change of this PR. The merge needed no hand edits.
  • 2f9f5c7ed6 updates one case of the WebAssembly parity corpus, at crates/wasm-adapter/parity/corpus.json lines 4411 to 4420. The case sends ListBackups with a table ARN whose table segment is empty. The WebAssembly build now answers it with both clauses. The case now expects that answer, and its name says so.
  • The description gives the test counts at the new head, names the corpus case and reports a dry merge with the current main.

What

CreateTable and UpdateTable refused an empty IndexName with the length clause alone. DynamoDB lists two clauses for it: the name is shorter than 3 characters, and it does not match [a-zA-Z0-9_.-]+, which needs one character. validate_name_member in crates/core/src/validation/mod.rs, which #1137 added, now treats an empty value as outside the pattern.

The other members that use validate_name_member change the same way: the vector index names of CreateTable and UpdateTable, the TableName and BackupName of CreateBackup, and the TableName of ListBackups. check_table_name in crates/engine/src/backup_requests/pitr.rs had a branch of its own that wrote the two clauses for an empty TableName. This change deletes the branch, its constant and its doc sentences, since validate_name_member now gives the same text.

#1137, now in main, added validate_name_member and the member paths.

Why

DynamoDB's answers for an empty value, measured in us-east-1 on 18 and 20 November 2026. Each request was sent twice. DynamoDB listed the two clauses in either order from one send to the next. The wire tests accept both orders.

Request Member path DynamoDB ExtendDB before this change
CreateTable, one GSI globalSecondaryIndexes.1.member.indexName both clauses the length clause
CreateTable, one LSI localSecondaryIndexes.1.member.indexName both clauses the length clause
UpdateTable, a GSI Create, Update or Delete globalSecondaryIndexUpdates.1.member.<action>.indexName both clauses the length clause
CreateTable, one vector index vectorIndexes.1.member.indexName both clauses the length clause
UpdateTable, a vector index Create or Delete vectorIndexUpdates.1.member.<action>.indexName both clauses the length clause
CreateBackup, TableName tableName both clauses the length clause
CreateBackup, BackupName backupName both clauses the length clause
ListBackups, TableName tableName both clauses the length clause
DescribeContinuousBackups, TableName tableName both clauses both clauses

Each refusal is HTTP 400 ValidationException. With this change, ExtendDB answers each row with both clauses, the length clause first.

Fixes #1135

Testing done

At 2f9f5c7ed6, all 75 CI checks passed, the wasm job included. In the run-tests (1.94.0) job, the extenddb-core library tests gave 1259 passed and 1 ignored. The extenddb-engine library tests gave 980 passed. The parity test in crates/wasm-adapter/tests/parity.rs passed with the updated corpus case.

At 8e16e4d20, each cargo command with --locked:

  • cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine --all-targets -- -D warnings, the same command with --features extenddb-engine/backup-test-hooks, cargo +1.91.1 check of the two crates with --all-targets, and cargo +1.97.0 fmt --all -- --check are clean.
  • The unit tables of index names (crates/core/src/validation/index_name_tests.rs), of GSI updates (crates/engine/src/gsi_updates.rs) and of backup names (crates/engine/src/backup/tests.rs) get the empty rows. The check_table_name("") rows in crates/engine/src/backup_requests/pitr/tests.rs pass without change.
  • Against ExtendDB on SQLite, tests/python/test_nul_table_name_fields.py, tests/python/test_nul_table_names.py, tests/python/test_nul_arn_shapes.py and tests/python/test_stream_disable_validation.py passed 143 tests, and tests/test_backup_restore_fidelity.py and tests/test_continuous_backups.py passed 46. test_nul_table_name_fields.py gets an empty name for each of its 8 index name members, and test_backup_and_table_names_are_validated gets the empty CreateBackup and ListBackups rows. Against a server built from the code of 8a2b168a1, the head of fix(core): count an index name in characters and report its member path #1137, the 8 empty index name rows fail. On that server, test_backup_and_table_names_are_validated fails at its first empty row (CreateBackup TableName). The other tests of the six files pass.
  • pytest --collect-only -q collects tests/ and tests/python with no error.

Line counts: production +11 -25, tests +38 -12.

Not in this PR:

This PR conflicts with #1273 in validate_name_members (crates/core/src/validation/mod.rs). The resolution keeps the loop of #1273, with the empty check inside it. This PR adds no other conflict with an open PR. A dry merge with main at c8e66fb56 has no conflict.

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 in one of the first eight rows of the table in Why gets both clauses for its empty value. Before this change, it got the length clause alone. A client that matches the old text sees the new one. In the WebAssembly build, a CreateBackup or ListBackups TableName that is a table ARN with an empty table segment also gets both clauses. DescribeContinuousBackups and UpdateContinuousBackups give the same text as before.


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.

ExtendDB counted an index name in UTF-8 bytes and wrote both length
bounds in one clause. It reported each fault at the bare 'indexName',
except a pattern fault in an UpdateTable Create or Delete. DynamoDB
counts the name in characters. It writes one clause per failed
constraint at the member path, and two clauses share one message.

So a name of 128 U+1F600 was refused as too long, where DynamoDB
reports the pattern alone. A name of two U+1F600 got the pattern clause
alone, where DynamoDB also reports the length.

validate_index_name now takes the member path and calls
validate_name_member, which moves from the engine's backup module to
core. Each caller passes the path of its member. CreateTable passes it
for each GSI, LSI and vector index. UpdateTable passes it for each
GlobalSecondaryIndexUpdates action and each VectorIndexUpdates action.

DynamoDB lists the two clauses in either order. ExtendDB writes the
length clause first, as it does for table names. Measured in us-east-1
on 2026-11-06, 2026-11-14 and 2026-11-18.

Fixes #1021.
Fixes #904.
CreateTable and UpdateTable answered an empty IndexName with the length
clause alone. DynamoDB lists two clauses for it: the name is shorter
than 3 characters, and it does not match [a-zA-Z0-9_.-]+, which needs
one character. DynamoDB gave this answer in us-east-1 on 2026-11-18
for a GSI and an LSI in CreateTable. It gave the same answer for a GSI
Create, Update and Delete in UpdateTable.

validate_name_member now treats an empty value as outside the pattern.
The other members it checks change the same way. On 2026-11-20 in
us-east-1, DynamoDB listed both clauses for an empty vector index name
in CreateTable and UpdateTable. It did the same for an empty TableName
or BackupName in CreateBackup, and for an empty TableName in
ListBackups.

DescribeContinuousBackups and UpdateContinuousBackups checked an empty
TableName in a branch of their own that wrote the same two clauses.
This change deletes that branch.

Fixes #1135.
#1009 moved `validate_name_member`, `table_name_bounds` and the other
request checks of `crates/engine/src/backup.rs` to
`crates/engine/src/backup_requests.rs`. This branch moved
`validate_name_member` to `extenddb_core::validation`, so the merge deletes
the copy in `backup_requests.rs` and imports the one in core in both files.
The `table_name_bounds` doc change moves with the function.
an_index_name_is_refused_at_its_member_path built its expected text
with validation_errors, the function that validate_name_member calls to
write the message. A fault in validation_errors would change both sides
of the assertion, and the test would pass. The test now writes the
sentence itself, as the core test does.
fix/1021-index-name-length, the branch of #1137, contains main at
5252eda.

#1009 moved crates/engine/src/backup/pitr.rs to
crates/engine/src/backup_requests/pitr.rs. Git applies the change of
this branch at the new path. There, check_table_name calls
validate_name_member with no branch of its own for an empty name, and
NAME_PATTERN_CONSTRAINT is gone.

The merge has no conflict. In gsi_updates.rs, the test of #1137 now
writes its expected text itself. The empty rows of this branch use its
case for two clauses.
The comment above the empty name rows of the index name table in
crates/core/src/validation/index_name_tests.rs started with "#1135:".
The comment now reads "An empty name is outside the pattern too."

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The parity test in crates/wasm-adapter/tests/parity.rs fails on this head. CI shows it in run-tests (1.91.1), run-tests (stable) and mongodb-rust. The test sends every request in crates/wasm-adapter/parity/corpus.json to the adapter and compares the answers. The case at corpus.json line 4223, "table ARNs: ListBackups with an empty table segment answers the length clause", sends arn:aws:dynamodb:us-east-1:000000000000:table/ and expects the one-clause text. After this change create_backup_table_name hands the empty table segment to validate_name_member, so the adapter answers "2 validation errors detected" with both clauses. I built this head merged with current main and ran the test: it fails on that case. The same test passes on #1137 merged with main. When I changed only that case's expected text to the two-clause message, the test passed, so I think this is the only case it affects.

Is the new text right for an ARN? The Why table measures plain names only. Has anyone checked on live DynamoDB what ListBackups and CreateBackup answer for a table ARN whose table segment is empty? On the ExtendDB server over HTTP that request never reaches the engine check. It is answered with "Valid ARN format is ..." at 'tableName' (I measured this on SQLite on this head and on #1137, with the account of the server), so only the wasm adapter shows the engine text. I think the corpus case should be updated and renamed to match, unless a measurement says an ARN name should keep the length clause alone.

CI at this head ran on 25 November and main has moved 14 commits since. The wasm job stopped at its build step, before the corpus step, so I think it would hit the same case once it builds. Please update the branch with main and let CI run again. I merged them locally and there is no conflict.

I will approve once the corpus case and the engine answer agree (and the ARN case has a measurement if it changes) and CI is green on the updated branch.

Base automatically changed from fix/1021-index-name-length to main December 2, 2026 22:04
The parity case for ListBackups with the table ARN
arn:aws:dynamodb:us-east-1:000000000000:table/ expected the length clause
alone. create_backup_table_name hands the empty table segment to
validate_name_member, which now adds the pattern clause for an empty
value, so the adapter answers both clauses. The case now expects that
answer, and its name says so.

DynamoDB answers neither text for this ARN. I measured ListBackups and
CreateBackup in us-east-1 on 2 Dec 2026, each request twice. Both answer
with this text:

    1 validation error detected: Value '<the ARN>' at 'tableName' failed to satisfy constraint: Table name of ARN must have length greater than or equal to 3

The case pins what the engine answers today. The ARN text is a separate
gap.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@navareamol thanks. The branch now has main merged (268cc3d), and the corpus case expects the two-clause answer. Its name says so too (2f9f5c7). The parity test passes with it.

I measured the ARN case. In us-east-1 on 2 Dec, ListBackups and CreateBackup with a table ARN whose table segment is empty both answer this text, each request twice:

1 validation error detected: Value '<the ARN>' at 'tableName' failed to satisfy constraint: Table name of ARN must have length greater than or equal to 3

So neither the old engine text nor the new one is DynamoDB's for an ARN. Over HTTP the server's ARN gate answers first, and #1282 gives it that text (#1221). The engine path that only the WebAssembly build reaches is now #1546. Until a fix for #1546 merges, the case pins what the engine answers.

@LJMart11 LJMart11 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed at 2f9f5c7. 1 finding: 1 Docs.

The change makes validate_name_member list the pattern clause as well as the length clause for an empty value, and removes the separate empty-name branch in check_table_name. Confirmed: the empty-name answer matches live DynamoDB for a CreateTable GSI index name, DescribeContinuousBackups, ListBackups and CreateBackup TableName (two clauses each; DynamoDB's clause order varies, ExtendDB writes the length clause first); the core and engine lib tests and the wasm-adapter parity test pass on the head and on the head merged with the current main; the 46 selected backup and index-name wire tests passed on SQLite. Removing the is_empty() check fails 1 core test and 3 engine tests.

  • Docs PR description — The test counts in the description (core 1178, engine 933) do not match the head, and the description does not mention the wasm-adapter corpus change.

Docs — outside the diff

PR description
Docs
The description gives 1178 core and 933 engine lib tests at 8e16e4d20. The head 2f9f5c7e runs 1259 passed and 1 ignored in core, and 980 in engine. It also does not say that 2f9f5c7e edits crates/wasm-adapter/parity/corpus.json:4411-4420, so the wasm adapter now answers both clauses for ListBackups with a table ARN whose table segment is empty, while the "Not in this PR" note says an empty ARN part is left to #1221.

Fix: update the two counts and add one sentence on the corpus case.

Evidence: cargo test -p extenddb-core --lib -> 1259 passed, 1 ignored; cargo test -p extenddb-engine --lib -> 980 passed (Rust 1.94.0).

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@LJMart11 thanks. I updated the description. It now gives the counts at 2f9f5c7 from CI's run-tests (1.94.0) job: 1259 passed and 1 ignored in core, and 980 passed in engine. It also names the corpus case, and #1546 for the ARN path that only the WebAssembly build reaches.

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The wasm parity case is fixed. 2f9f5c7 renames the ListBackups case with the empty table segment and expects the two clause text, and nothing else in corpus.json changed. On a build of this head the parity test passes, and so do the core tests (1259 passed, 1 ignored) and the engine tests (980 passed). CI shows all checks green on this head, wasm and run-tests (stable) included. Main is merged and the diff now holds only this change.

Your measurement of the ARN case answers my question. If DynamoDB answers "Table name of ARN must have length greater than or equal to 3" for both requests, the corpus case pins an engine text that is not DynamoDB's, and the description and #1546 say so. I have no objection to pinning it until #1546 lands.

The conflict with #1273 is still there. A merge of the two reports a conflict in validate_name_members in crates/core/src/validation/mod.rs. I merged #1273 into this head and resolved it the way the description says, with #1273's loop and the value.is_empty() check inside it. The core tests (1259 passed) and the engine tests (983 passed, the three extra are #1273's) pass and the parity test passes. So whichever PR merges second can take that one line change.

One optional item. The comment at the top of crates/core/src/validation/index_name_tests.rs still names #904 and #1021, and this PR adds a date to the same sentence. I think the issue numbers are better left out, as in the comment you edited in 8e16e4d, but it does not need to hold the merge.

I approve this PR.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 5ade026 Dec 4, 2026
76 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/1135-empty-name-pattern branch December 4, 2026 04:25
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
…-time

The merge takes f583547, the last head of #1093 before main merged
it as 1e2ebdd. The last merge took b8f73c4. Since then, #1093
merged main at 1174651, eight PRs past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325 and #1443. Git merged without a
conflict. Two files of this branch have changes on both sides:

- crates/storage/src/util/mod.rs: #1087 declares and exports
  scan_segment, and this branch declares and exports throughput.
- docs/differences-from-dynamodb.md: #1443 changes the
  control_plane_delay_seconds default to 0.25 in two rows, and this
  branch adds the LastIncreaseDateTime row to the Control Plane table.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, ten commits past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325, #1443, #1269 and the squash commit
of #1093.

One file conflicted: docs/manuals/07-upgrade-manual.md. #1093 adds its
v1.2.0 entry at the top of "Behavior Changes by Release", where this
branch has its entry. The merge keeps both entries without change. The
entry of this branch stays first. The entry of #1093 comes next, above
the other v1.2.0 entries of main. #1087 adds its entry after the other
v1.2.0 entries of main, and git merged it with no conflict.

Git merged four other files with no conflict:

- crates/core/src/validation/mod.rs: #1228 adds the pattern clause for
  an empty value in validate_name_member. This branch declares the
  table_name_length module near the top of the file.
- crates/server/src/table_name_gate.rs: #1296 adds has_no_table_member
  and an arm of check_table_name_chars for the six operations that have
  no table member. This branch checks none of those operations.
- crates/wasm-adapter/parity/corpus.json: #1087 adds a Scan case, and
  #1228 changes the text of a ListBackups case. This branch changes
  other cases.
- docs/manuals/10-security-model.md: #1325 adds the
  Content-Security-Policy line of the console. This branch changes the
  line on the requests that get an answer before the IAM decision.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, six commits past 44a7b79: #1485, #1228,
#1325, #1443, #1269 and the squash commit of #1093.

One file conflicted:
crates/storage-mongodb/src/data_engine_live_tests.rs. #1093 declares
the update_window module after delete_table, where this branch
declares put_race and contention. The merge keeps all three
declarations: update_window first, then the two of this branch.

Git merged five other files with no conflict:

- crates/storage-mongodb/src/snapshot_engine.rs: #1093 checks that a
  table serves with TableStatus::serves, and its tests set a table to
  CREATING instead of UPDATING. This branch builds a test engine with
  MongoEngine::for_test, at other lines.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse. This branch changes the doc comment of Transient.
- crates/storage/src/lib.rs: #1093 declares update_window_conformance,
  and this branch declares request_clock.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch changes two rows near the top and adds
  the row on sustained contention.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, six commits past 44a7b79: #1485, #1228,
#1325, #1443, #1269 and the squash commit of #1093.

One file conflicted:
crates/storage-mongodb/src/data_engine_live_tests.rs. #1093 declares
the update_window module after delete_table, where this branch
declares the token module. The merge keeps both declarations:
update_window first, then token.

Git merged five other files with no conflict:

- crates/core/src/validation/mod.rs: #1228 adds the pattern clause for
  an empty value in validate_name_member. This branch changes the index
  key checks, at other lines.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse, and this branch adds TransactionInProgress.
- crates/storage/src/lib.rs: #1093 declares update_window_conformance,
  and this branch adds names to the transact exports.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch changes the row on index key
  validation.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, eight commits past 5826e1b: #768, #1296,
#1485, #1228, #1325, #1443, #1269 and the squash commit of #1093.

Three files conflicted, in four hunks. In each hunk the UpdateTable
window of #1093 meets the answer of this branch for a DELETING table:

- crates/storage-postgres/src/update_table.rs and
  crates/storage-sqlite/src/update_table.rs have one hunk each. #1093
  reads three more columns of the table row: the stored throughput, the
  table class and the window (in_window on PostgreSQL,
  stored_transition_at on SQLite). This branch answers a DELETING table
  with TableBeingDeleted right after UpdateTable reads the row. The
  merge keeps the wider read of #1093, then the DELETING check of this
  branch, then the check for a status other than ACTIVE. The window
  checks of #1093 come after that check, as on main.
- crates/storage-mongodb/src/table_engine.rs has two hunks, both in
  require_active_table. #1093 makes the function return the catalog
  document of the table, and UpdateTable reads the window from it. This
  branch answers DELETING with TableBeingDeleted in a match on the
  status. The merge keeps that match, and its ACTIVE arm returns the
  document. The doc comment names the document and the three answers.

A table has one stored status. #1093 reports UPDATING only for a
stored ACTIVE table whose status_transition_at is later than now
(reported_status in crates/storage/src/util/mod.rs). So no table is
UPDATING and DELETING at the same time, and the merge does not choose
between the two answers.

Git merged six other files of this branch with no conflict:

- crates/engine/src/update_table.rs: #1093 changes the doc comment of
  handle_update_table and declares the status_tests module. This branch
  maps TableBeingDeleted in update_table_err_to_dynamo.
- crates/storage-cassandra/src/update_table.rs: #1093 reads
  status_transition_at and adds the window. This branch adds the same
  DELETING check before the check for a status other than ACTIVE.
- crates/storage-postgres/tests/table_snapshot.rs: #1093 writes
  CREATING instead of UPDATING in two fixtures. This branch changes
  other tests.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse, and this branch adds TableBeingDeleted.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch adds the row on requests during a
  DELETING window.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main. The change of this branch to the
  entry of #1411 stays too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CreateTable and UpdateTable answer an empty IndexName with one length clause, where DynamoDB adds the pattern clause

3 participants