[PR #2205] [MERGED] Fix Spotify DJ playback fallback cache #5468

Closed
opened 2026-10-22 04:16:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2205
Author: @Xelvanis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/spotify-dj-result-cache


📝 Commits (1)

  • 7b6b307 Fix Spotify DJ playback fallback cache

📊 Changes

2 files changed (+270 additions, -67 deletions)

View changed files

📝 src-tauri/src/commands/storage/integrations/spotify.rs (+174 -36)
📝 src/engine/agents-runtime/executor/agent-executor.ts (+96 -31)

📄 Description

Linked issue

N/A

Why this change

Spotify DJ could return a play action with track URIs without actually applying playback when the tool path was unavailable or malformed. The playlist candidate cache also reused source indexes across access-token changes and lost some legacy mood-token matches for common scene wording.

What changed

  • Validated Spotify DJ playback fallback results instead of treating every spotify_play tool response as successful.
  • Marked no-tool Spotify play results as failed with the existing fallback failure payload instead of fake-successful.
  • Keyed Spotify playlist index cache entries by an access-token digest and added deterministic SHA-based cache/random scoring.
  • Restored legacy substring mood expansion for words like battlefield, suspenseful, and peacefully while keeping the newer token vocabulary.
  • Folded Latin accents for Spotify matching and added focused Rust coverage for cache key and mood-token behavior.

Refactor impact

Primary owner:

Engine generation / Rust storage integrations.

Impact areas reviewed:

  • Spotify DJ agent execution and fallback result payloads.
  • Spotify spotify_play tool response shape.
  • Spotify playlist candidate cache keys and candidate token scoring.

Boundary notes:

  • Engine code stays React-free and uses the existing tool context contract; no direct Tauri or shared API imports were added.
  • Rust changes stay inside the existing Spotify storage integration module; no new Tauri command or remote-runtime route was added.

Pressure points touched:

  • None of the listed pressure points were touched.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

Ran:

  • git diff --check
  • pnpm typecheck
  • cargo test --manifest-path src-tauri/Cargo.toml spotify_ --lib
  • Temporary local Vitest scratch proof for the no-tool Spotify play path, removed before commit.
  • pnpm check

Not run:

  • Live Spotify device/API playback QA.
  • Native Tauri hands-on Spotify flow.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

This is a bugfix for existing Spotify DJ behavior and does not add a discoverable feature.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

Docs/release notes: no docs changes needed because this fixes existing Spotify DJ behavior and does not change user-facing setup or feature discovery.

UI evidence

N/A. No visible UI was changed.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved Spotify cache reliability with deterministic hashing
    • Enhanced error handling and validation for Spotify playback operations
    • Better support for accented characters in Spotify text normalization
  • Tests

    • Added test coverage for Spotify cache key changes and accent folding behavior

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2205 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/spotify-dj-result-cache` --- ### 📝 Commits (1) - [`7b6b307`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7b6b3078b0b3a049c00cad2857834b5783bf8f54) Fix Spotify DJ playback fallback cache ### 📊 Changes **2 files changed** (+270 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/integrations/spotify.rs` (+174 -36) 📝 `src/engine/agents-runtime/executor/agent-executor.ts` (+96 -31) </details> ### 📄 Description ## Linked issue N/A ## Why this change Spotify DJ could return a `play` action with track URIs without actually applying playback when the tool path was unavailable or malformed. The playlist candidate cache also reused source indexes across access-token changes and lost some legacy mood-token matches for common scene wording. ## What changed - Validated Spotify DJ playback fallback results instead of treating every `spotify_play` tool response as successful. - Marked no-tool Spotify `play` results as failed with the existing fallback failure payload instead of fake-successful. - Keyed Spotify playlist index cache entries by an access-token digest and added deterministic SHA-based cache/random scoring. - Restored legacy substring mood expansion for words like battlefield, suspenseful, and peacefully while keeping the newer token vocabulary. - Folded Latin accents for Spotify matching and added focused Rust coverage for cache key and mood-token behavior. ## Refactor impact Primary owner: Engine generation / Rust storage integrations. Impact areas reviewed: - Spotify DJ agent execution and fallback result payloads. - Spotify `spotify_play` tool response shape. - Spotify playlist candidate cache keys and candidate token scoring. Boundary notes: - Engine code stays React-free and uses the existing tool context contract; no direct Tauri or shared API imports were added. - Rust changes stay inside the existing Spotify storage integration module; no new Tauri command or remote-runtime route was added. Pressure points touched: - None of the listed pressure points were touched. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes Ran: - `git diff --check` - `pnpm typecheck` - `cargo test --manifest-path src-tauri/Cargo.toml spotify_ --lib` - Temporary local Vitest scratch proof for the no-tool Spotify play path, removed before commit. - `pnpm check` Not run: - Live Spotify device/API playback QA. - Native Tauri hands-on Spotify flow. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: This is a bugfix for existing Spotify DJ behavior and does not add a discoverable feature. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims Docs/release notes: no docs changes needed because this fixes existing Spotify DJ behavior and does not change user-facing setup or feature discovery. ## UI evidence N/A. No visible UI was changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Bug Fixes** * Improved Spotify cache reliability with deterministic hashing * Enhanced error handling and validation for Spotify playback operations * Better support for accented characters in Spotify text normalization * **Tests** * Added test coverage for Spotify cache key changes and accent folding behavior <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:35 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5468
No description provided.