feat: billing use streaming specified minimum resolution [OM-1469]#3149
feat: billing use streaming specified minimum resolution [OM-1469]#3149
Conversation
📝 WalkthroughWalkthroughThis change standardizes all billing, invoicing, and subscription time truncation and period comparison logic to use a unified 1-second resolution constant ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Possibly related PRs
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (17)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
add45a6 to
df1564b
Compare
3c8bbb8 to
c7c0f07
Compare
Overview
This patch ensures that the whole billing stack uses 1s resolution for both usage_based/metered and usage_based/flat_fee lines.
This is required as due to collection moved to the draft invoices if an invoice contains both types, we might create two invoices.
The overal approach is that all inputs to billing is sanitized to use per second resolution entries, plus a migration is added so that subscription sync will fill the gaps between the lines of the same subscription item. This is done at multiple places:
We are not updating the old invoices to prevent changes in already issued invoices.
Summary by CodeRabbit
Bug Fixes
Chores
Documentation