Repository navigation
fix(client): batch and transaction writes return the item collection metrics they ask for - #118
Merged
kalaspuff merged 1 commit intoOct 31, 2026
Conversation
…metrics they ask for batch_write_item and transact_write_items accept return_item_collection_metrics=True, the core asks for and parses the metrics, and the in-memory DynamoDB computes them, but the binding built the output dicts without them and the stub's TypedDicts left the key out. Both outputs now carry item_collection_metrics, a list of metrics per table, as put_item, update_item and delete_item carry theirs. Fixes #95 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
batch_write_itemandtransact_write_itemsacceptreturn_item_collection_metrics=True, the core asks DynamoDB for the metrics and parses them, and the in-memory DynamoDB computes them, but the binding built both output dicts without them, and the stub's TypedDicts left the key out. On a table with a local index,put_itemreturned its metrics, whilebatch_write_itemreturned onlyunprocessed_itemsandconsumed_capacity, andtransact_write_itemsonlyconsumed_capacity.client.call(...)is the documented way to reach these parameters.Both outputs now carry
item_collection_metrics: a dict of lists of metrics per table, empty when not asked for, typed in_core.pyi. The low-level access guide shows the parameter.Verified with an integration test that fails without the fix:
put_itemreturns the metrics on the in-memory backend and MiniStack, the outputs have the key on both, and on the in-memory backend a batch with a put and a delete and a transaction return one entry per write. MiniStack (1.5.33) returns metrics only for single-item writes, so those assertions run on the in-memory backend only.make checkpasses.Fixes #95
Checklist
make checkpasses locally (lint, types, clippy, consistency, tests)fctl session
Note
Low risk. It only adds a key to the dicts the native binding returns for two low-level operations, with no change to requests, retries or stored data.
What it does.
batch_write_itemandtransact_write_itemsalready asked DynamoDB for item collection metrics and the core parsed them, but the PyO3 binding dropped them when building the output dicts. The binding now returns anitem_collection_metricsdict of lists per table (empty when not requested), the stub types it, and the low-level access guide and changelog describe it. An integration test checks the key on both backends and the per-write entries on the in-memory backend.fctl review's first look at
1103e56· 6 files, +94 −4 · Review agent settings