feat(frontend): inject sidecar endpoint, flip library.getTracks (TASK-355.6 AC#1-4) - #50
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_backend_url/initBackendUrl, removed in9feabb0), adapted forshared.js's split-out API modules and the Zig sidecar's bearer-token auth.sidecar_get_endpointTauri 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 ofsidecar.json.shared.js'sAPI_BASEbecomes mutable module state (setBackendEndpoint) with the old hardcoded value as default/fallback;request()attachesAuthorization: Bearer <token>only when a token is set.main.jscalls a newinitBackendUrl()beforeAlpine.start(), guarded against both thrown errors and theundefinedreplies several Playwright specs' hand-rolledinvokemocks return for unrecognized commands.library.js'sgetTracks()— the only frontend caller of the one Zig-backed endpoint — drops itstauriInvoke('library_get_all')branch entirely and callsrequest()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, notDone.Review notes
Built by an unattended
piagent run (gnhf skill) in an isolated worktree, then reviewed by hand before push:mainin a throwaway comparison worktree.function→arrow conversion inmain.js, a ternary reorder inlibrary.js's unrelatedgetSection) that the ACs never asked for — both semantically identical, just diff noise.deno fmt-style reformatting pass found sitting dirty in the worktree after the agent's commit (pure whitespace/quote changes, confirmed viagit diff -w, never part of the actual commit).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 findingsrustfmt --checkon both touched Rust filescargo test --workspace— 892 passed / 0 faileddeno lint/deno fmt --checkon touched frontend filesnpx vitest run— 626 passed / 17 failed, failure set identical to basemainE2E_MODE=full npx playwright test --project=chromium— 504 passed / 5 failed / 2 skipped, failure set identical to basemaingit diff --name-only -- app/frontend/js/stores/empty (AC#3)