fix(aws): round-trip typed DynamoDB cursors and allow percentile-only CloudWatch statistics
Merged
WA
2d ago+208+208+012345678901234567890123456789-40-40-01234567890123456789
Summary
Fixes from the v0.9.55 release review (#9963) that touch the AWS sweep (#9952/#9961).
- DynamoDB pagination cursors round-trip for every key type.
lastEvaluatedKeyencoded integers a JS number can't hold, and binary keys, as plain strings. Passed back asexclusiveStartKey, they went out asS, so fetching the next page failed the key type check.- The cursor now encodes those values as
{ N }/{ B }(key attributes are always scalar, so this can't collide with a real key value), andexclusiveStartKeydecodes them back toNumberValue/ binary. - String and safe-number cursors are unchanged, and item output is byte-identical.
- Not a regression from
main, where these tables failed on page 1 (BigInt serialization).
- CloudWatch
get_metric_statisticsaccepts percentile-only requests.statisticsis optional on the tool and in the contract, which now requires at least one ofstatistics/extendedStatistics.- Direct and agent calls that pass only
extendedStatisticsno longer fail the required-param check. - The block is unchanged: its Statistics field is still required and always populated, and
ExtendedStatisticsstill takes precedence when both are set.
Not changed: the review note on dynamodb-get (expression attribute names without a projection) doesn't apply. tools/dynamodb/get.ts only forwards names together with a projection, and the contract has no other caller.
Type of Change
- Bug fix
Testing
- New regression tests, each red on the pre-fix code:
- DynamoDB cursor round trip: large-number and binary keys come back as
N/B, while strings and safe numbers are unchanged. - CloudWatch percentile-only request: passes the required-param check and the contract.
- The "neither statistic" rejection, pinned to the refine and guard-revert checked.
- DynamoDB cursor round trip: large-number and binary keys come back as
vitestacross DynamoDB, CloudWatch, the AWS contracts, the stale-input test and the block tests: 45 passed.check-block-registry.ts origin/staging,check:tool-metadata,check:docs,check:integration-catalog,check:unused-exports,check:utils,check:test-patterns,check:explicit-any,check:api-validation:strictand biome pass./simplifyand/cleanuprun on the diff.- Type-check runs in CI.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)