refactor(frontend/plans): drop redundant setPlanAccounts call (closes #745)#861
refactor(frontend/plans): drop redundant setPlanAccounts call (closes #745)#861cristim wants to merge 2 commits into
Conversation
|
@coderabbitai review |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe ChangesPlan Persistence Update/Create Branching
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
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 unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Adversarial verification: this PR is NOT safe to merge as-is. It removes the frontend |
|
@coderabbitai full review Generated by Claude Code |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Fetch the PR diff
gh pr view 861 --repo LeanerCloud/CUDly --json title,body,files,commits,state
echo "=== PR DIFF ==="
gh pr diff 861 --repo LeanerCloud/CUDlyLength of output: 3363 🏁 Script executed: #!/bin/bash
# Check backend store for CreatePurchasePlan and plan_accounts handling
echo "=== CreatePurchasePlan in store_postgres.go ==="
rg -n "CreatePurchasePlan\|plan_accounts\|SetPlanAccounts\|target_accounts" --type go -A 5 -B 2
echo ""
echo "=== PlanRequest type ==="
rg -n "PlanRequest\|target_accounts\|TargetAccounts" --type go -A 20 -B 2
echo ""
echo "=== plans handler / createPlan endpoint ==="
rg -n "createPlan\|CreatePlan\|setPlanAccounts\|SetPlanAccounts" --type go -C 5Length of output: 851 🏁 Script executed: #!/bin/bash
# Check frontend plans.ts for the diff context
echo "=== Frontend plans.ts setPlanAccounts references ==="
rg -n "setPlanAccounts\|savedPlanId\|createPlan\|target_accounts" --type ts -C 5
echo ""
echo "=== Issue `#743` and `#745` references in code or comments ==="
rg -rn "`#743`\|`#745`\|`#973`" -C 2Length of output: 661 🏁 Script executed: #!/bin/bash
# Find all Go and TS files
echo "=== Go files ==="
fd -e go | head -50
echo ""
echo "=== TS files ==="
fd -e ts | head -30Length of output: 3077 🏁 Script executed: #!/bin/bash
# Try finding the handler and store files
echo "=== handler_plans.go ==="
fd "handler_plans" | xargs cat 2>/dev/null || echo "not found"
echo ""
echo "=== store_postgres.go ==="
fd "store_postgres" | xargs cat 2>/dev/null || echo "not found"
echo ""
echo "=== api/types.go ==="
fd "types.go" --full-path | head -5 | xargs cat 2>/dev/null || echo "not found"Length of output: 270284
Full Review: PR
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Re-review verdict: VERIFIED-CORRECT (supersedes the earlier NOT-FIXED note)The earlier NOT-FIXED verdict is stale. It predated the #742/#743 create-path account-persistence work that is now on Deciding evidence: the FE create body DOES send
|
Add regression guards that will fail if PR #861 is reverted: the create path must not call setPlanAccounts (backend persists plan_accounts atomically from target_accounts in the POST body). Also assert the update path still calls setPlanAccounts, completing the behavioral contract.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Add regression guards that will fail if PR #861 is reverted: the create path must not call setPlanAccounts (backend persists plan_accounts atomically from target_accounts in the POST body). Also assert the update path still calls setPlanAccounts, completing the behavioral contract.
|
@coderabbitai review |
✅ Action performedReview finished.
|
On the create path, backend already inserts plan_accounts atomically inside createPlan (landed in #743). Move setPlanAccounts inside the update branch so it only fires on PUT, eliminating the double write.
Add regression guards that will fail if PR #861 is reverted: the create path must not call setPlanAccounts (backend persists plan_accounts atomically from target_accounts in the POST body). Also assert the update path still calls setPlanAccounts, completing the behavioral contract.
Summary
api.setPlanAccountsinside theif (planId)(update) branch, removing it from the create pathplan_accountsatomically insidecreatePlan(landed in fix(plans): eliminate universal plans — require target_accounts on creation #743), so the follow-up PUT was a redundant double-writesavedPlanIdvariableTest plan
npx tsc --noEmit-- no type errorsjest --no-coverage-- 65 suites, 2142 tests pass (0 failures)rejects submit and never calls createPlan when Target Accounts is emptystill assertssetPlanAccountsnot calledforwards selected target_accounts on createPlanverifies create body still includestarget_accountsSummary by CodeRabbit