Skip to content

fix(connect): hydrate status metadata + improve device UX#11

Closed
mbelinky wants to merge 1 commit into
openclaw:mainfrom
mbelinky:fix/connect-status-hydration
Closed

fix(connect): hydrate status metadata + improve device UX#11
mbelinky wants to merge 1 commit into
openclaw:mainfrom
mbelinky:fix/connect-status-hydration

Conversation

@mbelinky
Copy link
Copy Markdown

@mbelinky mbelinky commented Feb 8, 2026

Summary

This improves reliability of spogo status (especially with the connect engine) when Spotify connect-state payloads omit track/device metadata, and upgrades device management ergonomics.

Problem

Some devices/sessions return sparse connect-state payloads where the currently playing item has a URI/ID but no name/album, and the active device has little to no metadata. This made status outputs inconsistent (track/device fields often empty) and could lead to slow/hanging status calls when fallback paths were slow.

Fix

  • Connect playback/status now performs best-effort metadata hydration via Web API:
    • Use Web API /me/player to fill missing track/device fields when available.
    • If the track still lacks a name, hydrate via Web API GetTrack first (fast), then fall back to the existing connect GraphQL trackInfo.
    • If device metadata is missing, hydrate via /me/player/devices by ID, and as a last resort pick the single active Web API device.
  • Hydration calls are bounded with short per-call timeouts so status --json stays responsive under automation.
  • Improve connect-state parsing for more playback/device shapes (metadata keys, track_window, etc).

Device UX

  • Add spogo device show and spogo device clear.
  • Add spogo device set --save to persist selection to the current profile.
  • Add a shared resolver for device selection with exact and unique partial matches (name/id).
  • connect engine honors --device/profile device by auto-transferring before playback commands.

Tests

  • Added unit tests covering connect status hydration paths (track/device), device selection resolver, and CLI device commands.
  • Updated test HTTP helpers to include ContentLength so Web API JSON decoding behavior matches production client logic.

Docs

  • Document new device subcommands and note connect status hydration behavior in README/spec/changelog.

- Hydrate connect status track/device metadata via Web API best-effort with bounded timeouts

- Improve connect-state item parsing for sparse payloads

- Enhance device commands (show/clear, set --save) and selector matching

- Add tests for hydration, device selection, and CLI behaviors
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Rebased review against current main: not merge-now safe.

Current blocker: this still does not fix issue #8. still routes through Connect transfer, and the failure path remains in when neither origin nor active device is present.

Current architecture also diverged since this PR was opened: the old monoliths were split, and parts of this PR now overlap landed work in #7 and #15. This needs a manual split/port, not a straight rebase.

Recommended split:

  • status/device hydration improvements
  • selector UX improvements
  • separate transfer fallback fix for Unable to set device #8

Keeping this open for a narrower follow-up, but not merging as-is.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Follow-up with the exact blocker text.

This still does not fix issue #8. device set still routes through Connect transfer, and the failure path remains missing origin device id in internal/spotify/connect_commands.go when neither origin nor active device is present.

Current architecture also diverged since this PR was opened: the old monoliths were split, and parts of this PR now overlap landed work in #7 and #15. This needs a manual split/port, not a straight rebase.

Recommended split:

  • status/device hydration improvements
  • selector UX improvements
  • separate transfer fallback fix for Unable to set device #8

Keeping this open for a narrower follow-up, but not merging as-is.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Root issue is fixed on in c613e96.\n\nThat change handles the missing-origin-device path directly by falling back to Web API transfer when Connect state has no source device.\n\nThis PR still looks like separate status-hydration / device-UX work, and it still needs a rebase/split before merge.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented Mar 8, 2026

Root issue #8 is fixed on main in c613e96.

That change handles the missing-origin-device path directly by falling back to Web API transfer when Connect state has no source device.

This PR still looks like separate status-hydration / device-UX work, and it still needs a rebase/split before merge.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented May 5, 2026

Triage note: not merging this as-is today. It is dirty against current main and mixes several concerns: status hydration, Connect state parsing, device commands, saved-device config, and selector matching.

Some adjacent fixes are already on main now (#16, #21, #24, plus the existing artist/status extraction work). The useful remaining pieces here should be split/rebased into smaller PRs, especially if we still want device show, device clear, or persisted device selection.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented May 5, 2026

Closing this stale broad PR after current-main triage.

The original missing-origin device path was fixed on \ in c613e96, and more adjacent Connect/status fixes have landed since then (#16, #21, #24, plus the current sparse metadata fixes released in v0.3.0). This branch is now conflicting/dirty and mixes several separable changes: status hydration, Connect-state parsing, device commands, saved-device config, and selector matching.

There are still useful ideas here, but they should come back as smaller rebased PRs. Good follow-up slices would be:

  • \ / \ / \
  • selector matching as a focused helper + tests
  • bounded status hydration only if current \ still misses a concrete payload shape

Thanks for the work here; closing to keep the queue actionable rather than trying to revive this branch wholesale.

@steipete steipete closed this May 5, 2026
@steipete
Copy link
Copy Markdown
Collaborator

steipete commented May 5, 2026

Correction to the close note above, where Markdown backticks were eaten by my shell.

Closing this stale broad PR after current-main triage.

The original missing-origin device path was fixed on main in c613e96, and more adjacent Connect/status fixes have landed since then (#16, #21, #24, plus the current sparse metadata fixes released in v0.3.0). This branch is now conflicting/dirty and mixes several separable changes: status hydration, Connect-state parsing, device commands, saved-device config, and selector matching.

There are still useful ideas here, but they should come back as smaller rebased PRs. Good follow-up slices would be:

  • device show / device clear / device set --save
  • selector matching as a focused helper + tests
  • bounded status hydration only if current main still misses a concrete payload shape

Thanks for the work here; closing to keep the queue actionable rather than trying to revive this branch wholesale.

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.

2 participants