docs(catalogs): v2 measurements contract — artist_account_id filter + echo + no-cap semantics#267
docs(catalogs): v2 measurements contract — artist_account_id filter + echo + no-cap semantics#267sweetmantech wants to merge 1 commit into
Conversation
… filter, echo field, explicit no-cap semantics (chat#1850) Amends the GET /api/catalogs/measurements contract from docs#265: - optional query param artist_account_id (uuid): scope measurements + valuation to the catalog's songs linked to that artist via song_artists; absent = whole catalog. Malformed values are a 400. - response field artist_account_id (uuid, nullable): echoes the applied filter so clients can verify the response scope before trusting it. - measurements/total_streams explicitly cover ALL matching songs — no row cap (the current impl silently truncates at 1,000; fixed api-side). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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. |
📝 WalkthroughWalkthroughUpdated the OpenAPI specification for GET /api/catalogs/measurements to document optional artist_account_id scoping, clarify exhaustive/no-row-cap read behavior, expand 400 error documentation, and add a nullable artist_account_id field to the CatalogMeasurementsResponse schema. ChangesArtist scoping documentation
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api-reference/openapi/releases.json (1)
2469-2482: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winConsider marking
artist_account_id(and other core fields) as required in the response schema.The description explicitly tells clients to verify this echo before treating numbers as artist-scoped, but the schema has no
requiredlist, so the field is technically optional to omit. Addingartist_account_idto arequiredarray (withnullable: truealready in place) would make the contract clients are told to depend on enforceable in the spec itself.♻️ Proposed schema tweak
"CatalogMeasurementsResponse": { "type": "object", "description": "Latest per-song play counts for a catalog plus the valuation band derived from them", + "required": [ + "status", + "measurements", + "valuation", + "total_streams", + "artist_account_id" + ], "properties": {🤖 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 2469 - 2482, The response schema for the valuation payload should explicitly require the echoed scope fields instead of leaving them optional. Update the OpenAPI schema around artist_account_id so it is listed in the relevant required array (with nullable: true preserved), and apply the same treatment to any other core response fields that clients must always receive; use the existing schema object definitions in the valuation response to keep the contract enforceable.
🤖 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.
Nitpick comments:
In `@api-reference/openapi/releases.json`:
- Around line 2469-2482: The response schema for the valuation payload should
explicitly require the echoed scope fields instead of leaving them optional.
Update the OpenAPI schema around artist_account_id so it is listed in the
relevant required array (with nullable: true preserved), and apply the same
treatment to any other core response fields that clients must always receive;
use the existing schema object definitions in the valuation response to keep the
contract enforceable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 109682cb-2c91-4476-9722-e887ca7f66a5
📒 Files selected for processing (1)
api-reference/openapi/releases.json
Amends the
GET /api/catalogs/measurementscontract (docs#265, merged) for the data plumbing v2: artist-scoped valuation bucket of recoupable/chat#1850.What changed (all in
api-reference/openapi/releases.json; the reference pageapi-reference/songs/catalog-measurements.mdxis frontmatter-only and unchanged)artist_account_id(uuid): when present, measurements + valuation cover only the catalog's songs linked to that artist account viasong_artists; when absent, the whole catalog. A song linked to multiple artists counts for each. Malformed values → 400 (400 description updated).artist_account_id(uuid, nullable): echoes the applied filter — the uuid when the response was artist-scoped,nullwhen whole-catalog. Lets clients (the chat homepage hero) verify the response scope before rendering artist-labeled numbers, instead of showing wrong-scoped money against a pre-v2 deployment that ignores the unknown param.measurementsandtotal_streamsnow state they cover ALL matching songs with no row cap. The current implementation silently truncates at 1,000 rows (live repro: feat(catalogs): GET /api/catalogs/measurements — per-ISRC latest playcounts + derived valuation band (chat#1850) api#757 (comment)) — being fixed in the api v2 PR.The OpenAPI JSON diff is purely additive/amending on the measurements path + response schema; every other path/schema is byte-identical (verified by structural diff after a parse round-trip).
Merge order
This docs PR merges first, then the api v2 implementation PR (recoupable/api#763), then the chat#1852 hero rework. Contract-first per documentation-driven development.
Refs recoupable/chat#1850.
🤖 Generated with Claude Code
Summary by cubic
Updates the catalog measurements API contract to support artist-scoped reads and to echo the applied scope. Clarifies that results are exhaustive (no row cap) to better support v2 artist-scoped valuation.
artist_account_id(uuid) query param to scope results to songs linked to that artist; malformed values return 400.artist_account_id(uuid|null) echoes the applied scope so clients can verify before rendering.measurementsandtotal_streamsnow explicitly cover all matching songs with no row cap.Written for commit c3392f0. Summary will update on new commits.
Summary by CodeRabbit