Repository navigation
fix(memory): PartiQL and expressions follow DynamoDB's rules, and hand-written conditions get no redundant parentheses - #135
Merged
kalaspuff merged 4 commits intoOct 31, 2026
Conversation
…d-written conditions get no redundant parentheses The in-memory backend accepted PartiQL batches, transactions and statements that DynamoDB refuses, ignored ALL_OLD in batches and transactions, parsed no negative numbers after keywords, and reported PartiQL capacity differently; expressions had no operator limit, no refusal of redundant parentheses, empty attribute names or contains(a, a), and a few messages differed. Rules and messages follow what dynoxide-rs captured against DynamoDB. Hand-written conditions combined with & and | compiled to redundant parentheses, which DynamoDB refuses; they now compile without their own. Refs #97 Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
Also say in the guides that transactions double the table's write units only, not the indexes'. Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…espace get no second pair Co-authored-by: Carl Oscar Aaro <[email protected]>
This was referenced Oct 31, 2026
fix(models): numbers of union fields render as stored, and literals of plain enum members write
#126
Merged
Contributor
Author
|
Stack of 10 pull requests, merged in this order with "Squash and merge":
|
3 of 4 tasks
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 handled PartiQL and expressions differently from DynamoDB (#97), so tests passed where production fails. It now follows DynamoDB's rules and messages, as dynoxide-rs captured them against DynamoDB (its tests and notes give regions and dates):
BatchExecuteStatementthat mixes reads and writes is refused ("Read and write requests together in the same batch is not supported."), and so is one that names an item twice ("Provided list of item keys contains duplicates"). Both are refused before any statement runs.ReturnValuesOnConditionCheckFailure=ALL_OLDreturns the stored item inBatchStatementError.Item.ResourceNotFound, and unkeyed reads have DynamoDB's message.RETURNINGis refused with "Validation failed in TransactStatements[i]: RETURNING clause is not supported in ExecuteTransaction."ALL_OLDreturns the stored item inCancellationReason.Item.UPDATEorDELETEthat gives a key attribute two values ("Multiple conditions on same key pk ..."),DELETE ... RETURNING ALL NEW *, writes to an index,exists()("Unrecognized function: exists at 1:45:6", positions included), andLimit=0.set_add/set_deletewith another attribute than the one assigned, or with a value that is not a set, are refused, with DynamoDB's positions. Before,set_add(n, 5)added 5 to a number.attribute_exists()andattribute_not_exists()work.n BETWEEN -5 AND 5,... OR -3 < n).INDEXESincluded), aDELETEof a missing item costs a write, and batch reads and read transactions report their reads. Transactions double the table's write units but not the indexes', forTransactWriteItemstoo, as the guides now say.((a = :v))), empty attribute names (in items, nested maps andExpressionAttributeNames) andcontains(a, a)are refused with DynamoDB's messages._core._check_expressions, which the test suite uses to check built expressions, now also validates update paths.The stricter memory backend found a bug in dynamoxy itself:
dynamoxy.condition(...)compiled with its own parentheses, so&,|and~sent(#a0 = :v0) AND ((#a1 > :v1)), which DynamoDB refuses as redundant parentheses (MiniStack accepts it). Hand-written conditions now compile without parentheses of their own, and&,|and~add none to a part that one pair encloses already (condition("(a OR b)") & ...).Verified with Rust tests of the memory backend and the expression parser for each rule, with the captured messages and positions, and with Python tests of the condition builder and the expression checks. Old tests that encoded the accepted behaviour (two INSERTs of one item in a batch, deeply nested redundant parentheses) now check the refusal.
make checkpasses, including the Python suites on the memory backend and MiniStack.Refs #97: what no source settles is left, and described on the issue: the 255-byte limit of placeholder names, attribute names of 64 KB or more,
attribute_type(a, b)with a path as the type, placeholders with invalid characters (#a-b), and a read-only transaction on a missing table.Checklist
make checkpasses locally (lint, types, clippy, consistency, tests)Worth confirming
UPDATEwithoutSETorREMOVEis refused with "Statement wasn't well formed, can't be processed: UPDATE requires at least one SET or REMOVE clause". dynoxide-rs implements that wording but marks no capture for it.fctl session
Note
Medium risk. It makes the in-memory DynamoDB and the expression parser stricter (new refusals and messages, changed capacity numbers) and changes the expression text that
dynamoxy.condition(...)and&,|,~send to every backend, so tests that passed before may now fail.What it does. Brings the in-memory PartiQL and expression handling in line with what DynamoDB does, as captured by dynoxide-rs: mixed or duplicate PartiQL batches,
RETURNINGinExecuteTransaction, duplicate key conditions,exists(), writes to an index, redundant parentheses, expressions over 300 operators and empty attribute names are refused,ALL_OLDfailures return the stored item, and consumed capacity is adjusted. It also fixes a bug in dynamoxy itself: hand-writtendynamoxy.condition(...)text no longer gets parentheses of its own, andAnd,OrandNotwrap a part only when one pair does not enclose all of it already, ignoring surrounding whitespace, so the generated expressions carry no redundant parentheses that DynamoDB refuses.Condition compile change.
RawCondition.compileno longer wraps its text andAnd,OrandNotuse a new_groupedhelper, so the expression strings sent to every backend for hand-written conditions change.fctl review's first look at
698d4de· 17 files, +861 −131 · Review agent settings