Repository navigation
Expose bounded player configuration capabilities - #1283
sidneyswift wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Pre-merge checks:
|
| Check name | Status | Explanation |
|---|---|---|
| Solid & Clean Code | PR #1283 (recoupable/api, author sidneyswift) adds a small capabilities projection. I reviewed the PR's own commits (dc29424 and 18fc2c4) against main. Changes checked: - New file `lib/players/getPl… |
Full details: Solid & Clean Code
-
Explanation
PR
#1283(recoupable/api, author sidneyswift) adds a small capabilities projection. I reviewed the PR's own commits (dc29424 and 18fc2c4) against main. Changes checked: - New filelib/players/getPlayerCapabilities.ts(16 lines) exportsgetPlayerCapabilities. File name matches the function name, so the file-function rule is met. - New filelib/players/getPlayerReadResponse.ts(12 lines) exportsgetPlayerReadResponse. It composes the player, links and capabilities. The name matches the file, and the function is short and single-purpose. -lib/players/processPlayerOperation.tschanges one line: thegetbranch now returnsgetPlayerReadResponse(player). Other operations are untouched. -lib/players/getPublicPlayer.tsadds one import and onecapabilitiesproperty. The function was already about 80 lines before this PR. The PR adds one line to it, so it does not make that pre-existing length worse in a meaningful way. -registerGetReleasePlayerTool.tschanges only a tool description string. - No new function was added to an existing file under a mismatched name. Non-blocking observations: - The four"unknown"literals ingetPlayerCapabilitiescould be a shared constant. The object is a clear, explicit projection, so this is a minor DRY point. -getPlayerCapabilitiesreadsprocess.env.SITES_SPOTIFY_CLIENT_IDinside the function. This is a small hidden dependency. It is consistent with the explicit configuration-observation purpose of the code. - The new import ingetPublicPlayer.tsis placed abovenode:crypto, which breaks the file's import order. This is cosmetic. None of these matches an explicit failure condition in the SOLID & Clean Code check. The change is small and focused, and it follows the file-naming rule.
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Architecture diagram
sequenceDiagram
participant Client as HTTP/MCP Client
participant Auth as Auth/Validation Layer
participant OP as processPlayerOperation
participant Pub as getPublicPlayer
participant Cap as getPlayerCapabilities
participant DB as Supabase/Release Player Store
Note over Client,DB: GET Player Flow - Capabilities v1 Projection
alt HTTP Authorized GET
Client->>Auth: GET /api/players/{id}
Auth->>Auth: validateAuthContext()
alt Valid Session
Auth->>OP: processPlayerOperation("get")
OP->>DB: selectReleasePlayer(id)
DB-->>OP: player record
OP->>OP: Ownership check (404 if mismatch)
OP->>Cap: getPlayerCapabilities(spotify_url)
Cap->>Cap: Read SITES_SPOTIFY_CLIENT_ID env
Cap-->>OP: capabilities v1 object
OP-->>Client: player + links + capabilities
else Unauthorized
Auth-->>Client: 401 Unauthorized
end
else MCP Tool Call
Client->>Auth: get_release_player tool
Auth->>Auth: resolveAccountId()
alt Valid Account
Auth->>OP: processPlayerOperation("get")
OP->>DB: selectReleasePlayer(id)
DB-->>OP: player record
OP->>OP: Ownership check (404 if mismatch)
OP->>Cap: getPlayerCapabilities(spotify_url)
Cap->>Cap: Read SITES_SPOTIFY_CLIENT_ID env
Cap-->>OP: capabilities v1 object
OP-->>Client: ToolResult with same body shape
else Invalid Account
Auth-->>Client: Error result
end
else Public GET (credential-free)
Client->>Pub: GET /api/players/public/{id}
Pub->>DB: selectReleasePlayer(id)
DB-->>Pub: player record
Pub->>Pub: No session creation, no provider calls
Pub->>Cap: getPlayerCapabilities(spotify_url)
Cap->>Cap: Read SITES_SPOTIFY_CLIENT_ID env
Cap-->>Pub: capabilities v1 object
Pub-->>Client: metadata + capabilities (no spotify/flow fields)
end
Note over Cap: Capabilities structure v1
Note over Cap: - clientConfiguration: configured/unconfigured
Note over Cap: - releaseConfigured: true/false
Note over Cap: - premiumEligibility/tokenStatus/scopeStatus/playbackSupport: always "unknown"
alt POST / Update / Other Operations
Client->>OP: Non-GET operations (create/update/delete/list)
OP->>DB: Write operation
OP-->>Client: Result (NO capabilities field)
end
Note over Pub: Invalid PLAYER_APP_ORIGIN env
Pub->>Pub: Throws configuration error
Pub-->>Client: Error response
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Adds a capabilities field to authorized and public player GET responses, exposing configuration presence and changing the public API response shape; human sign-off is needed for this contract/exposure change and the pending Docs dependency.
View guided diff | Turn on auto-fix | Re-trigger cubic
Authorized player reads and trusted player configuration now expose capabilities v1: Spotify client-ID presence and release-destination presence, with Premium, token, scope and playback observations explicitly unknown. HTTP and MCP use the same actual domain projection. Existing auth, errors, GET no-session behavior, POST acquisition, provider calls and credential boundaries stay unchanged.
Tests written first; 89 player tests pass, including actual HTTP/MCP and public GET consumers, fresh/resumed sessions and unknown-state boundaries. Scoped types/lint pass. Independent exact-head review passed at 18fc2c4 after extracting the read response and correcting premium eligibility wording. All six successor CI workflows passed, including the full unit-test workflow and final TypeScript checks. Exact-head Codex review completed without findings; Cubic reported zero issues. All review threads are resolved.
Depends on pending Docs contract recoupable/docs#42 merging first. Root owns merge; App consumer is separately draft pending native acceptance. This is a bounded app#2107 slice, not host identity or full Fans/Widgets acceptance.
Summary by cubic
Adds a
capabilitiesblock to GET responses on player reads, exposing only configuration observations: whether a Spotify client-ID is configured and whether the release has a destination. Spotify Premium eligibility, token, scope, and playback support are explicitly reported asunknown.Written for commit 18fc2c4. Summary will update on new commits.