Skip to content

docs(catalogs): GET /api/catalogs/{catalogId}/valuations — persisted valuation history (chat#1889 row 15) - #279

Merged
sweetmantech merged 1 commit into
mainfrom
docs/catalog-valuations-series
Jul 29, 2026
Merged

docs(catalogs): GET /api/catalogs/{catalogId}/valuations — persisted valuation history (chat#1889 row 15)#279
sweetmantech merged 1 commit into
mainfrom
docs/catalog-valuations-series

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Contract-first PR for chat#1889 row 15 — the keystone (2026-07-29 reorder decision).

  • New GET /api/catalogs/{catalogId}/valuations: persisted history latest-first, limit (default 30, max 100; limit=1 = current value), rows { low, mid, high, measured_song_count, total_streams, measured_at }; 400/401/404 via the shared Error schema, mirroring the measurements sibling.
  • POST /api/valuation description notes that runs persist a history row.
  • New reference page + nav entry (surfaces in llms.txt).

Merge order: this → database#TBD (catalog_valuations table) → api#TBD (persist + GET). JSON re-validated after anchored edits.

🤖 Generated with Claude Code


Summary by cubic

Adds docs for GET /api/catalogs/{catalogId}/valuations, exposing a persisted valuation history so teams can compute week‑over‑week deltas and fetch the current value with limit=1. Supports the chat#1889 row 15 requirement to persist the valuation band wherever it’s computed.

  • New Features
    • New GET /api/catalogs/{catalogId}/valuations: latest‑first history, limit (default 30, max 100; limit=1 = current), rows include { low, mid, high, measured_song_count, total_streams, measured_at }; 400/401/404 via shared Error.
    • POST /api/valuation docs note each run persists a history row.
    • Added reference page and nav entry.

Written for commit 464b75f. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added an API endpoint to retrieve catalog valuation history, with results ordered from newest to oldest.
    • Added support for limiting returned valuation records, up to 100 entries.
    • Valuation results now document that each run is saved to catalog history.
  • Documentation

    • Added the Catalog Valuations API reference page.
    • Updated navigation for catalog valuation and card-on-file subscription documentation.

@cursor

cursor Bot commented Jul 29, 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 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The OpenAPI specification now documents persisted catalog valuation history and adds a retrieval endpoint with its response schema. A new API reference page and navigation entry expose the endpoint documentation.

Changes

Catalog valuation history

Layer / File(s) Summary
Valuation history API contract
api-reference/openapi/releases.json
Documents persisted valuation history, adds GET /api/catalogs/{catalogId}/valuations, and defines its validation, responses, and CatalogValuationsResponse schema.
API reference publication
api-reference/songs/catalog-valuations.mdx, docs.json
Adds the “Get Catalog Valuations” page and places it under the Catalog songs navigation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • recoupable/docs#272: Adds the related POST /api/valuation operation and schemas referenced by this update.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: documentation for the new catalog valuations endpoint and persisted history.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/catalog-valuations-series

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api-reference/openapi/releases.json`:
- Around line 2910-2913: Update the successful response status schema near the
existing status property to add an enum constraint containing only "success",
while preserving its string type and example.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 80d852ce-cda6-49bd-a79d-df10fe710445

📥 Commits

Reviewing files that changed from the base of the PR and between 96169e6 and 464b75f.

📒 Files selected for processing (3)
  • api-reference/openapi/releases.json
  • api-reference/songs/catalog-valuations.mdx
  • docs.json

Comment on lines +2910 to +2913
"status": {
"type": "string",
"example": "success"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Constrain successful response status to success.

The example implies "success", but the schema accepts any string. Add enum: ["success"] so generated clients receive the actual 200-response contract.

Proposed fix
 "status": {
   "type": "string",
+  "enum": ["success"],
   "example": "success"
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"status": {
"type": "string",
"example": "success"
},
"status": {
"type": "string",
"enum": ["success"],
"example": "success"
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/releases.json` around lines 2910 - 2913, Update the
successful response status schema near the existing status property to add an
enum constraint containing only "success", while preserving its string type and
example.

@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.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="api-reference/openapi/releases.json">

<violation number="1" location="api-reference/openapi/releases.json:2912">
P3: The `status` property in `CatalogValuationsResponse` uses `"example": "success"` and lacks a `description`, but every other schema in this file that defines a `status` field uses `"enum"` (e.g., `["success"]`, `["error"]`, or `["success", "error"]`) plus a `"description"`. Since this endpoint returns 200 only on success (errors use 4xx HTTP responses), align with the established pattern by replacing `example` with `enum: ["success"]` and adding `description: "Status of the request"`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

"properties": {
"status": {
"type": "string",
"example": "success"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The status property in CatalogValuationsResponse uses "example": "success" and lacks a description, but every other schema in this file that defines a status field uses "enum" (e.g., ["success"], ["error"], or ["success", "error"]) plus a "description". Since this endpoint returns 200 only on success (errors use 4xx HTTP responses), align with the established pattern by replacing example with enum: ["success"] and adding description: "Status of the request".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/releases.json, line 2912:

<comment>The `status` property in `CatalogValuationsResponse` uses `"example": "success"` and lacks a `description`, but every other schema in this file that defines a `status` field uses `"enum"` (e.g., `["success"]`, `["error"]`, or `["success", "error"]`) plus a `"description"`. Since this endpoint returns 200 only on success (errors use 4xx HTTP responses), align with the established pattern by replacing `example` with `enum: ["success"]` and adding `description: "Status of the request"`.</comment>

<file context>
@@ -2821,6 +2900,61 @@
+        "properties": {
+          "status": {
+            "type": "string",
+            "example": "success"
+          },
+          "valuations": {
</file context>

…valuation history

Contract for chat#1889 row 15 (the keystone): the valuation band is
persisted wherever it is computed (valuation runs; measurement reads at
most once per catalog per day) and read back as a latest-first series.
limit=1 is the current value. History is what makes week-over-week
deltas possible - the retention hook the weekly report needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sweetmantech
sweetmantech force-pushed the docs/catalog-valuations-series branch from 464b75f to 3d12c97 Compare July 29, 2026 23:28

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api-reference/openapi/releases.json`:
- Line 1417: Update the endpoint descriptions at both referenced entries to
explicitly reconcile per-run valuation persistence with the
one-row-per-catalog-per-day limit, stating whether same-day runs are coalesced
into one row or replace the existing row. Clarify the resulting history-length
and week-over-week comparison behavior without changing unrelated endpoint
details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 82887cb1-6111-4c3b-a7c9-a65941de066b

📥 Commits

Reviewing files that changed from the base of the PR and between 464b75f and 3d12c97.

📒 Files selected for processing (3)
  • api-reference/openapi/releases.json
  • api-reference/songs/catalog-valuations.mdx
  • docs.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs.json

"post": {
"summary": "Run valuation",
"description": "Generate a catalog from a Spotify artist in one call. Resolves the artist's releases, captures current Spotify play counts (spending the account's credits), materializes an account-owned catalog from the resulting snapshot (idempotent - see [Create catalog](/api-reference/songs/catalogs-create)), and returns the catalog with its estimated value band. The owning account is taken from the credentials, never the body. The searched artist is also linked to the caller's roster (so a funnel signup lands with a populated `GET /api/artists` it can confirm); when the catalog's songs already resolve a canonical artist that one is used, otherwise the searched Spotify artist is linked directly. Synchronous: the request waits for the capture to land (typically under two minutes).",
"description": "Generate a catalog from a Spotify artist in one call. Resolves the artist's releases, captures current Spotify play counts (spending the account's credits), materializes an account-owned catalog from the resulting snapshot (idempotent - see [Create catalog](/api-reference/songs/catalogs-create)), and returns the catalog with its estimated value band. The owning account is taken from the credentials, never the body. The searched artist is also linked to the caller's roster (so a funnel signup lands with a populated `GET /api/artists` it can confirm); when the catalog's songs already resolve a canonical artist that one is used, otherwise the searched Spotify artist is linked directly. Synchronous: the request waits for the capture to land (typically under two minutes). Each run also persists a row in the catalog's valuation history, readable via [Get Catalog Valuations](/api-reference/songs/catalog-valuations).",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Reconcile per-run persistence with daily deduplication.

These descriptions say each run writes a row, but also say there is at most one row per catalog per day. Clarify whether the daily row is coalesced or replaced so clients can reason correctly about history length and week-over-week comparisons.

Also applies to: 1654-1654

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/openapi/releases.json` at line 1417, Update the endpoint
descriptions at both referenced entries to explicitly reconcile per-run
valuation persistence with the one-row-per-catalog-per-day limit, stating
whether same-day runs are coalesced into one row or replace the existing row.
Clarify the resulting history-length and week-over-week comparison behavior
without changing unrelated endpoint details.

@sweetmantech

Copy link
Copy Markdown
Collaborator Author

Local verification — Mintlify render of 3d12c97 (rebased onto main @ 5255df6)

Ran npx mintlify dev on the PR branch and walked the rendered pages with Chrome DevTools. All checks are DOM assertions against the rendered page, not the JSON.

# Check Expected (contract) Actual (rendered) Result
1 releases.json parses after rebase json.load clean
2 Nav entry Catalogs group, after Get Catalog Measurements sidebar shows GET Get Catalog Valuations directly under GET Get Catalog Measurements
3 Path + method GET /api/catalogs/{catalogId}/valuations rendered exactly; cURL example shows ?limit=30
4 catalogId param uuid, required, 400 on malformed string<uuid> required + "Malformed (non-uuid) values are rejected with 400"
5 limit param integer, default 30, range 1–100 default: 30, "Required range: 1 <= x <= 100"
6 Status codes 200 / 400 / 401 / 404 exactly those four response tabs
7 200 shape {status, valuations[]} flat example renders status: "success" + array of {low, mid, high, measured_song_count, total_streams, measured_at}
8 Child attributes 6 fields, USD/measurement descriptions all six expand with descriptions ("Low end of the estimated catalog value band, USD." etc.)
9 Auth apiKeyAuth + bearerAuth both schemes in the Authorizations selector
10 Run Valuation description persistence note + link "Each run also persists a row in the catalog's valuation history, readable via Get Catalog Valuations" — link resolves to the new page
11 Em-dash sweep 0 in rendered copy /[—–]/ DOM assertion: 0 on both pages

Screenshots

New endpoint page (params + cURL + 200 example):
valuations page

Response schema, child attributes expanded:
response schema

Run Valuation description with the persistence note + cross-link:
persistence note

Rebased onto main (git rebase origin/main, clean — no overlap with docs#280/#281) and force-pushed. Merge order unchanged: this PR → database#52api#795. Contract ↔ implementation reconciliation against the live api#795 preview happens in that PR's verification pass once the table exists.

@sweetmantech
sweetmantech merged commit 39d2951 into main Jul 29, 2026
2 checks passed
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