fix(cli): harden auto-refresh service lifecycle#139
Merged
Conversation
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
Auto-refresh service behavior had a few lifecycle and diagnostic gaps:
launchdcould have the watcher loaded while Darc reported the wrong watch state because stale status files were collapsed into ageneric “launchd not running” diagnosis.
darc service stopcould unload the LaunchAgent but leaverun/status.jsonmarked asrunning: true, making later status outputmisleading.
run/already existing, which could make stop/disable failon corrupt or cleaned runtime state.
KeepAliveexposed a start regression:service start/refresh --autocould hang because Darc bootstrapped aRunAtLoadservice and then immediately ran
kickstart -k.What Changed
KeepAliveandThrottleInterval.run/directories are created before writing stopped status.watch_pid/watch_tokenidentity fields so an old watcher only clears status if it still owns the file.bootstrapfor enabledRunAtLoadLaunchAgents, and only use plainkickstartfor runtime-onlyplists.
Testing
cargo +nightly fmtcargo test -p darc service_watchcargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::allscripts/check-linux-clippy.shcargo test --workspace --all-featurescargo build --bin darcLive Checks
darc service statusand blocks concurrent refresh with holder details.kickstart -khang with a custom LaunchAgent and verified plain runtime kickstart returns immediately.