Move the program earnings and bounties pages to the shared partner endpoints #4683
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 501 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.372
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4683"
general
weight: 0.35
Joker666
Changes
Fixes https://linear.app/dubinc/issue/ENG-1782/move-the-per-program-earnings-pages-to-the-shared-partner-earnings
Fixes https://linear.app/dubinc/issue/ENG-1843/move-the-partner-program-bounties-routes-to-the-shared-bounties
Clients
/api/partner-profile/earningswithprogramIdOrSlug.lib/analytics/use-partner-date-range.tsand the program pages use it too.API
GET /api/partner-profile/programs/[programId]/earnings,/countand/timeseries, and the oldusePartnerEarningsTimeseriesandusePartnerEarningsCounthooks.GET /api/partner-profile/earningsacceptsstartingAfterandendingBefore. The cursor must match the same filters (partner, program, status, dates and others), otherwise the route returns 422. Offset and cursor pages sort the same way.Bounties
GET /api/partner-profile/bountiesacceptsprogramIdOrSlug. With it, the route loads that one enrollment withgetProgramEnrollmentOrThrow, like the old per-program route: any enrollment status, and 404 when the partner is not in the program. Without it, it returns the bounties of all active programs, as before.GET /api/partner-profile/programs/[programId]/bountiesand theusePartnerProgramBountieshook. The program Bounties page and the program sidebar badge useusePartnerProfileBounties({ programIdOrSlug })./programs/[programId]/bounties/[bountyId]and itssocial-content-stats) stay for now.Motivation
dubinc/dub#4649 added the shared earnings endpoints, and dubinc/dub#4684 added the shared bounties endpoint. The per-program routes already called the same functions. This moves the last clients over so there is one set of routes for each. The list gets cursor pagination before it can become part of the public Partner API.
How to test
1. Run
pnpm devinapps/weband log in topartners.localhost:8888as a partner with earnings in a program.2. Open
/programs/<slug>,/programs/<slug>/earningswith a filter (for example?status=pending), a customer page and a payout. The network panel shows only/api/partner-profile/earningsrequests withprogramIdOrSlug, and the data matches before.3. Open
/api/partner-profile/earnings?startingAfter=<earning ID>&pageSize=2. It returns the next 2 earnings by ID.4. Open
/programs/<slug>/bounties. The page and the sidebar badge send one/api/partner-profile/bounties?programIdOrSlug=<slug>request./bountiesstill lists the bounties of all programs.5. Run
pnpm exec playwright test playwright/api/partner-profile/earnings.spec.ts playwright/api/partner-profile/bounties.spec.ts --project=apiinapps/web.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Partner earnings lists support cursor-based pagination, with validation for invalid cursors and cursors from another program.
Improvements
Earnings filters and counts are consistent across program, customer, payout, and performance views.
Shared date-range selections keep partner analytics charts and summaries aligned.
Earnings tables support sorting by date, amount, and earnings.
Payout and performance views use consistent earnings data and filters.
Bounty lists can be filtered to a specific program.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->