Repository navigation
fix(indexes): reads refuse filters and projections of attributes an index does not hold - #148
Merged
Merged
Conversation
Creates throwaway tables, asks the questions #87, #93, #97 and #106 leave open, logs every answer (with account ids masked) and deletes the tables. Co-authored-by: Carl Oscar Aaro <[email protected]>
Co-authored-by: Carl Oscar Aaro <[email protected]>
…ssages Co-authored-by: Carl Oscar Aaro <[email protected]>
…ndex does not hold DynamoDB refuses a query filter on attributes an index does not hold, for local indexes too and whatever the query returns, and a projection of a global index naming them (measured in eu-north-1, docs/parity). The in-memory backend now does the same with DynamoDB's messages, its scan filters see the index entries, and model reads raise ValueError before any request (ADR 0021). Co-authored-by: Carl Oscar Aaro <[email protected]>
…ack's Co-authored-by: Carl Oscar Aaro <[email protected]>
… parity-stack/2-index-reads
Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…be round AWS CLI v1 base64-encodes the B values of JSON input itself, so the base64 text written for v2 became 400 KB items; the generators now write what the version in use sends as the intended bytes. Round 3 asks where LocalStack and the tests disagree. Co-authored-by: Carl Oscar Aaro <[email protected]>
…f fetched items are an assumption Co-authored-by: Carl Oscar Aaro <[email protected]>
…t, and add round 3 Co-authored-by: Carl Oscar Aaro <[email protected]>
… parity-stack/2-index-reads
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Carl Oscar Aaro <[email protected]>
…t twice Co-authored-by: Carl Oscar Aaro <[email protected]>
… parity-stack/2-index-reads
Contributor
Author
|
Stack of 8 pull requests, merged in this order with "Squash and merge":
|
This was referenced Oct 31, 2026
Merged
Co-authored-by: Carl Oscar Aaro <[email protected]>
…s DynamoDB does (round 2) Co-authored-by: Carl Oscar Aaro <[email protected]>
Co-authored-by: Carl Oscar Aaro <[email protected]>
…ors' answers they gave Co-authored-by: Carl Oscar Aaro <[email protected]>
… parity-stack/2-index-reads
This comment has been minimized.
This comment has been minimized.
…ilters that would never match Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…its filter sees the entries Co-authored-by: Carl Oscar Aaro <[email protected]>
Base automatically changed from
fctl/154-what-do-you-need-me-to-test-to-be-able-t
to
main
October 31, 2026 18:21
…stack/2-index-reads # Conflicts: # CHANGELOG.md
…tack/2-index-reads
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.
Summary
Reads of an index that name attributes it does not hold passed in tests and failed against DynamoDB. Measured in eu-north-1 (docs/parity, rounds 1 and 2), DynamoDB refuses a
Queryfilter on such attributes for local indexes too, whatever the query returns (ALL_ATTRIBUTES,COUNT, a projection it fetches from the table), naming each place the filter reads one by its top-level name in order ([_type, _type],[secret, m]), and refuses a projection of a global index naming them in queries and scans. A scan's filter sees what the scan returns: the index entries, where such attributes never match, or the items it fetches from the table. The in-memory backend now does the same with DynamoDB's messages.Model queries raise
ValueErrorbefore any request for a filter of aKEYS_ONLY/INCLUDElocal index on an attribute it does not hold (they sent it withSelect=ALL_ATTRIBUTES), as they did for global ones; scans of such a local index read the items and keep their filters, unless they project only what the index holds. Model reads raiseValueErrorfor.project(...)of a global index naming one, unless the query adds.hydrate()(before or after), which now reads the index for the keys only and takes the attributes from the full items. ADR 0021 amends ADR 0012; guides, AGENT_GUIDE, the skill and the changelog follow.Verified with
make check(Rust and Python tests, the integration tests on the memory backend and MiniStack, lint, types, consistency) and a new memory backend test with DynamoDB's messages; the refusals are asserted on the memory backend only, since MiniStack accepts them.Worth confirming
attribute_not_exists(_type) OR _type = :entity. dynamoxy creates such indexes with_type, so that works; queries of an index without it (created by other tools or by dynamoxy 0.2) now fail with DynamoDB'sValidationErrorand the index has to be created again. Dropping the filter would make them work but let every partial index query return, count and limit other entities' entries.Fixes #106
fctl session
Note
Medium risk. It changes what model reads of KEYS_ONLY and INCLUDE indexes send: filters and projections that used to be sent now raise ValueError before any request, and the in-memory backend answers index reads differently.
What it does. Makes the in-memory backend refuse what DynamoDB refuses when a query or scan reads a KEYS_ONLY or INCLUDE index: query filters on attributes the index does not hold, and projections of a global index that name them. Model reads now raise
ValueErrorfor those cases before any request,.hydrate()reads such an index for its keys only and takes the attributes from the full items, and a scan of a local index filters the fetched items only when the request returns them from the table. Adds ADR 0021, tests, guide updates and a changelog entry; since the last review it only merges main in, with no change to the code of the fix.Behavior change. Filters on attributes an index does not hold, and
.project(...)of such a global index without.hydrate(), now raiseValueErrorinstead of being sent; queries of an index that lacks the type attribute fail in DynamoDB and need the index created again.fctl review's first look at
0e31db3· 15 files, +343 −30 · Review agent settings