Repository navigation
fix(purchase): scope plan fan-out recommendations to each account - #793
Conversation
Each plan account now buys only its own recommendations and its row carries its own totals. A step with no recommendations, or a rec not attributed to one of the plan's accounts, fails loudly instead of completing or being dropped. Refs #631. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eal-recommendations
|
Warning Review limit reached
This review includes 7 billable files and costs up to $1.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 21 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 87 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (7)
Comment |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Gate verdict (gate-1, independent adversarial review on claude-opus-5-5): APPROVE at d0247a3, merging. Head history: I reviewed the production change at cf5320a. Since then: e6ad572 (two test-helper prealloc lines, checked), then d0247a3 (update-branch merge of main 7c0c9ad: frontend CSS and the go Paths: every plan execution enters through Fixtures: each changed fixture gives one rec per plan account. No assertion was removed or loosened. MultiAccount now also asserts 2 PurchaseCommitment calls and that each saved row carries only its own account's rec. The ramp counts (1/2/3/6) are unchanged. The rec-less guard and its tests are unchanged. Totals: per account, the sum of Fails-before and mutations (unit, real output):
Local runs, Non-blocking notes for PR2/PR3: Evidence is mocks and Postgres containers only; no live cloud calls. |
Refs #631 (PR1 of 6; does not close it)
What
Plan fan-out safety prerequisite.
executeMultiAccountcopied ALL of a step's recommendations to every plan account, so once steps carry real recs each account would buy every account's recs. Now:CloudAccountID; each account buys only its own, and its per-account row carries its ownTotalUpfrontCost/EstimatedSavings(A3);ErrPlanStepNoRecommendationsbefore the fan-out, instead of returning nil, being recorded completed and advancing the ramp (A1);No user-visible change today: plan steps still carry no recs and Add Purchases still returns 409.
Tests (fixture/mock evidence)
New: own-recs-and-totals, stray rec (nil and foreign account) fails, empty step fails and buys nothing, and
TestManager_ExecutePurchase_MultiAccountnow asserts 2 PurchaseCommitment calls (not 4). Mutation check: passing the unscoped base exec toexecuteForAccountfails that test. Existing multi-account fixtures updated to per-account recs.go test ./internal/purchase/,go test -tags integration ./internal/purchase/,go test ./internal/api/and the api retry/fanout integration tests pass, under the repo test lock.🤖 Generated with Claude Code