Skip to content

fix(memory): PartiQL index reads refuse attributes the index does not hold - #137

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/133-work-through-open-issues-and-open-a-pr-s
Oct 31, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/133-work-through-open-issues-and-open-a-pr-s

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PartiQL SELECTs of an index in the in-memory DynamoDB returned rows where DynamoDB refuses the statement, so tests could pass where production fails. Following what dynoxide-rs captured against DynamoDB (eu-west-2, 2026-08-15), the memory backend now refuses a projection of a global index that names attributes the index does not project (Global secondary index i does not project [a]), and a WHERE clause keyed on the index's partition key (= or IN, without an OR) that filters on such attributes, on global and local indexes alike (Secondary index i does not project one or more filter attributes: [a]). An unkeyed WHERE clause is a scan and still matches nothing on them; a local index's projection is still fetched from the table.

A Rust test of the memory backend covers both refusals, their messages, and the statements that stay accepted; cargo test, clippy and the consistency checks pass. The low-level access guide says what index SELECTs may name.

This is the PartiQL part of #106. The Query and Scan API part stays open: no capture against DynamoDB says whether it refuses such filters and projections too.

Refs #106

Worth confirming

  • Assumption: whether a WHERE clause counts as keyed follows dynoxide-rs's model (its disjunctive normal form has a single group naming the partition key), so pk = 'a' AND (x = 1 OR y = 2) is treated as a scan and not refused; only the simpler forms were captured against DynamoDB.

fctl session


Note

Low risk. It only changes the in-memory DynamoDB used in tests, and only for PartiQL SELECTs of an index that DynamoDB itself refuses; nothing reaches real tables.

What it does. The in-memory backend now refuses PartiQL SELECTs of an index that DynamoDB refuses: a projection of a global index that names attributes the index does not hold, and a WHERE clause keyed on the index's partition key that filters on such attributes, for global and local indexes alike. Before, those statements returned rows, so tests could pass where production fails. A unit test of the memory backend, the low-level access guide and the changelog cover it.

Unverified keyed-WHERE model. A WHERE clause counts as keyed only when it has no OR, following dynoxide-rs, so pk = 'a' AND (x = 1 OR y = 2) is treated as a scan and not refused; only the simpler forms were captured against DynamoDB.

fctl review's first look at e75579d · 4 files, +131 −2 · Review agent settings

… hold

DynamoDB refuses a PartiQL SELECT of a global index whose projection
names attributes the index does not project, and one keyed on an
index's partition key whose WHERE clause filters on such attributes, on
either kind of index (captured by dynoxide-rs in eu-west-2). The
in-memory backend returned rows for both. An unkeyed WHERE clause is a
scan and still matches nothing on them.

Refs #106

Co-authored-by: Carl Oscar Aaro <[email protected]>
@fctl-review

This comment has been minimized.

Comment thread docs/guides/low-level-access.md Resolved
@fctl-sh

fctl-sh Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Stack of 7 pull requests, merged in this order with "Squash and merge":

  1. fix(memory): PartiQL index reads refuse attributes the index does not hold #137 fix(memory): PartiQL index reads refuse attributes the index does not hold ← this pull request
  2. fix(models): writes through loaded instances use keys stored in another form #138 fix(models): writes through loaded instances use keys stored in another form
  3. fix(models): repositories refuse instances of subclasses and items of other models #139 fix(models): repositories refuse instances of subclasses and items of other models
  4. fix(models): documents read from an item keep the keys their class does not declare #140 fix(models): documents read from an item keep the keys their class does not declare
  5. fix(pydantic): key values and update values run the field's pydantic validators #141 fix(pydantic): key values and update values run the field's pydantic validators
  6. fix(repository): updates render derived attributes from the stored item, and require it unchanged #142 fix(repository): updates render derived attributes from the stored item, and require it unchanged
  7. fix(tables): provisioned billing gives global indexes capacity, and table steps wait for the one before #143 fix(tables): provisioned billing gives global indexes capacity, and table steps wait for the one before

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.

1 participant