Repository navigation
fix(core): count an index name in characters and report its member path - #1137
Conversation
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.
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
left a comment
There was a problem hiding this comment.
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] = [ |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
Changes since the last review
fd39699d1mergesmainat5252eda31. The merge has no conflict and changes none of the files of this PR.8a2b168a1: the engine testan_index_name_is_refused_at_its_member_pathwrites its expected sentence with a localformat!, as the core test does. Before, it built the sentence withvalidation_errors, the function thatvalidate_name_membercalls. A fault in that function would have changed both sides of the assertion.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 UpdateTableCreateorDelete. 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:
globalSecondaryIndexes.<n>.member.indexName,localSecondaryIndexes.<n>.member.indexNameandvectorIndexes.<n>.member.indexName.globalSecondaryIndexUpdates.<n>.member.<action>.indexNameforcreate,updateanddelete, andvectorIndexUpdates.<n>.member.<action>.indexNameforcreateanddelete.validate_index_name(name, location)now takes the member path and callsvalidate_name_member. This PR movesvalidate_name_memberfrom 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 usesvalidate_table_name_charsandvalidation_errors.validate_update_index_namebuilds theGlobalSecondaryIndexUpdatespath 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:cargo +1.97.0 test -p extenddb-core --lib: 1178 passed, 1 ignored.cargo +1.97.0 test -p extenddb-engine --lib: 933 passed.cargo +1.97.0 test -p extenddb-server --lib: 514 passed. The 5backup_storetests that check file permissions fail on the test host, where a parent directory belongs to another user. This PR does not changebackup_store.rs.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -D warnings, the same command with--features extenddb-engine/backup-test-hooks,cargo +1.91.1 checkof the three crates with--all-targets, andcargo +1.97.0 fmt --all -- --checkare clean.tests/test_backup_job.py. The new testTestIndexName::test_index_name_is_refused_at_its_member_pathintests/python/test_nul_table_name_fields.pysends 34 rows: 8 members with 4 names each, and the 2 rows of CreateTable reports a global secondary index name outside the pattern at 'indexName', where DynamoDB names the member #904. It accepts the two clauses in either order.VectorIndexUpdatesrows, and the engine test holds the 14GlobalSecondaryIndexUpdatesrows. With main's code incrates/core/src/validation/mod.rsand in the engine callers, and the new tests kept, both tests fail on their first CreateTable and UpdateTable count an index name in UTF-8 bytes, where DynamoDB counts characters #1021 row.Create.Line counts over main: production +97 -108, tests +373 -25.
Not in this PR, each in an open issue:
IndexNamegets the length clause alone, where DynamoDB adds the pattern clause.IndexNameof an index override.TableNamein characters, where DynamoDB counts UTF-16 code units. ListBackups was not measured.validate_name_memberchecks theTableNameof both operations.IndexName.Other open PRs:
TOO_SHORT,TOO_LONGandcount_clausein core. They write the same length clauses asvalidate_name_member. Before this PR,validate_name_memberwas in the engine, where core cannot call it. The texts differ in one case:validate_name_membernames the bounds it gets, and the other two always name 3 and 255. For the backupTableNamemembers, those bounds are the deployment's limits. The PR that merges second must take its clauses from the other, so that one function writes each clause.crates/engine/src/backup_requests.rs. They movetable_name_boundstoextenddb_core::validation::table_name_lengthand keep the engine'svalidate_name_member. This PR movesvalidate_name_memberto core and keeps the engine'stable_name_bounds. To resolve it, keep both core imports, and drop the engine'stable_name_boundsandvalidate_name_member.validate_lsi_key_schemas. This PR changes the loop header and thevalidate_index_namecall, and fix(core): CreateTable key schema, local index and throughput refusal texts #1074 rewrites thematchon the next line. To resolve it, keep fix(core): CreateTable key schema, local index and throughput refusal texts #1074'smatchand the two changed statements of this PR.crates/core/src/validation/mod.rs. It moves thevalidate_index_namecalls of the GSI and LSI loops into a newvalidate_create_table_constraints, and this PR adds the member path to those calls. To resolve it, keep fix(tagging): validate tag keys and values against the service grammar #485's move and pass the member path in the moved calls. The third place is the doc comment ofvalidate_index_name, next to the doc comment fix(tagging): validate tag keys and values against the service grammar #485 rewrites. Keep both.crates/core/src/validation/mod.rs. It moves theirvalidate_index_namecalls into its newvalidate_table, and this PR adds the member path to those calls. To resolve it, keep the move of fix(core): check the key schema definitions of CreateTable and UpdateTable #595 and pass the member path in the moved calls.Merges of main
#1009 merged first.
eae1d6dbcmergesmainata417b2f82. #1009 movedvalidate_name_member,table_name_boundsand the other request checks ofcrates/engine/src/backup.rstocrates/engine/src/backup_requests.rs. This branch movedvalidate_name_membertoextenddb_core::validation, so the merge removes the copy inbackup_requests.rsand both files import the one in core. Thetable_name_boundsdoc change moves with the function.fd39699d1mergesmainat5252eda31with no conflict.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 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_nametakes the member path as a second parameter, andvalidate_name_membermoves 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.