Repository navigation
refactor(handlers): introduce repository layer for external-id-audit-handler (#1237 pattern) - #1287
Conversation
…handler Move all direct @aws-sdk/* imports (CloudWatch, DynamoDB, lib-dynamodb) out of the route handler into a dedicated repository module. The handler now consumes plain JS objects from a single typed boundary; the repository owns AWS SDK Command construction + marshalling. Demonstrates the migration pattern that Issue #1237 calls for. Follow-up PRs continue the same extraction for the remaining baselined handlers (describe-stack-handler / generic-scoring-handler / portal-handler etc). - new infrastructure/lib/.../external-id-audit-handler/repository.ts - index.ts shrinks from 167 to 118 lines, no SDK imports remain - new infrastructure/test/.../external-id-audit-handler-repository.test.ts asserts SDK Command shapes (PutItem / GetItem / Query / PutMetricData) - existing handler test updated to mock the repository (not the SDK) Closes #1237
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 38 minutes and 45 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1287 +/- ##
=======================================
Coverage ? 64.28%
=======================================
Files ? 253
Lines ? 8476
Branches ? 2673
=======================================
Hits ? 5449
Misses ? 2199
Partials ? 828 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Move every direct
@aws-sdk/*import out ofexternal-id-audit-handler/index.tsinto a dedicated repository module. The handler now consumes plain JS objects from a single typed boundary; the repository owns AWS SDK Command construction + DynamoDB marshalling.This PR demonstrates the migration pattern Issue #1237 calls for, using one representative handler as the proof-of-concept. Follow-up PRs continue the same extraction for the remaining baselined handlers (
describe-stack-handler,generic-scoring-handler,portal-handler, etc).Changes
infrastructure/lib/problem-deploy/handlers/external-id-audit-handler/repository.ts(165 lines) — owns CloudWatch + DynamoDB + lib-dynamodb client construction, Command shapes, and item marshallingindex.tsshrinks from 167 → 118 lines and contains zero SDK importsinfrastructure/test/.../external-id-audit-handler-repository.test.ts(116 lines) — 8 unit cases assertingPutItemCommand/GetItemCommand/QueryCommand/PutMetricDataCommandare built with the expected shape (PK / SK / TTL / metric dimensions)external-id-audit-handler.test.ts) updated to mock the repository (not the SDK directly) — coverage preserved, mock boundary clearer.claude/harness/baselines/handler-no-direct-sdk-import.json— 6 baselined SDK-import violations removed (external-id-audit-handler is now clean per the rule introduced in feat(#986): SOLID 強制を harness に実装 (file-too-large / handler-no-direct-sdk-import + biome complexity) #1004)Closes #1237
Regression analysis
Physical impact
external-id-audit-handlerLambda bundle (separation of concerns; no runtime behavior change; minified bytes nearly identical).repository.ts(impl) +*-repository.test.ts(test)..claude/harness/baselines/handler-no-direct-sdk-import.json.Migration roadmap (for follow-up PRs)
Remaining baselined handlers (each ~1 PR worth):
describe-stack-handlergeneric-scoring-handlerportal-handlercompetitor-accounts-handlerparticipant-handler(largest; recently zod-validated in PR feat(participant-handler): zod-validate every route boundary #1274 — defer)deploy-handler