test(purchase): regression guard for parallel multi-account fan-out (#210) - #245
Conversation
…210) The companion TestExecuteMultiAccount_PartialFailure_IsolatesAccounts already pins per-account error isolation but would still pass if executeMultiAccount were refactored to a serial for-loop. Spec acceptance criterion E-2 calls out parallelism as a separate promise ("pick a sentinel that fails on a serial loop but passes on errgroup") — this test pins it. Two valid AWS accounts each block PurchaseCommitment for 300ms. Parallel fan-out completes in ~310ms; a serial loop takes ~600ms. The 500ms threshold sits comfortably between the two so CI scheduler jitter does not flake it but a serial-loop regression is caught (verified via local mutation: serial fails at ~603ms, parallel passes at ~310ms). Closes #210.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA concurrency regression test is added to verify that multi-account purchase execution runs in parallel across AWS accounts rather than serially. The test mocks two accounts with timed calls, asserts completion within a parallel upper bound, and verifies correct execution record counts and mock interactions. ChangesMulti-Account Execution Parallelism Test
Sequence Diagram(s)(Skipped: test-only change with no new feature or control flow modifications) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Closes #210 — adds the parallelism regression guard for
executeMultiAccountthat the existingTestExecuteMultiAccount_PartialFailure_IsolatesAccountsdoesn't catch.The existing isolation test would still pass if the fan-out were refactored into a serial
forloop. Spec acceptance criterion E-2 explicitly calls out parallelism as a separate promise — this test pins it.Mechanics
PurchaseCommitmentmock blocks for 300 ms.executePurchasecall.Verified locally via mutation testing: rewrote
executeMultiAccountto a serialforloop and ran the test:After restoring the errgroup-style fan-out the test passes at ~310 ms.
What this does NOT cover (per #210 out-of-scope)
CUDLY_MAX_ACCOUNT_PARALLELISM(separate ticket if needed).Test plan
go test ./internal/purchase/ -run TestExecuteMultiAccount_RunsAccountsInParallel -v -count=1— passes at ~310 ms.go test ./internal/purchase/ -count=1— full package green.go build ./...clean.go vet ./...clean.Summary by CodeRabbit