fix(tauri-build): honor CARGO_BUILD_TARGET when locating skill-daemon#79
Open
FourthWiz wants to merge 1 commit into
Open
fix(tauri-build): honor CARGO_BUILD_TARGET when locating skill-daemon#79FourthWiz wants to merge 1 commit into
FourthWiz wants to merge 1 commit into
Conversation
cargo reads CARGO_BUILD_TARGET from the environment and writes build output under the target-triple directory, but tauri-build.js only consulted the explicit --target flag when locating the freshly built skill-daemon binary (and the macOS .app bundle for widget embedding). With the repo's own .envrc exporting CARGO_BUILD_TARGET on macOS, every direnv-enabled dev run hit the miss: a spurious 'skill-daemon binary not found after build' warning, a skipped stale-daemon reap (killPortOwner), and a skipped SKILL_DAEMON_BIN handoff. Fall back to process.env.CARGO_BUILD_TARGET before the empty triple in both locator sites. The daemon itself still started before and after (resolve_daemon_bin_path papers over the miss) — the fix targets the misleading warning and the skipped reap, not a broken daemon.
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
scripts/tauri-build.jslocates the freshly builtskill-daemonbinary using only the explicit--targetflag (explicitTarget, populated at:279-286); theCARGO_BUILD_TARGETenvironment variable has zero hits in the script. But cargo — invoked at:966with the inherited env — does readCARGO_BUILD_TARGETand writes the binary under the target-triple directory. The repo's own.envrc:11-12exportsCARGO_BUILD_TARGET=aarch64-apple-darwinon macOS (and.envrc:2says todirenv allowonce after cloning), so on the documented dev setup the locator misses on everynpm run tauri dev.This PR falls back to
process.env.CARGO_BUILD_TARGETbefore the empty triple:What actually breaks (and what doesn't)
Being upfront: the daemon still starts either way —
resolve_daemon_bin_path()(src-tauri/src/daemon_cmds.rs:126-183) papers over the miss via itscurrent_exe()sibling probe, and its relative candidate list even hardcodes the triple path. So this is not "the daemon is broken." What the miss does cause, on every direnv-enabled dev run:⚠ skill-daemon binary not found after build — Tauri will attempt auto-launchwarning — on the repo's own documented dev setup.killPortOwner(daemonPort)is skipped, so a stale dev daemon on the dev port is not reaped before the new run.SKILL_DAEMON_BINhandoff is skipped (redundant in practice — see above — but skipped nonetheless).Before/after (macOS, Apple Silicon; command:
CARGO_BUILD_TARGET=aarch64-apple-darwin npm run tauri dev)Before:
(cargo had just written
src-tauri/target/aarch64-apple-darwin/debug/skill-daemon; later in the same run the app auto-launched it anyway — the warning is spurious.)After:
Zero occurrences of the warning in the after-run log.
Scope note
The same
explicitTarget || ""pattern occurs twice; this PR fixes both::970— the skill-daemon locator (verified with the before/after transcript above);:1091— the macOS.appbundle lookup for widget embedding in thebuildsubcommand (same pattern applied for consistency; the existing no-triple candidate remains as fallback, so behavior withoutCARGO_BUILD_TARGETis unchanged; not separately transcript-verified).Testing
No vitest coverage exists for
scripts/tauri-build.js, and a test harness for a dev script would exceed this fix's blast radius — the before/after transcripts above are the verification.