Repository navigation
fix(engine): answer a SearchVectors body without TopK as ValidationException - #1568
Open
navareamol wants to merge 2 commits into
Open
navareamol wants to merge 2 commits into
navareamol wants to merge 2 commits into
Conversation
added 2 commits
December 3, 2026 09:54
…ception The service answers a SearchVectors request without TopK with a ValidationException that reads "missing field `TopK`" followed by the position in the body, measured on 2026-11-24 in us-east-1, each request twice. ExtendDB mapped the failed read to a SerializationException. The read of the body now answers the ValidationException for that one missing member. The body reaches the check parsed, so the text ends at the member name and leaves out the position. Other read failures keep their answer. Refs #1461
navareamol
requested review from
LeeroyHannigan,
amrith,
c33howard,
demohan,
eliseong,
hitesh96db,
jcshepherd,
pdf-amzn and
robinnsc
as code owners
December 3, 2026 18:16
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A SearchVectors body without
TopKnow answersValidationExceptionwith the textmissing field `TopK`. Before, it answeredSerializationExceptionwithStart of structure or map found where not expected: missing field `TopK`.The change is a small mapper,
read_error, incrates/engine/src/search_vectors_request.rs. It applies only when the failed read says exactlymissing field `TopK`. Every other read failure still goes throughdeserialize_error.The message ends at the member name. The service adds
at line 1 column N. A new row indocs/differences-from-dynamodb.md(Secondary Indexes section) records that difference. See the open question.A body missing both
TableNameandTopKstill answersSerializationExceptionnamingTableName, because serde reports the first missing member in declaration order. That case is unmeasured.Why
Refs #1461.
The issue measured, on 24 Nov 2026 in us-east-1 with each request sent twice, that DynamoDB answers
ValidationExceptionmissing field `TopK` at line 1 column 125. It gives the same answer for a table ARN in another account, ahead of the authorization decision. ExtendDB answeredSerializationException.The cause is in the code:
SearchVectorsInput.top_khas no default (search_vectors_request.rs), so the read fails, anddeserialize_errorincrates/engine/src/lib.rshas no case for a missing field.This is
Refsand notFixesbecause the answer still differs from the measured one by the position suffix.Other paths and callers:
check_table_name_chars(crates/server/src/handler.rs). The cross-account ARN case from the issue goes through the same check. It was not run end to end here.handle_search_vectorscalls the samecheck, so the engine entry point answers the same.Open PR overlap: #1322 changes
crates/engine/src/search_vectors.rsandcrates/server/src/request_attributes.rs, not the files here. The two do not share lines, and I did not try merging them.Testing done
Branch
fix/1461-searchvectors-missing-topk, one commit on origin/main c057660. Run on the dev desktop, SQLite only (the test builds a SQLite catalog; the change is before any storage call). Mac and desktop trees match:3f845df4b85cabdb14f0943eb1c9bcbe7d44eed7.cargo fmt --checkcargo +1.97.0 clippy -p extenddb-engine --all-targets -- -D warnings--no-default-featuresfunction memory_engine is never usedincrates/engine/src/test_context.rs:17. Not caused by this change.cargo test -q -p extenddb-engine --lib a_body_without_top_kcargo test -q -p extenddb-engine --lib search_vectorsThe crate has no
test-hooksfeature (its features arepartiql,search-inequality-filters,backup-test-hooks), so that clippy variant does not apply. MSRV 1.88 build, the other backends, the Python wire tests and the whole workspace test run were not run.Negative control. The tree was clean and committed. I replaced
.map_err(read_error)with.map_err(crate::deserialize_error)incheck:Command:
cargo test -q -p extenddb-engine --lib a_body_without_top_k. Result: 0 passed, 1 failed, withSerializationException("Start of structure or map found where not expected: missing field `TopK`"). Aftergit checkout --the status was empty.Reproduce:
cargo test -p extenddb-engine --lib a_body_without_top_k.The test sends a body with every member except
TopKagainst a table that does not exist, and expectsValidationExceptionwith the messagemissing field `TopK`.Open question
at line 1 column N, where the issue says N follows the body length (125 and 171). The check receives a parsed JSON value, so it has no position. A real column needs the raw body bytes passed throughcheck_search_vectors_request,handle_search_vectorsand the WebAssembly adapter. Re-serializing the value would give a column that can differ from the client's body. I left the suffix out. What exactly is the column of the body the service received, for example the byte offset after the closing brace? The issue does not give the two bodies, so I could not check 125 and 171.TopK. Not measured:TopKmissing together with aSearchVectorof the wrong length, with anIndexNameshorter than 3 characters, or with a bad table name. On this branch, a body missingTopKanswers the missing-member error first, because it fails at the read. A bad table name still answers first, because the handler runs this check only aftercheck_table_name_charspasses (SearchVectors: table name checks answer in a different order and miss the length bounds #1462). A body missingTableName,IndexNameorSearchVectoris unchanged and still answersSerializationException; the issue lists these as not measured.