Repository navigation
fix(aggregator): validate github-billing items at the aggregation boundary (#2493) - #3445
Merged
Merged
Conversation
#2493) aggregateBillingUsage now skips items whose date (first 10 chars) is not a real calendar date (validate.ts isIsoDate), and quantity/grossAmount/netAmount contribute only when finite and non-negative (isNonNegative), otherwise 0. An impossible date previously derived records failing isSnapshotRecord, making the collector discard the whole month; negative amounts passed validation and were stored as usage. Regression tests cover both plus hostile-item records all passing isSnapshotRecord.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 1, 2026
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.
Fixes #2493. Queue task 5350 (repo-health-code-pilot, lane D); implementation of triage task 3732's pin.
Change —
pm-stack/aggregator/src/sources/github-billing.tsValidation moves to the aggregation boundary in
aggregateBillingUsage; the collector (scripts/collect-github-billing.ts) is unchanged:validate.tsisIsoDate— the strict primitiveisSnapshotRecordalready gates on). Impossible dates (month 13, Feb 30) no longer create a day bucket, so no derived record can failisSnapshotRecordand make the collector discard the whole month.quantity/grossAmount/netAmountcontribute only when finite and >= 0 (validate.tsisNonNegative), otherwise 0 — extending the existing non-number fallback. Negative or non-finite values are never summed into a day aggregate and never stored as usage.Tests —
test/github-billing.test.ts(+3)isSnapshotRecordand are positive.Laptop (worktree):
bun test test/github-billing.test.ts— 10/10 pass. Full aggregator suite on this branch: 227 pass / 37 fail, but the failures are pre-existing — verified against cleanmain(efe3875) in a scratch worktree:test/quota-current.test.tsfails identically there (1 fail,feed.ts:358 Unexpected export), and the remaining failures are 5s hook timeouts under laptop load ~100. None are in the touched file or its dependents.Acceptance: no billing item can make the collector discard a month; impossible dates never bucket; negative/non-finite never stored or summed; well-formed months aggregate exactly as before (existing tests unchanged and passing).
Need help on this PR? Tag
@codesmith-botwith what you need.