test(purchase): regression guard for parallel multi-account execution isolation (closes #210) - #233
Conversation
… isolation (closes #210) Adds TestExecuteMultiAccount_PartialFailure_IsolatesAccounts to pin spec E-2: when account-I has invalid credentials and account-V has valid credentials, account-V's execution must complete with status=completed and its own CommitmentID, while account-I is recorded as failed. Assertions cover: both SavePurchaseExecution calls fire (no silent skip), account-V's record is completed with a purchase, account-I's record is failed with a non-empty error, no cross-account credential material leaks into account-I's error (log-sanitisation guard), and account-V's CommitmentID does not appear anywhere in account-I's record (result-data independence). The base exec CloudAccountID stays nil, confirming per-account copies are used throughout the fan-out. Test-only change; no production code modified.
|
@coderabbitai review |
|
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 regression test is added that validates multi-account purchase execution with proper isolation when one account fails credential resolution while another succeeds. The test verifies per-account error handling, cross-account data sanitization, and persistence of execution records. ChangesMulti-Account Execution Isolation Test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 0/5 reviews remaining, refill in 50 minutes and 49 seconds. Comment |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
specs/multi-account-execution/acceptance.md) required that one account's failure not fail others during parallel multi-account fan-out, but no automated test guarded this invariant — an inadvertent refactor (e.g., swapping the errgroup for a serial loop, or propagating a per-account error up the group) would silently regress the fault-tolerance promise.TestExecuteMultiAccount_PartialFailure_IsolatesAccountsininternal/purchase/execution_test.goseeds two accounts (V=valid credentials, I=invalid credentials), callsexecutePurchase, and asserts account-V completes while account-I is recorded as failed, with full result-data isolation between the two.What the test pins
SavePurchaseExecutioncalls firestatus=completed,PurchaseIDsetstatus=failed,errornon-emptyexecutePurchasereturns an error (I's failure is aggregated)exec.CloudAccountIDremains nilSpec coverage
Satisfies
specs/multi-account-execution/acceptance.mdscenario E-2.Test plan
go test ./internal/purchase/... -v -count=1 -run TestExecuteMultiAccount_PartialFailure_IsolatesAccounts— 1/1 passgo test ./internal/purchase/... -count=1— 100/100 passgo vet ./...— cleangofmt -l .— empty outputSummary by CodeRabbit