Skip to content

feat(frontend): inject sidecar endpoint, flip library.getTracks (TASK-355.6 AC#1-4) - #50

Merged
pythoninthegrass merged 3 commits into
mainfrom
task-355.6
Sep 14, 2026
Merged

feat(frontend): inject sidecar endpoint, flip library.getTracks (TASK-355.6 AC#1-4)#50
pythoninthegrass merged 3 commits into
mainfrom
task-355.6

Conversation

@pythoninthegrass

Copy link
Copy Markdown
Collaborator

Summary

  • Revives the runtime endpoint-injection mechanism this repo had for the old Python PEX sidecar (get_backend_url/initBackendUrl, removed in 9feabb0), adapted for shared.js's split-out API modules and the Zig sidecar's bearer-token auth.
  • Adds sidecar_get_endpoint Tauri command (crates/mt-tauri/src/sidecar.rs) returning the base URL + token the startup health probe already resolved (SidecarState::endpoint(), from TASK-355.5) — no second parse of sidecar.json.
  • shared.js's API_BASE becomes mutable module state (setBackendEndpoint) with the old hardcoded value as default/fallback; request() attaches Authorization: Bearer <token> only when a token is set.
  • main.js calls a new initBackendUrl() before Alpine.start(), guarded against both thrown errors and the undefined replies several Playwright specs' hand-rolled invoke mocks return for unrecognized commands.
  • library.js's getTracks() — the only frontend caller of the one Zig-backed endpoint — drops its tauriInvoke('library_get_all') branch entirely and calls request() directly. Every other domain module is untouched.

Covers TASK-355.6's Acceptance Criteria #1#4 only. AC#5 (the POC report synthesizing all six subtasks into a go/no-go recommendation) is intentionally out of scope for this PR and will be done separately — task status is In Progress, not Done.

Review notes

Built by an unattended pi agent run (gnhf skill) in an isolated worktree, then reviewed by hand before push:

  • Independently re-ran Vitest (626 passed / 17 failed) and Playwright chromium (504 passed / 5 failed / 2 skipped) — matches the agent's reported counts and failure sets exactly; confirmed all 5 Playwright failures and all 17 Vitest failures are pre-existing by reproducing them against base main in a throwaway comparison worktree.
  • Found and reverted two out-of-scope stylistic hunks (a function→arrow conversion in main.js, a ternary reorder in library.js's unrelated getSection) that the ACs never asked for — both semantically identical, just diff noise.
  • Discarded a stray uncommitted deno fmt-style reformatting pass found sitting dirty in the worktree after the agent's commit (pure whitespace/quote changes, confirmed via git diff -w, never part of the actual commit).
  • WebKit (this repo's default Playwright engine) can't launch on this box (AlmaLinux 10 missing libjpeg.so.8/libjxl.so.0.8, same finding as TASK-355.5) — browser evidence here is chromium-only, stated explicitly rather than papered over.

Test plan

  • cargo clippy -p mt-tauri --all-targets — zero new findings
  • rustfmt --check on both touched Rust files
  • cargo test --workspace — 892 passed / 0 failed
  • deno lint / deno fmt --check on touched frontend files
  • npx vitest run — 626 passed / 17 failed, failure set identical to base main
  • E2E_MODE=full npx playwright test --project=chromium — 504 passed / 5 failed / 2 skipped, failure set identical to base main
  • git diff --name-only -- app/frontend/js/stores/ empty (AC#3)

shared.js kept its API_BASE as a hardcoded constant after the Python
sidecar was removed, so the HTTP path could never reach a sidecar on an
OS-assigned port. Make the base URL and bearer token module state with
that constant as the default, and fill them at startup from a new
sidecar_get_endpoint command reading the endpoint the Rust health probe
already resolved -- the same shape get_backend_url/initBackendUrl had in
621f681 and b3cc99c, plus the auth header the Zig sidecar requires.

library.getTracks is the one module flipped: it is the one endpoint the
Zig sidecar implements, so its tauriInvoke('library_get_all') branch is
now gone rather than merely unused. Every other domain module keeps its
tauriInvoke, which is still correct for commands with no sidecar
counterpart.

- [task-355.6]
…-355.6

Two hunks in 7e38f6a touched code the acceptance criteria never asked
about: handleFileDrop/testDialog's function->arrow conversion in main.js,
and a ternary condition flip in library.js's getSection. Both are
semantically identical to what was there before; reverting to keep the
diff to what AC#1-#4 actually describe.
Status stays In Progress rather than Done since AC#5 (the POC report and
go/no-go recommendation) is deliberately out of scope for this run and
still outstanding.
@pythoninthegrass
pythoninthegrass merged commit 9dd360b into main Sep 14, 2026
1 check passed
@pythoninthegrass
pythoninthegrass deleted the task-355.6 branch September 14, 2026 06:05
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