Repository navigation
fix(testing): purge_expired, inject_fault(table=) and replayed transactions behave like DynamoDB - #132
Merged
kalaspuff merged 2 commits intoOct 31, 2026
Conversation
…ctions behave like DynamoDB purge_expired() deleted items whose TTL is more than five years in the past, which DynamoDB never considers for expiry. inject_fault(table=...) only matched the first table of a call (never PartiQL statements), and unprocessed=True returned every table's requests unprocessed: a fault now matches any table a call uses and leaves only its table's requests unprocessed. A TransactWriteItems replayed with its token reported no consumed capacity; it now reports the transactional read DynamoDB bills. Fixes #98 Co-authored-by: Carl Oscar Aaro <[email protected]>
This comment has been minimized.
This comment has been minimized.
…e limit do 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":
|
This was referenced Oct 31, 2026
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 three test-helper issues of #98, all in the in-memory DynamoDB:
testing.purge_expired()deleted items DynamoDB's TTL never deletes. DynamoDB says "To be considered for expiry and deletion, the TTL can't be more than five years in the past", so a TTL of0or of ten years ago is left alone. The purge now deletes items whose TTL lies within five years (of 365 days) beforeat. The Rust test that usedexpires = 1_000and a Python test that used a TTL in 1970 encoded the wrong rule; they now check both sides of it.inject_fault(table=...)only looked at the first table of a call. A fault forbbbnever fired for aBatchWriteItem,BatchGetItemor transaction that also usesaaa, nor forSELECT * FROM bbb, since PartiQL calls passed no table. It stayed pending and fired on a later call. Also,unprocessed=Trueforaaareturned both tables' requests unprocessed. A fault now matches any table a call uses: batches, both kinds of transaction, and the tables PartiQL statements name. Anunprocessedfault for a table returns only that table's requests unprocessed and writes or reads the others.TransactWriteItemsreported no consumed capacity. DynamoDB bills a replay with the same token as a transactional read of the items the first call wrote. dynoxide-rs, whose tests are captured against DynamoDB, charges 2 read units per 4 KB of the larger of each item's old and new image, in the replay's ownReturnConsumedCapacitymode. The backend now remembers those sizes with the token and reports that.Verified with Rust tests of the memory backend (TTL bounds, faults for the second table of batches, transactions and PartiQL statements, partial unprocessed batch writes and reads, replay capacity), each failing without the fix, and the Python purge test.
make checkpasses.Fixes #98
Checklist
testingdocstrings, changelog)make checkpasses locally (lint, types, clippy, consistency, tests)Worth confirming
fctl session
Note
Low risk. It only changes the in-memory test backend and the
dynamoxy.testinghelpers, not the AWS adapter or production paths, but tests that relied on old TTLs being purged or on faults matching only a call's first table can behave differently.What it does. Makes three test helpers of the in-memory DynamoDB behave like the real service.
purge_expiredleaves items whose TTL is more than five years in the past,inject_fault(table=...)matches any table a call uses (batches, transactions and PartiQL statements) and anunprocessedfault returns only that table's requests unprocessed, and a replayedTransactWriteItemsnow reports consumed capacity as a transactional read of the items the first call wrote. Rust and Python tests, the testing guide, the docstrings and the changelog are updated.Behavior change for tests. Tests that purge items with a TTL of
0or one far in the past now keep those items, so they must use a recent TTL; "five years" is counted as 5 × 365 days, which may differ from DynamoDB by a day or two at the boundary.fctl review's first look at
213972d· 10 files, +254 −84 · Review agent settings