fix(cache): DynamoDBCache._clear only clears the first scan page#186
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the DynamoDB cache adapter's _clear method to properly handle pagination using LastEvaluatedKey, ensuring all items are deleted from large tables. It also optimizes the scan operation by using a ProjectionExpression to retrieve only the necessary keys. A new test case was added to verify the pagination logic; however, feedback suggests enhancing the test's mock implementation to explicitly assert that the ExclusiveStartKey is correctly passed in subsequent scan calls.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #186 +/- ##
==========================================
+ Coverage 87.59% 87.61% +0.02%
==========================================
Files 57 57
Lines 2927 2932 +5
==========================================
+ Hits 2564 2569 +5
Misses 363 363 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Addresses gemini-code-assist review on PR #186: the mock returned page 2 unconditionally, so the test passed even if _clear failed to thread LastEvaluatedKey -> ExclusiveStartKey. Now assert no cursor on the first scan and the prior page's key on subsequent scans, so the pagination logic is actually exercised. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Paginate the scan on LastEvaluatedKey/ExclusiveStartKey until exhausted (typed via ScanInputTableScanTypeDef, mirroring DynamoDBStore._iter_all_keys) so tables larger than the ~1 MB scan page are fully cleared. Closes #155 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Addresses gemini-code-assist review on PR #186: the mock returned page 2 unconditionally, so the test passed even if _clear failed to thread LastEvaluatedKey -> ExclusiveStartKey. Now assert no cursor on the first scan and the prior page's key on subsequent scans, so the pagination logic is actually exercised. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7915415 to
3a6da74
Compare
Closes #155
Paginates the scan on
LastEvaluatedKey/ExclusiveStartKeyuntil exhausted (typed viaScanInputTableScanTypeDef, mirroringDynamoDBStore._iter_all_keys) so tables larger than the ~1 MB scan page are fully cleared.Tests: existing dynamodb clear contract + new monkeypatched pagination test (2 passed). All gates green.
🤖 Generated with Claude Code