Repository navigation
fix(aggregator): consume feed charges outside the saas gate (#3124) - #3171
Conversation
|
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 59 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8815eb87d7
ℹ️ 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".
| services: applySupabaseExport(applyCloudflareExport(extractSaasServices(doc), cfExport), supabaseExport), | ||
| payg: extractPaygLines(doc, registryText), | ||
| charges: extractCharges(doc, registryText), | ||
| charges: [...feedCharges, ...extractCharges(doc, registryText).filter((c) => !feedChargeKeys.has(chargeKey(c)))], |
There was a problem hiding this comment.
Reuse charge-level deduplication for the fallback merge
When a feed without SaaS data contains an auto-collected charge also recorded in the local quota view, full-row equality fails to recognize the duplicate: feed rows use sources such as Plaid or Gmail alert, whereas extractCharges() uses descriptive evidence strings and may have different labels or dates. This merge therefore displays the same charge twice and inflates the total calculated in render.ts's chargesStripHtml(). The existing mergeChargeRows() in charges-collect.ts already handles these differences and gives automatic evidence precedence; reuse that charge-level merge instead of reintroducing duplicate prose evidence.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 4ea1b99 — correct catch. The fallback merge now reuses mergeChargeRows(feedCharges, extractCharges(...)) from charges-collect.ts: charge-level matching (amount + 3-day window + normalized merchant containment) with the automatic feed evidence taking precedence, instead of my full-row-identity dedupe. Added a regression test where the same charge exists in both the feed (source plaid, dated 2026-10-27) and the quota-view prose (extractor row dated 2026-10-25 with a descriptive source string): usage() returns exactly one row, the feed's. Targeted suites pass (charges-feed-gate, charges-collect, usage, supabase-export: 54/54).
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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 #3124.
liveSource.usage()consumed the fleet feed's charge evidence (feed.charges) and the unmatched-charge attention flags (feed.chargesAttention) only inside theif (feed?.saas && feed.saas.length)gate. A feed carrying valid charges but no saas section — or the quota-view fallback path, or the fixtures fallback — silently dropped every auto-matched charge.Per the pinned form from triage task 4544:
feedCharges+feedChargeFlagsonce, before the branch.Tests (laptop,
bun testin pm-stack/aggregator):test/charges-feed-gate.test.ts: 3 pass — quota-view fallback and fixtures fallback now surface a no-saas feed's charges + flags; saas path unchanged. The two fallback tests fail on the pre-fix code (verified by stashing the fix), the saas-path test passes both ways.Queue task 4590 (lane C). Sibling fix #3122 (task 4542) touches the charges producer's surfaced-keys persistence, not this consumer.
Need help on this PR? Tag
@codesmith-botwith what you need.