Skip to content

fix(spotify): migrate to the February 2026 Web API endpoints - #94

Merged
steipete merged 5 commits into
openclaw:mainfrom
RtYkk:fix/feb-2026-web-api
Nov 21, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
RtYkk:fix/feb-2026-web-api

Conversation

@RtYkk

@RtYkk RtYkk commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Change

Restore Spotify Development Mode operations after the February 2026 API migration: create playlists through /me/playlists, use playlist /items endpoints, and save/remove/follow through /me/library. Accept both current and Extended Quota response shapes, including an explicit zero count.

Search requests page at ten results while retaining the caller's requested count and offset. Library mutations use batches of at most 40 URIs and stop at the first failed batch, preserving operations that exceeded the replacement endpoint's smaller limit.

Refresh compatible Go dependencies and build with Go 1.27.4 to fix the reachable GO-2026-6859 HTTP-server vulnerability. The source minimum remains Go 1.26.7. Document Connect's unavailable playlist counts without changing JSON/plain output or issuing a request per playlist.

Fixes #93. Resolves #96 through its documented-limitation option.

Validation

Reproduced the old search behavior with failing tests: requests for 25 and 15 results were sent as single oversized requests. Reproduced the unbatched library failure for track/album/artist saves and removals against a synthetic endpoint enforcing the 40-URI limit.

The affected Spotify, CLI, and cookie packages pass locally. Independent P0–P2 review identified the missing mutation batching; the completed fix passed a fresh independent review. Final isolated Linux proof on Go 1.27.4 passed: race coverage 90.7%, go vet ./..., deadcode v0.52.0, no findings from the current govulncheck, golangci-lint v2.15.0, built CLI version/completion smoke, and docs generation. A discovered empty-input batching regression was fixed and the full final gate rerun. Hosted exact-head CI passed on Linux, Windows, and macOS before merge.

The contributor's original live Development Mode evidence remains available at https://gist.github.com/RtYkk/1a82179076d9de81afba11a77f3327c7. Maintainer verification uses synthetic HTTP servers; no personal Spotify account or library was changed.

No application version change, tag, or release.

Spotify removed six endpoints the web client still called, so playlist
creation and artist follow/unfollow failed with 403 for every app in
Development Mode.

- POST /users/{user_id}/playlists -> POST /me/playlists, which drops the
  currentUserID() lookup that only existed to build that URL
- GET/POST/DELETE /playlists/{id}/tracks -> /items, with the body parameter
  tracks renamed to items
- PUT/DELETE /me/following -> PUT/DELETE /me/library with
  uris=spotify:artist:...
- decode items.total and the item wrapper, which are the 2026 shapes, while
  still accepting tracks.total and the track wrapper because Extended Quota
  Mode apps keep receiving the old field names
Search asks for at most ten results per request and pages with offset until
the caller limit is met or the results run out. Development Mode apps reject
a limit above ten with 400 Invalid limit, so the CLI default of twenty failed
for every web-engine search, not only for callers passing a large limit.

The result keeps the caller limit and offset and carries the upstream total
from the first page.
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR updates Spotify Web API endpoints, accepts both playlist response formats, and retrieves larger searches in pages of ten.

Example: Run spogo --engine web --auth oauth search track "weezer" with a Development Mode app.

  • Before: The default limit of 20 returns Spotify's 400 Invalid limit error.
  • After: Two requests return the requested 20 rows.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused compatibility repair with relevant live CLI evidence and no identified actionable defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The Development Mode/Premium terminal capture exercises the built CLI's creation, library membership changes, artist follow/unfollow, 20/25-row searches, and explicit Web API playlist add/list/remove flow after the fix; the updated body resolves the earlier missing-path concern, and no persisted configuration or data format changes require migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Development Mode users encounter forbidden playlist and library operations, failed default searches, and incorrect Web API playlist counts.
Reason: This restores existing commands after Spotify's API changes while preserving user-facing defaults and engine ownership.

Merge readiness

✅ Ready for maintainer review

Keep this PR open for landing: main still needs the migration, the updated terminal capture clears the earlier proof gap, and no actionable code or security defect was found.

Priority: P1
Reviewed head: 7c23bb4ff77c0ea3983e5597bb635ba80c0f2dc6

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Base-fail/head-pass execution of the added regression tests is not shown.
Agent review details

How this fits together

CLI commands reach the shared authenticated Web API client through engine routing; Spotify responses are mapped into structured items and terminal output.

flowchart TD
  A[CLI commands] --> B[Engine routing]
  B --> C[Shared Web API client]
  C --> D[Spotify API]
  D --> E[Response mapping]
  E --> F[CLI output]
Loading

Technical review

Best possible solution:

Land the focused migration in the shared Web API client while preserving CLI contracts, legacy response decoding, and existing engine routing.

Do we have a high-confidence way to reproduce the issue?

Main sends the retired requests documented by Spotify, corroborated by RtYkk's v0.13.2 failures and successful branch CLI output; this read-only review executed no target code.

Is this the best way to solve the issue?

Updating the existing shared client addresses the upstream contract change directly, preserves requested search counts, and retains older response decoding without adding another implementation.

AGENTS.md: not found in the target repository.

Codex review notes: model internal, reasoning medium; reviewed against 61001a475be7.

Provenance checked

  • Playlist and library requests changes intended behavior with a stated reason (ff88818: refactor: organize Spotify clients and remove repeated plumbing #74 moved existing requests into focused clients while explicitly preserving endpoints; Spotify's published migration explains changing those endpoints now.)
  • Search response decoding keeps the original intent (aef9a7f: fix(search): decode Spotify plural result containers #59 corrected plural response-container lookup; pagination keeps that correction and the caller's requested result count.)
  • Playlist response fields changes intended behavior with a stated reason (07a219b: Supplied provenance associates the legacy fields with the bootstrap implementation; this PR explains the upstream rename and retains legacy decoding.)
  • Engine delegation keeps the original intent (4f2b8e1: Existing Connect, automatic, fallback, and AppleScript paths delegate these library writes to the shared Web API client; the internal argument change preserves that routing.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #93
Summary: This PR repairs the reported Web API migration failures; Connect's missing playlist counts arise from a separate payload.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: Released Development Mode clients fail playlist creation, library mutations, and default Web API searches.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-15T14:39:07.472Z sha df1e53b :: needs real behavior proof before merge. :: [P2] Stop pagination before exceeding Spotify's maximum search offset
  • reviewed 2026-11-15T14:54:33.515Z sha 7c23bb4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-15T15:02:40.874Z sha 7c23bb4 :: needs real behavior proof before merge. :: none

Reviewed November 15, 2026, 10:11 AM ET / 15:11 UTC (Revision 4).

Spotify removed PUT and DELETE on /me/tracks, /me/albums, /me/episodes and
/me/shows in the February 2026 Web API change, so library tracks add/remove
and library albums add/remove failed with 403 for Development Mode apps.

LibraryModify now takes the entity kind instead of a path and writes
uris=spotify:<kind>:<id> to /me/library, which is the documented replacement.
Spotify accepts a maximum offset of 1000 on /search, so a page requested
past it returns 400 and discards the results already collected. Paging now
stops at the ceiling instead of asking for a page that cannot exist.
@RtYkk

RtYkk commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Captured terminal output, addressing the two findings from the last review.

Offset ceiling. Paging now stops at offset 1000. The new test TestSearchStopsAtMaximumOffset asks for limit=20 at offset=995 and asserts a single request, with no attempt at 1005.

Library writes. library tracks add/remove and library albums add/remove still used the removed PUT and DELETE on /me/tracks and /me/albums, which the review flagged as an incomplete migration. LibraryModify now takes the entity kind and writes uris=spotify:: to /me/library.

spogo below is the released 0.13.2; ./spogo is built from this branch. The library section checks each step with /me/library/contains, so the add and remove are confirmed rather than self-reported. Only catalogue identifiers and a public Spotify playlist appear below.

### playlist create
$ spogo playlist create "spogo migration check"                    # released 0.13.2
spotify api error (403): Forbidden
$ spogo playlist create "spogo migration check" --json             # this branch
{
  "id": "<new-playlist-id>",
  "uri": "spotify:playlist:<new-playlist-id>",
  "name": "spogo migration check",
  "type": "playlist",

### library items: track
$ spogo library tracks add spotify:track:155FvcjYNf2iWL0gf4in4D     # released 0.13.2
spotify api error (403): Forbidden
$ spogo library tracks add spotify:track:155FvcjYNf2iWL0gf4in4D     # this branch
Updated 1 items
$ curl /me/library/contains?uris=spotify:track:155FvcjYNf2iWL0gf4in4D
[true]
$ spogo library tracks remove spotify:track:155FvcjYNf2iWL0gf4in4D  # this branch
Updated 1 items
$ curl /me/library/contains?uris=spotify:track:155FvcjYNf2iWL0gf4in4D
[false]

### library items: album
$ spogo library albums add spotify:album:2hj1XEhWoeLDQiCdGyZejr      # released 0.13.2
spotify api error (403): Forbidden
$ spogo library albums add spotify:album:2hj1XEhWoeLDQiCdGyZejr      # this branch
Updated 1 items
$ curl /me/library/contains?uris=spotify:album:2hj1XEhWoeLDQiCdGyZejr
[true]
$ spogo library albums remove spotify:album:2hj1XEhWoeLDQiCdGyZejr   # this branch
Updated 1 items
$ curl /me/library/contains?uris=spotify:album:2hj1XEhWoeLDQiCdGyZejr
[false]

### search
$ spogo --engine web --auth oauth search track "weezer"             # released 0.13.2
spotify api error (400): Invalid limit
$ spogo --engine web --auth oauth search track "weezer" --plain | wc -l    # this branch
      20
$ spogo --engine web --auth oauth search track "weezer" --limit 25 --plain | wc -l
      25

### playlist items (public Spotify playlist, connect engine)
$ spogo playlist tracks 37i9dQZF1DXcBWIGoYBM5M --limit 2 --plain
3h5T5JypYU7huFiVYhv1dr	BbY WOW	KAROL G, Judeline, rusowsky
2sFepQNyl1WjpROruP8bJ0	Housewife	Tate McRae

### follow / unfollow
$ spogo --engine web --auth oauth library artists list --plain | grep -c <artist-id>
0
$ spogo library artists follow <artist-id>
Updated 1 items
1
$ spogo library artists unfollow <artist-id>
Updated 1 items
0

go vet ./... , go test ./... and gofmt -l internal/ are clean. The search paging tests run with: go test ./internal/spotify -run ^TestSearch

@RtYkk

RtYkk commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Both review findings are addressed in the commits after df1e53b: paging stops at the offset ceiling, and library track/album writes moved to /me/library. Captured before/after terminal output is in the previous comment. Requesting a fresh review.

@RtYkk

RtYkk commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@RtYkk

RtYkk commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@RtYkk

RtYkk commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
Migrate removed endpoints, retain both playlist response shapes, page search results, and batch library mutations at 40 URIs. Document unknown Connect playlist counts.

Refresh compatible dependencies and use Go 1.27.4 for GO-2026-6859 while retaining the Go 1.26.7 source minimum. Validated with regression tests, race coverage, vulnerability scan, lint, deadcode, CLI/docs smoke, and independent review.

Co-authored-by: RtYkk <45971730+RtYkk@users.noreply.github.com>

@steipete steipete left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the endpoint migration, 40-URI batching, response compatibility, and search pagination. Regression tests, Go 1.27.4 vulnerability scan, race coverage, lint, and independent P0–P2 review passed.

@steipete
steipete merged commit 6ee9126 into openclaw:main Nov 21, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants