Repository navigation
fix: subscription sync zero prorating cases (6/35) - #4364
Conversation
📝 WalkthroughWalkthroughAdds ChargeID getters and an IncludeChargeManaged flag to invoice line contracts, filters DB queries to optionally exclude charge-managed lines, updates the subscription persisted-state loader to request non-charge-managed lines, implements zero-proration cleanup in flat-fee invoice patching, and adds a credit-then-invoice test suite. ChangesCharge-aware invoice line separation and zero-amount handling
Sequence Diagram(s)No sequence diagram generated. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
680082d to
490ad65
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go`:
- Line 802: Fix the typo in the inline comment next to the duration check in the
test (the expression using line.ServicePeriod.Duration() != time.Hour*24);
change "1 dqy" to "1 day" so the comment correctly reads that all other lines
will be 1 day.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a520143c-a7ef-4ffb-b4fa-b3a72a35e085
📒 Files selected for processing (1)
openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go
Summary
GetLinesForSubscriptionInput.IncludeChargeManaged.GetChargeID()on generic invoice line readers and both gathering/standard line bases so callers can reason about charge-owned invoice lines consistently.charge_idcheck and fixing the CodeRabbit typo comment.Verification
env POSTGRES_HOST=127.0.0.1 go test -count=1 -tags=dynamic ./openmeter/billing/worker/subscriptionsync/service -run '^TestCreditThenInvoiceScenarios$'SUCCESSwith no current actionable findings.Summary by CodeRabbit
New Features
Bug Fixes
Tests