fix: grain up handles existing/stale daemon correctly - #12
Merged
Conversation
Previously grain up always spawned a new process and treated any existing socket as success, so a leftover grain up --fg could hold the API port while a second up reported a dead pid. Now: - healthy daemon → "already up" (no second process) - live pid but unhealthy → error pointing at grain down - dead pid / orphan socket → cleaned before start - background start waits for healthz or child exit (no false success) - Setsid so shell Ctrl+C does not signal the daemon - grain down cleans stale files and SIGKILLs if needed
|
Coverage (lines): commit Coverage report by file (74% overall — click to expand)
|
Stop the local daemon, remove the CLI binary, and optionally purge the data directory with --purge (-y skips the prompt). Default keeps VMs and images; always drops the installer agent cache and runtime files.
Same-repo PRs already post coverage from ci.yml and never upload the coverage-report artifact. The workflow_run job still ran for every PR and failed with "Artifact not found". Gate on head_repository != base and use the compact coverage-pr-comment.sh script for fork posts too.
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
grain upcould print success while an old daemon still owned the socket/API, or after a new child failed to bind. Users sawdaemon not upright after a successful-lookinggrain up.Changes
Setsidon background daemongrain downcleanupTest plan
go test ./internal/cli/grain up --fg, rungrain up→ should say already up or tell you tograin downgrain upshould clean and start