Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughSubscription refunds now reverse quota usage through the same database transaction that updates the pre-consume record. A shared helper handles locking and validation. Integration tests verify idempotent reversal and refunded record state. ChangesSubscription refund consistency
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change makes subscription pre-consume refunds update the balance and refund record atomically, reducing the chance of duplicate refunds on retry. No actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant RefundSubscriptionPreConsume
participant postConsumeUserSubscriptionDeltaTx
participant UserSubscription
participant SubscriptionPreConsumeRecord
RefundSubscriptionPreConsume->>postConsumeUserSubscriptionDeltaTx: apply negative pre-consumption delta
postConsumeUserSubscriptionDeltaTx->>UserSubscription: lock and update AmountUsed
RefundSubscriptionPreConsume->>SubscriptionPreConsumeRecord: mark record refunded in the same transaction
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue
✨ 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 |
|
@Calcium-Ion @t0ng7u 麻烦有空时 review 一下这个 PR。 范围:仅 #5556 — 订阅预扣退款在同一事务内回退 |
|
Rebased onto latest Same conflict surface as #6090: Local verification:
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
已 rebase 到最新 新 head 上 CI 全绿: 范围未变,仍只是 #5556:让订阅预扣的退款保持原子性。 @Calcium-Ion @seefs001 有空时麻烦看一下。这个和 #6090 是同一片代码(订阅预扣),建议一起过,顺序上先 #6089 更省事。 |
Important
📝 变更描述 / Description
将订阅预扣退款改为在同一数据库事务内回退 user_subscriptions.amount_used,并标记 subscription_pre_consume_records 为 refunded。原先在事务中调用 PostConsumeUserSubscriptionDelta 会新开事务,可能出现额度已退回但记录状态未更新,导致重试重复退款。
This PR was AI-assisted and manually reviewed before submission.
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Summary by CodeRabbit
Bug Fixes
Tests