Skip to content

fix(core): count an index name in characters and report its member path - #1137

Merged
LeeroyHannigan merged 4 commits into
mainfrom
fix/1021-index-name-length
Dec 2, 2026
Merged

LeeroyHannigan merged 4 commits into
mainfrom
fix/1021-index-name-length

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

What

CreateTable and UpdateTable now check an index name as DynamoDB does. ExtendDB counts the name in characters and writes one clause for each failed constraint. It reports each clause at the member path of the name, for example globalSecondaryIndexes.1.member.indexName.

Before this change, ExtendDB counted the name in UTF-8 bytes and wrote the two length bounds in one clause. It reported each fault at the bare indexName, except a pattern fault in an UpdateTable Create or Delete. So a name of 128 U+1F600 got the length fault, where DynamoDB answers the pattern clause alone. A name of two U+1F600 got the pattern clause alone, where DynamoDB also lists the length clause.

The member paths:

  • CreateTable: globalSecondaryIndexes.<n>.member.indexName, localSecondaryIndexes.<n>.member.indexName and vectorIndexes.<n>.member.indexName.
  • UpdateTable: globalSecondaryIndexUpdates.<n>.member.<action>.indexName for create, update and delete, and vectorIndexUpdates.<n>.member.<action>.indexName for create and delete.

validate_index_name(name, location) now takes the member path and calls validate_name_member. This PR moves validate_name_member from the engine's backup module to core, and the backup and point-in-time callers keep their answers. The engine copy had its own alphabet check and its own join. The moved function uses validate_table_name_chars and validation_errors. validate_update_index_name builds the GlobalSecondaryIndexUpdates path and no longer rewrites the message.

DynamoDB lists the two clauses in either order. ExtendDB writes the length clause first, as it does for table names.

Why

These are DynamoDB's answers, measured in us-east-1 on 6, 14 and 18 November 2026. Each request on 18 November went out twice. Every expected text in the tests is DynamoDB's answer to a request with the same body.

Closes #1021
Closes #904

Testing done

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

Line counts over main: production +97 -108, tests +373 -25.

Not in this PR, each in an open issue:

Other open PRs:

Merges of main

#1009 merged first. eae1d6dbc merges main at a417b2f82. #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 removes the copy in backup_requests.rs and both files import the one in core. The table_name_bounds doc change moves with the function. fd39699d1 merges main at 5252eda31 with 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 CreateTable or UpdateTable request with an index name that DynamoDB refuses gets DynamoDB's text, as the What section says. A client that matches the old texts sees the new ones. A request with a valid index name gets the same answer as before.

In extenddb-core, validate_index_name takes the member path as a second parameter, and validate_name_member moves there from the engine. The description of the crate says that it is an internal crate of the extenddb binary, with no API stability promise.


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.
#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.
LeeroyHannigan added a commit that referenced this pull request Nov 25, 2026
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.
@demohan demohan self-assigned this Nov 28, 2026

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

An index name is counted and reported as the service does at 8a2b168. 288 requests in us-east-1, twice with the same answers, show the service counts code points: a with one emoji (3 UTF-16 units) gets the too-short clause, and 254 a with one emoji (256 units) only the pattern clause. This head gives the same code, text and member path on SQLite and PostgreSQL for CreateTable GSI, a second GSI, LSI and VectorIndexes, and for UpdateTable GSI Create, Update and Delete and VectorIndexUpdates Create and Delete, with both backends identical on every row. The service lists the two clauses in either order from one request to the next, and this head always puts length first, which the tests allow. No row main answered right is answered otherwise here, the check order is main's on 25 order cases, 3- and 255-character names create, query and delete, and CreateBackup and ListBackups give main's answers on all 27 rows after validate_name_member moved to core. 18 of 19 negative controls fail as they should, the 34 new wire rows fail on main and pass here, fmt, both clippy commands, the 1.91.1 check and the lib tests are clean, and the branch merges with main at 222d80a, where it builds and passes clippy, the lib tests and the wasm build; the red wasm check is main's, fixed by #1482. #1225 and #1228 contain this head and merge cleanly onto main with it.

let vector = "vectorIndexes.1.member.indexName";
let create = "vectorIndexUpdates.1.member.create.indexName";
let delete = "vectorIndexUpdates.1.member.delete.indexName";
let rows: [(Member, &str, &str, &[&str]); 22] = [

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.

Optional. No row here, in gsi_updates.rs:548-563 or in the Python INDEX_NAME_ROWS accepts a name at the limit: with length > max changed to length >= max at validation/mod.rs:102, the core and server suites still pass, and only two backup tests fail because BackupName shares the function. Rows for abc and 255 a would hold the edges the body measured by hand.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit bcba811 Dec 2, 2026
64 of 65 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/1021-index-name-length branch December 2, 2026 22:04
LeeroyHannigan added a commit that referenced this pull request Dec 2, 2026
Main is at e8b5f10, three commits past 01556cf: #481, #1137 and
#1403. #1403 adds a v1.2.0 entry for #606 at the top of "Behavior
Changes by Release" in docs/manuals/07-upgrade-manual.md, where this
branch adds its v1.2.0 entry. That is the one conflict. The merge
keeps both entries, the entry of main first.

Git merged crates/engine/src/lib.rs with no conflict. Main adds a test
module there, and this branch adds serialization_exception.
LeeroyHannigan added a commit that referenced this pull request Dec 2, 2026
The base merges main at e8b5f10, which brings #481, #1137 and #1403.
The merge has no conflict. No file has changes on both sides.
LeeroyHannigan added a commit that referenced this pull request Dec 2, 2026
The base merges main at e8b5f10 through #1260, which brings #481,
#1137 and #1403. The merge has no conflict. No file has changes on
both sides.
LeeroyHannigan added a commit that referenced this pull request Dec 2, 2026
The base merges main at e8b5f10 through #1260, which brings #481,
#1137 and #1403. #1403 adds a v1.2.0 entry for #606 at the top of
"Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md,
above the entry of #1260. Git merged the file with no conflict, so the
order is #606, #1260, then the entry of this branch.
LeeroyHannigan added a commit that referenced this pull request Dec 2, 2026
The base merges main at e8b5f10 through #1260, which brings #481,
#1137 and #1403. The merge has no conflict. Main adds a test module to
crates/engine/src/lib.rs, where this branch adds single_write_refusal,
at other lines.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
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.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
The base merges main at c8e66fb, which brings #481, #1137, #1403,
#1465, #1515 and #1411, and adds the v1.2.0 entry of #1110 to
docs/manuals/07-upgrade-manual.md. The merge has no conflict, and no
file has changes on both sides.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
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.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main at c057660. Three files conflicted.

crates/engine/src/partiql/test_context.rs: main (#1449) builds context
from crate::test_context. The merge takes the body of main and keeps
pub(crate) on context and block_on, which the table name length tests
call.

crates/engine/src/backup_requests.rs: main (#1137) moved
validate_name_member to extenddb_core::validation and kept a private
table_name_bounds. This branch moved table_name_bounds to
extenddb_core::validation::table_name_length. The merge keeps both
moves, so the file imports both functions and defines neither.

README.md: main (#1521) moved the WebAssembly section to
docs/webassembly.md. The merge takes the README.md of main. The README
changes of this branch go to docs/webassembly.md. They change the text
and the table of the checks that the server makes and this build does
not.

Main changed five other files of this branch. Git merged each change
of main beside the lines of this branch.

- crates/core/src/error/messages.rs: a message key.
- crates/engine/src/partiql/mod.rs: request_checks made pub(crate).
- crates/engine/src/transact_write_items.rs: the token comment and the
  stored token.
- crates/wasm-adapter/parity/corpus.json: corpus cases.
- docs/manuals/10-security-model.md: the authentication steps and the
  SearchVectors rows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants