Skip to content

docs(catalogs): GET /api/catalogs/measurements contract (chat#1850)#265

Merged
sweetmantech merged 1 commit into
mainfrom
feat/catalog-measurements-contract
Jul 6, 2026
Merged

docs(catalogs): GET /api/catalogs/measurements contract (chat#1850)#265
sweetmantech merged 1 commit into
mainfrom
feat/catalog-measurements-contract

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

What

Adds the OpenAPI contract for GET /api/catalogs/measurements?catalogId= — per-ISRC latest play counts for a catalog plus a server-derived valuation band { low, mid, high }.

Part of recoupable/chat#1850 (Valuation-first homepage / Catalog HQ) — the data plumbing deferred in chat#1801 / chat#1803. Documentation-driven: this contract merges first, then recoupable/api#757 implements it.

Contract

  • Query: catalogId (uuid, required). The catalog must belong to the authenticated account (resolved from credentials — Privy bearer or x-api-key — never from input).
  • 200: { status, measurements[], valuation, total_streams, catalog_age_years }
    • measurements[] — newest capture per ISRC: { isrc, title, playcount, measured_at }; never-measured songs omitted.
    • valuation{ low, mid, high } USD, derived at read time (not persisted, per the chat#1850 architecture decision) using the same model as the marketing valuation card (marketing/lib/valuation/computeCatalogValuation.ts): annual run-rate = lifetime streams ÷ catalog age (lifetime-average proxy; earliest Spotify release date, min 1y, default 5y when unknown) → NLS ($0.0035/stream × 1.25/1.4/1.6 all-DSP gross-up × 0.85 post-distribution × 0.75 post-royalty) → 10x/13x/16x master-catalog multiple.
  • Errors (only ones the implementation emits): 400 missing/invalid catalogId · 401 unauthed · 404 catalog unknown or owned by another account.

Changes

  • api-reference/openapi/releases.json — new path + 3 schemas (CatalogMeasurementsResponse, CatalogTrackMeasurement, ValuationBand), purely additive (surgical insertion, no re-dump; every pre-existing path/schema byte-identical, verified programmatically); JSON re-validated as parseable.
  • api-reference/songs/catalog-measurements.mdx — frontmatter-only reference page (docs#243 pattern).
  • docs.json — nav entry in the Catalogs group.

Merge order

  1. This PR (docs, base main) — the contract.
  2. recoupable/api#757 — the implementation (base main; the api test-branch PR flow was retired in api#750).

🤖 Generated with Claude Code


Summary by cubic

Adds the OpenAPI contract for GET /api/catalogs/measurements to return latest per-ISRC play counts and a server-derived valuation band. This unblocks the Catalog HQ valuation work in chat#1850; API implementation will follow.

  • New Features
    • New path GET /api/catalogs/measurements?catalogId= in api-reference/openapi/releases.json with schemas: CatalogMeasurementsResponse, CatalogTrackMeasurement, ValuationBand.
    • Response includes measurements[] (newest per ISRC), valuation { low, mid, high }, total_streams, catalog_age_years; errors: 400/401/404.
    • Valuation band is computed at read time and mirrors the marketing valuation model (no persistence).
    • Added api-reference/songs/catalog-measurements.mdx and nav entry in docs.json; changes are additive only.

Written for commit 8fadc64. Summary will update on new commits.

Review in cubic

…test playcounts + derived valuation band

Contract for the Catalog HQ homepage hero and chat#1803's deferred landing
polish (recoupable/chat#1850). Adds the OpenAPI path, three schemas
(CatalogMeasurementsResponse, CatalogTrackMeasurement, ValuationBand), a
frontmatter-only reference page, and the nav entry — additive only.

The band mirrors the marketing valuation card's model (lifetime-average
run-rate, NLS via 1.25/1.4/1.6 gross-up, 15% distribution, 25% royalties,
$0.0035/stream, 10/13/16x multiples) so marketing and chat can never drift.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3a387c71-9761-4172-87af-1254c72b4677

📥 Commits

Reviewing files that changed from the base of the PR and between 8c115d9 and 8fadc64.

📒 Files selected for processing (3)
  • api-reference/openapi/releases.json
  • api-reference/songs/catalog-measurements.mdx
  • docs.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/catalog-measurements-contract

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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

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