Repository navigation
fix(workspace): survive a mid-scaffold abort without wiping .vig-os - #1513
Merged
Merged
Conversation
The template rsync replaces .vig-os and the root .gitignore with template content that the write-backs only refill hundreds of lines later; an abort inside that window persisted a blanked manifest — the input of the next --force run. Snapshot both files before the copy, restore them on any failing exit with a loud message, and disarm after the late write-back. The u+w sweep is scoped to template-derived paths so consumer .git and build trees are never walked. Refs: #1480
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
Fixes the destructive non-atomicity from the field failure in #1480 (filesender 1.6.0→1.8.0):
init-workspace.shsnapshots.vig-osand the root.gitignoreimmediately before the template rsync (the point where both are replaced by template content whose values are only refilled by the write-backs hundreds of lines later). An EXIT trap restores both byte-for-byte on any failing exit inside that window and prints a loud message naming what was restored and warning that other scaffold files may be half-applied (withgit checkout -- <path>guidance). The guard disarms after the late write-back completes, so later non-window failures never roll back this run's resolved values. Covers both the normal and smoke copy paths.u+wsweep (suggestion 3): the blanketchmod -R u+w $WORKSPACE_DIRwalked the consumer's entire workspace —.gitobject packs (deliberately 0444), multi-GBtarget/,node_modules— the exact surface of the transientfts_readfailure that aborted the field run. The sweep is now keyed on the template tree (same shape as the init-workspace.sh chmod +x sweeps pre-existing consumer .sh files it does not own #1195+xsweep), skips symlinks, and additionally covers smoke overlays.Suggestion 4 from the issue (dirty-tree preflight) already exists (
install.shrun_preflight_guard, #1283); suggestions 1–3 are what this PR delivers. The related nix-detection gap is tracked on #1400.Test plan
New
tests/bats/upgrade-atomicity.bats(5 tests, executing the real script with a deterministic in-window abort via theVIG_OS_VERSIONvalidation exit — no stubs or signals):.vig-os+.gitignorebyte-for-byte, with the restore named in output.git/target/files stay 0444 through an upgradeThe #664 structural pin updated to assert the scoped sweep and the absence of the blanket
-R. Full local run: bats 530/530 green, scaffold-driven pytest suites (173 tests) green,prek run --all-filesgreen.Refs: #1480