Repository navigation
fix(daemon): keep daemon binary in lockstep with curl-installed CLI - #308
Merged
Merged
Conversation
A curl reinstall left the daemon service on the previous release: ResolveDaemonBinaryPath preferred an unmanaged shelltime-daemon in /opt/homebrew/bin over the fresh one next to the curl CLI, and daemon install then moved the fresh binary aside to .bak. - ResolveDaemonBinaryPath: when the running CLI is the curl-installer copy, return its sibling daemon first. - shelltime update: always write the daemon to ~/.shelltime/bin instead of whatever path resolves, so it never overwrites a Homebrew cask symlink with an unmanaged file (which also blocks later brew installs). - daemon install: restore shelltime-daemon.bak only when the live daemon is missing, instead of clobbering a newly installed release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (61.11%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Problem
Reinstalling with
curl -sSL https://shelltime.xyz/i | bashupdated the CLI to 0.1.90, butshelltime daemon statusstill reported 0.1.89.The cause, as diagnosed on an affected machine:
/opt/homebrew/bin/shelltime-daemonwas a regular file (0.1.89) that Homebrew didn't own. The only code path that writes a daemon there isshelltime update→resolveDaemonDest()→ResolveDaemonBinaryPath(), whichReplaceBinarys over the cask symlink.brew installfailed ("It seems there is already a Binary at …"), so it fell back to the manual install and put 0.1.90 in~/.shelltime/bin/.shelltime daemon reinstallthen resolved the daemon to the stale/opt/homebrew/bincopy (PATH/Homebrew is preferred over the curl location). It renamed the fresh 0.1.90 daemon toshelltime-daemon.bakand pointed launchd at 0.1.89.daemon installwould also have restored that.bakover the newly installed daemon unconditionally.Changes
model/path.goResolveDaemonBinaryPath: if the running CLI is the curl-installer copy (DetectInstallKind == InstallKindCurl) and~/.shelltime/bin/shelltime-daemonexists, return it first. Homebrew CLIs keep the existing order, which returns the stable/opt/homebrew/binpath. The CLI path is read through a swappablecurrentCLIBinaryPathvar for tests.commands/update.goresolveDaemonDest: always returnsGetCurlInstallerDaemonPath().updateonly proceeds for curl installs, so it must never write into a Homebrew prefix.commands/daemon.install.go: the.bakrestore moves intorestoreCurlDaemonBakand only runs when the live curl daemon is missing.The companion installer fix is in shelltime/installation (
fix/brew-install-orphans).Tests
model/path_test.go: a curl CLI prefers its sibling daemon over PATH/Homebrew, and falls back to Homebrew when its daemon is missing. Existing cases are unchanged; the isolation helper now pins a neutral running CLI.commands/daemon.install_test.go: table test forrestoreCurlDaemonBak.commands/update_test.go:resolveDaemonDestreturns the curl path even when a daemon is on PATH.The new tests pass and
go vetis clean.go test ./commands/still has 10 local failures (socket and bolt tests); the same 10 fail onmain.🤖 Generated with Claude Code