Repository navigation
fix(memory): PartiQL transactions that name an item twice are refused - #104
Merged
kalaspuff merged 2 commits intoOct 30, 2026
Merged
Conversation
The in-memory ExecuteTransaction prepared every statement against the
items as they were before the transaction and then applied them all,
so two statements on one item lost a write: of `SET a = 1` and
`SET b = 2` only the second took effect, and an INSERT plus a DELETE
of one item left it stored. Read transactions that named an item twice
ran too.
DynamoDB refuses such transactions before running any statement, with
the ValidationException that TransactWriteItems and TransactGetItems
give ("Transaction request cannot include multiple operations on one
item"). The memory backend now does the same, comparing the key each
statement reads or writes, whatever the order of the key conditions,
the form of a number or whether the key comes from parameters. A
statement without a table or a full key takes no part and fails on its
own, as before.
Fixes #75.
Co-authored-by: Carl Oscar Aaro <[email protected]>
Brings in #105 (optional fields with a codec of their own). Both sides appended an entry to the Fixed section of CHANGELOG.md; both are kept, #105's first since it landed first. Co-authored-by: Carl Oscar Aaro <[email protected]>
kalaspuff
deleted the
fctl/54-https-github-com-kalaspuff-dynamoxy-issu
branch
October 30, 2026 23:42
fctl-sh Bot
added a commit
that referenced
this pull request
Oct 30, 2026
Keeps both CHANGELOG.md entries under Fixed: the one for PartiQL transactions that name an item twice (#104), then this branch's for list elements set past the end. Co-authored-by: Carl Oscar Aaro <[email protected]>
fctl-sh Bot
added a commit
that referenced
this pull request
Oct 30, 2026
…com-kalaspuff-dynamoxy-issu Brings in #104 (PartiQL transactions that name an item twice are refused). CHANGELOG.md conflicted where both added an entry at the end of [Unreleased] Fixed: both entries are kept, #104's first. Co-authored-by: Carl Oscar Aaro <[email protected]>
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 and why
The in-memory DynamoDB's
ExecuteTransactionnever checked whether two statements named the same item. It prepares every statement against the items as they were before the transaction and then applies them all, so such a transaction lost writes silently:UPDATE t SET a = 1 WHERE pk = 'x' AND sk = 1plusUPDATE t SET b = 2 WHERE pk = 'x' AND sk = 1succeeded and lefta = 0, b = 2, and anINSERTplus aDELETEof one item left it stored. Read transactions that named an item twice ran too. DynamoDB refuses all of these before running any statement, so code tested on the in-memory backend failed in production.The memory backend now refuses them with the
ValidationExceptionthat itsTransactWriteItemsandTransactGetItemsalready give, "Transaction request cannot include multiple operations on one item" (dynamoxy.ValidationError). Statements are compared by the key they read or write, whatever the order of the key conditions, the form of a number (1and1.0) or whether the key comes from parameters. A statement whose table does not exist or that names no full key takes no part and fails on its own, as before. The error, and that such statements are left out, follow the tests of dynoxide-rs, which were captured against DynamoDB.Verified with a memory backend test in Rust, which failed before the fix: two updates of an item, an insert and a delete, key conditions in another order with a number written
1.0and parameters, and two selects; the refused transactions write nothing and leave their idempotency token free. A Python integration test checks theValidationErrorand that the item is unchanged. MiniStack runs such statements one after another (checked by hand), so that test skips it, like theORDER BYtest. The rest of the Rust and Python suites pass too.BatchExecuteStatementhas the same rule on DynamoDB ("Provided list of item keys contains duplicates"). The memory backend still runs both statements of such a batch; that and the other PartiQL gaps stay with #97.Fixes #75.
Checklist
make checkpasses locally (lint, types, clippy, consistency, Rust and Python tests)fctl session
Note
Low risk. It only changes the in-memory test backend, so that PartiQL transactions DynamoDB refuses now fail there too; the AWS backend and production paths are untouched.
What it does. The in-memory
ExecuteTransactionnow refuses a PartiQL transaction in which two statements address the same item, with the sameValidationExceptionthatTransactWriteItemsandTransactGetItemsalready return. Before, each statement was prepared against the pre-transaction items, so writes were silently lost. Statements are compared by table and key, regardless of key condition order, number form or parameters. A Rust memory-backend test, a Python integration test, a changelog entry and a docs line come with it.fctl review's first look at
e55c060· 5 files, +110 −1 · Review agent settings