Skip to content

Promote test → main: songstats backfill backoff (#673) + measurement-jobs card gate (#671)#675

Merged
sweetmantech merged 3 commits into
mainfrom
test
Jun 16, 2026
Merged

Promote test → main: songstats backfill backoff (#673) + measurement-jobs card gate (#671)#675
sweetmantech merged 3 commits into
mainfrom
test

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Promotes test to main. Contents:

main has no commits test lacks — clean promotion.


Summary by cubic

Promotes testmain with a smarter Songstats backfill that backs off and defers under rate limits, plus a free‑tier card gate with instant backfill start for measurement jobs. This reduces API churn and speeds up time to first data.

  • New Features
    • Songstats backfill: bounded exponential backoff on 408/429/502/503/504. When retries are exhausted, set the row to pending without spending quota, stop the batch, and release remaining claimed rows.
    • Clear status handling: 200 writes history and records one hit; 404/other terminal 4xx mark done and record a hit.
    • Measurement jobs: free‑tier card gate using Stripe Checkout mode: "setup" (collect card, no subscription) and auto‑start of the backfill drain after enqueue.

Written for commit 5fa5e3a. Summary will update on new commits.

Review in cubic

…ckfill drain (#671)

Two chat#1796 refinements on the historical (Songstats) path:

1. Free-tier card-on-file link. The gate was issuing the paid subscription
   checkout ($99/mo after a 30-day trial). New createCardOnFileSession uses
   Stripe Checkout `mode: "setup"` — collects a card for $0, no subscription,
   no Stripe product. The account then pays only for metered usage via credits.

2. Instant drain. After enqueuing a historical job, fire-and-forget
   start(songstatsBackfillWorkflow) so the backfill begins immediately instead
   of waiting up to 24h for the cron. Safe by reuse: the workflow's budget gate
   (limit − reserve − rolling-30d ledger) caps it to the Songstats quota and
   SKIP LOCKED prevents double-claiming with the daily cron, which stays as the
   backstop. Only kicks when something was actually enqueued.

26 new/updated unit tests; research+stripe+workflows suite 453 green; tsc/lint/format clean.
…t#1797) (#673)

Pacing/backoff + per-step logging for the Songstats backfill drain (chat#1797 bullets 1 & 3). Bounded exponential backoff (fetchSongstatsWithBackoff, 502/503/504/408/429), defer-to-pending past the bound with claimed-batch release, per-step + per-batch logging.
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api Building Building Preview Jun 16, 2026 9:42pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sweetmantech, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 7 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5577e435-5c1a-49c5-87e1-9e120cfed0fd

📥 Commits

Reviewing files that changed from the base of the PR and between e10217e and 5fa5e3a.

⛔ Files ignored due to path filters (5)
  • app/workflows/__tests__/backfillTrackStep.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by app/**
  • app/workflows/__tests__/songstatsBackfillWorkflow.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by app/**
  • lib/songstats/__tests__/fetchSongstatsWithBackoff.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/songstats/__tests__/isRetryableStatus.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
  • lib/supabase/songstats_backfill_queue/__tests__/updateSongstatsBackfillQueue.test.ts is excluded by !**/*.test.*, !**/__tests__/** and included by lib/**
📒 Files selected for processing (6)
  • app/workflows/backfillTrackStep.ts
  • app/workflows/releaseClaimedRowsStep.ts
  • app/workflows/songstatsBackfillWorkflow.ts
  • lib/songstats/fetchSongstatsWithBackoff.ts
  • lib/songstats/isRetryableStatus.ts
  • lib/supabase/songstats_backfill_queue/updateSongstatsBackfillQueue.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant