Repository navigation
fix(backend): bucket Minnesota/Alaska outside-group breakdown caps per (committee, direction) - #549
Merged
Merged
Conversation
Minnesota and Alaska applied maxBreakdownsPerCategory across all donors and industries from every outside group at once, so smaller groups could end up with zero donor rows and industry rows were genuinely dropped (Alaska: cap 20 spread over up to 40 buckets). Bucket by (committee, direction) before capping, matching Kentucky/Vermont, and stop capping industry rows entirely -- they are bounded per bucket by the 21-entry industry slug set, per the Ohio/Maryland pattern. Vermont collected its manual-label classifications from post-cap donor rows, so donors past the cap never reached the label queue. Move collection into the aggregator, before the cap, and return it as outsideDonorClassifications. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR groups Alaska and Minnesota breakdowns by committee and support direction. Donor caps apply per group, while industry rows remain uncapped. Vermont aggregation now returns donor classifications, and synchronization consumes them. ChangesOutside-group finance processing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant VermontOutsideGroupContributionAggregator
participant ClassificationMergeService
participant VermontCandidateFinanceSync
participant FinanceLabelClassificationInsert
VermontOutsideGroupContributionAggregator->>ClassificationMergeService: merge qualifying donor classifications
ClassificationMergeService-->>VermontOutsideGroupContributionAggregator: merged classifications
VermontOutsideGroupContributionAggregator-->>VermontCandidateFinanceSync: outsideDonorClassifications
VermontCandidateFinanceSync->>FinanceLabelClassificationInsert: insert donor classifications
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
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.
Problem
The Minnesota and Alaska outside-group contribution aggregators applied
maxBreakdownsPerCategoryglobally — sorting and slicing across all donors and industries from every outside group at once — instead of per(committee, direction)bucket like Kentucky and Vermont do.With up to 20 groups × 2 directions, smaller groups could end up with zero donor rows, and industry rows were genuinely dropped. Alaska was worst: its sync passes a cap of 20 (
alaskaCandidateFinanceSync.ts:92), spread across up to 40 buckets.Separately, Vermont's
collectOutsideClassificationsread post-cap donor rows, so any donor past the cap never reached the manual label queue.Changes
Minnesota (
minnesotaOutsideGroupContributionAggregator.ts) and Alaska (alaskaOutsideGroupContributionAggregator.ts):toBreakdownsnow buckets donors by(committee, direction)and applies the cap inside each bucket, matching the Kentucky/Vermont shape. Buckets are emitted in a stable key order.FINANCE_INDUSTRY_SLUGS(21 entries), following the Ohio/Maryland pattern documented oncapDonorBreakdownsinohioCandidateFinanceSync.ts(commit 893c950).Vermont (
vermontOutsideGroupContributionAggregator.ts,vermontCandidateFinanceSync.ts):outsideDonorClassifications, collected from every donor at or aboveminIndustryAmountbefore the display cap.collectOutsideClassificationshelper (deleted), which re-classified only surviving post-cap rows. Same amount threshold as before — the only change is coverage.No cap defaults or wiring changed; this is purely where the cap is applied.
Tests
outsideDonorClassifications.finance_label_classificationsupsert.Follow-up (not in this PR)
Kentucky and Vermont still cap industry rows per bucket. Harmless at their default cap of 50, but a two-line change each if you want strict Ohio parity.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests