Repository navigation
Fix the .pkg's LaunchAgent identity and complete the cask's uninstall - #2372
Conversation
The .pkg installer's static plist registered under Label com.nodespace.daemon with bare KeepAlive: true, while the bundled NodeSpace.app self-registers under app.nodespace.daemon with the conditional SuccessfulExit: false form. Different labels meant the pkg and the app ran two independent daemons -- a tray Quit only ever stopped the one the app itself started, and the pkg's copy unconditionally restarted regardless. Relabeled and fixed KeepAlive to match daemon_setup.rs::write_plist exactly, renamed the plist file to match its own label, and added a regression test that reads the static file from disk and asserts both. The Homebrew cask's zap trash: list was missing the dev-build LaunchAgent (app.nodespace.daemon.dev.plist, confirmed left behind after brew uninstall --zap on a real machine) and the local database. Added both, documented why ~/.nodespace/models stays excluded (100GB+ of downloaded weights), and added coverage alongside the existing full-cask snapshot test. Co-Authored-By: Claude <[email protected]>
The prior commit renamed the file via git mv but never re-staged the content edit made after the rename -- git mv snapshots the file at its pre-edit content, so the previous commit shipped a byte-for-byte identical file under a new name (confirmed via `git diff --cached` showing zero changes before this commit, and the pushed raw content still reading Label=com.nodespace.daemon, bare KeepAlive: true). The two regression tests added in that same commit were correct and did catch this -- they were just never actually run against what got pushed, only against the uncommitted working tree. Co-Authored-By: Claude <[email protected]>
|
Correction — the review was right, the previous commit did not actually fix item 3. Root cause: I ran Pushed a follow-up commit (
Thank you for catching this -- it would have shipped the exact bug this PR exists to fix, completely unfixed, if not for the review. |
|
Independently re-verified the fix at the current head (5f402fc), this time from a completely fresh `git clone` (not the earlier local worktree state, not just a raw-file fetch): `scripts/pkg-resources/app.nodespace.daemon.plist` genuinely has `Label` = `app.nodespace.daemon` and the conditional `KeepAlive` dict form. Combined with the earlier raw.githubusercontent.com confirmation and the passing test run in the worktree that produced this exact commit (staged/verified via `git diff --cached` before committing this time, not just `git status`), I'm confident this is genuinely fixed now. Merging per standing authorization. |
Summary
Items 3 and 4 of #2366.
Item 3 — the bug that started the whole investigation. The
.pkginstaller's static plist registered underLabelcom.nodespace.daemonwith bareKeepAlive: true, while the bundledNodeSpace.appself-registers underapp.nodespace.daemonwith the conditionalSuccessfulExit: falseform (from core#2353). Two different labels meant the pkg and the app ran two independent daemons: a tray "Quit" only ever stopped the one the app itself started, and the pkg's own copy unconditionally restarted regardless of how it exited.Kept the
.pkgroute (didn't take the "delete it entirely" option the issue raised) and fixed it in place:app.nodespace.daemon, matchingdaemon_setup.rs'slaunch_agent_label()for the community build exactly. This isn't just a labeling fix -- it means the app's own existing self-healing bootstrap logic (bootout+retry on a failed registration) naturally takes over daemon lifecycle management once the user opens NodeSpace.app, with zero new reconciliation code needed.KeepAlive→ the conditional dict form, matchingwrite_plistand the Linux systemd unit'sRestart=on-failure.com.nodespace.daemon.plist→app.nodespace.daemon.plist) for consistency with the app's ownplist_filename()convention, updatingbuild-pkg.shandpostinstall's references.pkg_plist_matches_app_plist_tests) that reads the static file from disk and asserts both the label and the KeepAlive form, since this is a static file with no shared code path withwrite_plistand has already drifted from it once.Item 4. The cask's
zap trash:list was missing~/Library/LaunchAgents/app.nodespace.daemon.dev.plist(confirmed left behind afterbrew uninstall --zapon a real machine, per the issue) and~/.nodespace/database. Added both, documented why~/.nodespace/modelsstays excluded (100GB+ of downloaded weights -- trashing that on every zap would be hostile), and added test coverage alongside the existing full-cask snapshot test (which I updated -- its assertion needed to become the generator's own expected-output snapshot, not a claim about what's currently live on the tap, since the tap only re-syncs on the next real release).Test plan
.pkgplist and assert Label + KeepAlive -- mutation-verified (reverted the label, confirmed the test fails with a clear message; restored, confirmed it passes).zap trash:list -- mutation-verified (reverted to the old list, confirmed both tests fail; restored, confirmed all 10 pass).plutil -linton the fixed plist -- valid XML.cargo clippy -p nodespace-app --all-targetsclean (caught and fixed a real gap of my own here: the new test module needed#[cfg(test)], not just#[cfg(target_os = "macos")], or it compiles into the regular non-test build where its#[test]fns are genuinely dead code).bun run quality:fix+bun run test:allclean workspace-wide..pkginstall, tray Quit, leaves no daemon running and none restarts -- not exercised here, no macOS pkg-build/install environment available in this session.🤖 Generated with Claude Code