Repository navigation
Conversation
Charge-based delta rating dropped every zero-total detailed line, which removed free usage and zero-usage tier lines that legacy invoices display. Subtraction now keeps a current line when the pricer emitted it as a deliberate zero (zero quantity or zero unit price), on both the current-only and matched-delta paths. Deliberateness is judged per source line before aggregation so offsetting corrections never qualify, and the behaviour is opt-in so correction arithmetic against already billed periods stays silent. Un-skips the two compatibility tests that preserved the legacy expectations.
…detection A negative quantity at a zero unit price is a correction, not a pricer-emitted free usage line. Guard the predicate against it and cover the default matched delta path that drops a deliberate zero when the option is not passed.
State the non-negative quantity requirement and that an unchanged deliberate zero is emitted on every run.
The deliberate zero flag describes the current source line, but the matched delta is a new line. A free usage decrease yields a negative quantity at a zero unit price, which is a correction and must not be kept.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
borosr
force-pushed
the
fix/om-588-keep-deliberate-zero-detailed-lines
branch
3 times, most recently
from
October 26, 2026 22:46
a882689 to
0f1841a
Compare
Contributor
|
This is part of the #5361 pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a deliberately failing regression test against #5361: after the first two progressive invoices account for all free-tier usage, the third rating still emits an empty free-tier detail.
Synthetic example: the first 10 units are free, then usage costs $1/unit.
The actual third result also contains
0 units × $0forgraduated-tiered-1-price-usage. The cumulative free-tier quantity remains 10, and subtracting the 5 + 5 previously booked units yields an empty delta that is retained byWithDeliberateZeroLinesKept().The test uses the production delta engine and existing three-phase harness, carrying every prior result forward as billed history. It checks rating output rather than creating persisted invoices. No production behavior is changed.
Validation: the focused test was run during reproduction on parent revision
8f50747cf02b5ed72a06eddc7dd0d969da984152; phases 1 and 2 pass and phase 3 fails on the extra zero-value detail. This draft intentionally preserves that failure.

Confidence Score: 5/5
No additional changes are required by this review; the draft's intentionally failing third phase remains as acknowledged.Summary
Adds a three-phase regression test for exhausted free-tier carry-over. Production behavior is unchanged.
Reviews (1) · Last reviewed commit: "test(billing): reproduce exhausted free ..." · Reviewed by Greptile