Repository navigation
fix(aggregator): sanitize feed charges at loadFeed — isChargeRow drop-and-count (#2445) - #3437
Conversation
…-and-count, surfaced in usage provenance (#2445)
ac2f33e to
4d7f643
Compare
|
Rebased onto current main (now including #2446 subscriptions sanitization and the sibling #2439 chargesAttention fix, PR #3435) — conflicts resolved as unions in feed.ts/loadFeed and the test imports; the Codex P2 fix (chargesDropped in usage provenance) is included in the squashed commit 4d7f643. Laptop re-verified after rebase: bun test feed + charges-feed-gate + quota suites 63/63 pass. |
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. |
|
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 38 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb5c51348c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixes #2445. Queue task 5329 (follow-on of triage task 3660, CONFIRMED at main a17ae13).
Implements the pinned layer — sanitize at
loadFeedinpm-stack/aggregator/src/feed.ts, following the landed #2429 pattern (PR #3070), not whole-feed rejection and not a live.ts-only filter (loadFeed is the single shared gate for live.ts and server.ts consumers):isChargeRow(v)exported from feed.ts, built on the shared validate.ts primitives (isRecord,isFiniteNumber): a record with stringat/label/method/sourceand a finite-numberamountUsd(the ChargeRow shape, model.ts:1238-1247).loadFeedsanitizes the charges section the waysanitizeQuotaViewsanitizes quota: absent stays absent; a non-array section becomes[]counted as one dropped section; an array keeps onlyisChargeRowentries viaarrayOf, malformed rows dropping individually.chargesDroppedis attached to the returned feed when drops occur (mirroringquotaDropped).Tests (
test/feed.test.ts, following the sanitizeQuotaView pattern): isChargeRow accept/reject;[null]drops with count;[valid, null]keeps the valid row; missing/string amountUsd drop individually; non-array string and object each yield[]with the drop surfaced; absent section stays absent; well-formed feed unchanged through isFleetFeed + loadFeed (collector self-acceptance).Laptop:
bun test test/feed.test.ts24/24 pass;test/charges-feed-gate.test.ts+test/quota.test.ts27/27 pass. Note:bunx tsc --noEmithas pre-existing failures on clean main (e.g. test/charges-collect.test.ts ChargeRow literals) — unrelated to this change.Need help on this PR? Tag
@codesmith-botwith what you need.