Repository navigation
fix(prune): preserve crash recovery copies when active Go is broken - #51
Merged
Merged
Conversation
johnny4young
marked this pull request as ready for review
October 7, 2026 17:58
# Conflicts: # CHANGELOG.md
- close stdin and clear a stale GOROOT in the shared go version probe - handle plain prune first so the rollback path probes and decides once - cover side-by-side links, a dangling activation link, GOROOT and stdin - document residue retention in the README, schema and architecture notes - tidy the Fixed list spacing in the changelog Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExmnfUngrDYjAheGvYwMnn
Git Bash ln -s copies and cannot link a missing target, so the new side-by-side cases would abort the suite on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExmnfUngrDYjAheGvYwMnn
# Conflicts: # CHANGELOG.md
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.
Exact-head qualification (2026-10-07)
Ready for independent maintainer review. CI run 37661223312 passed all 10 jobs on head
99a1c54f9f186feaaaa892cdcb6e1b247b29d176: ShellCheck, shfmt, actionlint, workflow validation, smoke tests and composite-action installs across Linux/macOS/Windows.19686ea58f53c8f650c02f8080ea956aefdfdb7dis GitHub's synthetic test merge. Its fetched tree equals the head and locally tested treeb7fbe479fe9628173ba5ed7b3cb5bc09bc3b9d89The local Ruby limitation below remains accurately recorded; hosted checks supplied that missing coverage. No merge, release or deployment performed.
Problem
gos prune --rollbacktreated an executablebin/goas a healthy active installation when deciding whether to remove crash-recovery.gos-backup.*/.gos-current.*copies. A broken executable, including one that prints a version and exits 7, could therefore cause the only working recovery copies to be removed. The README promises residue is removed only once active Go works.Change
_gos_go_version_ofhelperGOTOOLCHAIN=localprevents a project/caller toolchain override from downloading or masking the broken binary--rollbackis requested and residue actually existsExplicit removal of the named
.gos-rollbackslot and cache cleanup retain their existing semantics. This guard concerns crash residue, which may be the last working copy after interrupted activation.Regression evidence
The new offline fixture first failed against main: an active binary printed a valid Go version but exited 7, while the dry-run still reported both recovery copies as removed. It now covers failed, empty and healthy probes, real/dry-run JSON counts, preservation/removal on disk, one probe per cleanup, local toolchain forcing, no network, and no probe for ordinary prune or an absent residue set.
Validation and limits
scripts/validate-local.bash --required-onlyis blocked at its required Ruby preflight; command-surface generation cannot be validated locally without itbash -n gos.sh install.sh tests/prune-recovery.bashand staged whitespace checks passedb7fbe479fe9628173ba5ed7b3cb5bc09bc3b9d89Risk and scope
Pruning residue now executes the managed binary's local version probe. Unrecognized/custom runtimes are conservatively preserved instead of treated as disposable recovery state. The probe does not authenticate a binary; archive integrity remains
gos verify's responsibility.Based on main
05d9e25361e1d7e328f0fc057b7d79b442ee2304; deduplicated against open #41 and #44–50. #50 improves doctor diagnostics, while this change guards destructive cleanup. No API/schema change, merge, release or deployment.