Skip to content

Expose bounded player configuration capabilities - #1283

Open
sidneyswift wants to merge 2 commits into
mainfrom
codex/player-capabilities-2107
Open

sidneyswift wants to merge 2 commits into
mainfrom
codex/player-capabilities-2107

Conversation

@sidneyswift

@sidneyswift sidneyswift commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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 capabilities block 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 as unknown.

  • Authorized HTTP, MCP, and public GET reads all project the same capabilities.
  • Public metadata GET stays credential-free, creates no session, and performs no provider work.
  • Existing auth, error, no-session, and ownership boundaries are unchanged.

Written for commit 18fc2c4. Summary will update on new commits.

View guided diff Turn on auto-fix

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated
api Ready Ready Preview Nov 18, 2026 2:38pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Pre-merge checks: Passed 1

Check name Status Explanation
Solid & Clean Code Passed 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 file lib/players/getPlayerCapabilities.ts (16 lines) exports getPlayerCapabilities. File name matches the function name, so the file-function rule is met. - New file lib/players/getPlayerReadResponse.ts (12 lines) exports getPlayerReadResponse. It composes the player, links and capabilities. The name matches the file, and the function is short and single-purpose. - lib/players/processPlayerOperation.ts changes one line: the get branch now returns getPlayerReadResponse(player). Other operations are untouched. - lib/players/getPublicPlayer.ts adds one import and one capabilities property. 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.ts changes 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 in getPlayerCapabilities could be a shared constant. The object is a clear, explicit projection, so this is a minor DRY point. - getPlayerCapabilities reads process.env.SITES_SPOTIFY_CLIENT_ID inside the function. This is a small hidden dependency. It is consistent with the explicit configuration-observation purpose of the code. - The new import in getPublicPlayer.ts is placed above node: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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T14:40:03.941938Z 18fc2c4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

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
Loading

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread lib/players/processPlayerOperation.ts Resolved
@sidneyswift

Copy link
Copy Markdown
Contributor Author

@codex review

Please review exact successor 18fc2c4. Extracted the authorized read response projection after ownership validation and corrected premium eligibility wording. Player tests (89), scoped types and lint pass. Docs42 must land first; merge authority remains with the coordinator.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 18fc2c4afe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

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

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

This branch was successfully deployed

1 active deployment
Preview — 18fc2c4a Deployed Nov 18, 2026 by vercel[bot]
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