Restart the daemon after a cask upgrade, and bump to 0.1.4 - #10
Merged
Conversation
brew upgrade --cask yap replaces /Applications/yap.app, but a running process keeps the image it already mapped, so you stayed on the previous version until something restarted the daemon. `yap --version` reads the new binary on disk and agreed with what you just installed, which is the worst shape for a bug: it looked fixed. postflight, not an uninstall stanza. Homebrew runs uninstall directives on upgrade too, where `launchctl` would delete the LaunchAgent plist and switch launch-at-login off, and `quit` would be followed by `open -b` — starting the daemon outside launchd where neither `yap stop` nor the login item can reach it. kickstart -k replaces the job launchd already owns, so the plist and the login item are untouched. Measured rather than assumed, because the alternative is losing a meeting: -k delivers SIGTERM, not SIGKILL. yap already catches SIGTERM and routes it through applicationWillTerminate, so a recording in flight is finalized — LastExitStatus 0 — and transcribes on the next start instead of losing its meta.json. launchd brings the new image up about five seconds later. must_succeed: false because launchctl exits 113 when there is no such job, and an install that never asked for launch-at-login must not fail its upgrade over it. Closes #6
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.
Closes #6, then bumps the version literal so
v0.1.4can be tagged.Ordering matters here: the cask is regenerated by the release workflow on every tag, and Homebrew runs the new cask's
postflightduring an upgrade. So merging this before tagging means the0.1.3 → 0.1.4upgrade itself restarts the daemon — not the one after it. Without it, anyone upgrading to 0.1.4 keeps running 0.1.3 in memory and would conclude the new transcript-ready banner from #9 simply does not work.The fix
Not an uninstall stanza, for the reasons already recorded in the cask heredoc: Homebrew runs those on upgrade too, where
launchctlwould delete the LaunchAgent plist (switching launch-at-login off on every upgrade) andquitwould be followed byopen -b, starting the daemon outside launchd where neitheryap stopnor the login item can reach it.kickstart -kreplaces the job launchd already owns.Measured, not assumed
The open question in the issue was whether restarting could interrupt a dictation press or an in-progress meeting recording destructively. A throwaway LaunchAgent mimicking yap's signal posture settled it:
kickstart -kdeliversexit 0kickstartagainst a label with no jobCould not find serviceyap already installs
DispatchSourcehandlers for SIGINT/SIGTERM that route toNSApp.terminate(nil), so SIGTERM runsapplicationWillTerminate: a live session is stopped cleanly, keeps itsmeta.json, and transcribes on the next start. The 113 is whymust_succeed: falseis required rather than tidy.Verification
Against the real launchd job on an M4, running the exact command the postflight will run:
That covers all three acceptance criteria in the issue. The generated cask was also checked as the workflow produces it — heredoc extracted from
release.yml, expanded with a realVERSION/SHA256, thenruby -c(Syntax OK) andbrew style --caskinside a throwaway tap (no offenses; it caught aLayout/HashAlignmentviolation on the first pass, hence the table alignment above).Full local CI gate green:
swift test, release build, the three smoke subcommands, embedded__info_plist, and the workflow's ownversion: "0.1.4"guard.Deliberately not included
The issue's closing note — a
yap doctorline comparing the running image against the executable on disk, for people who installed from the.dmgand still restart by hand. It is outside the acceptance criteria and needs a heuristic (process start time against binary mtime) with its own false-positive modes, so it wants to be its own change rather than a rider on a release.