Repository navigation
fix(workspace): upgrade preview report follows template symlinks (#949) - #950
Merged
Merged
Conversation
The Nix image bakes assets/workspace as symlinks into the nix store, so the --preview/--force classifier's find -type f matched zero files and the OVERWRITTEN/ADDED report was always empty. Add bats coverage that seeds a symlinked TEMPLATE_DIR and asserts a conflicting file lands under OVERWRITTEN and a workspace-absent one under ADDED. Refs: #949
On the Nix image the baked template /root/assets/workspace is a tree of symlinks into the nix store, so the --preview/--force classifier's find -type f matched zero files and the OVERWRITTEN/ADDED report was always empty. The real copy uses rsync -avL (follows symlinks), so only the report was blind. Add -L so the classifier dereferences symlinks and matches the copy semantics. Refs: #949
c-vigo
enabled auto-merge
July 9, 2026 06:16
Contributor
Author
|
Reviewed the diff: the fix is the single-site |
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
On the Nix image the baked template
/root/assets/workspaceis a tree of symlinks into the nix store. The--preview/--forceupgrade classifier atassets/init-workspace.sh:534walked it withfind "$TEMPLATE_DIR" -type f …, which matches zero files against a symlink tree (verified:find -type f→ 0,find -L -type f→ 1872). So the OVERWRITTEN / ADDED / PRESERVED report was always empty ("No existing files would be overwritten").Root cause
The real copy uses
rsync -avL, which follows symlinks, so files were still overwritten — only the report was blind. TheDELETEDsection is computed separately and was unaffected. This is the solefindover$TEMPLATE_DIR.Fix
Make the classifier follow symlinks to match the copy semantics:
Tests (TDD, red → green)
Added two bats tests in
tests/bats/init-workspace.batsthat seed a symlinkedTEMPLATE_DIR(mirroring the baked image) and drive--preview --force --no-promptsagainst a host workspace:Both failed on the old code (report said "No existing files would be overwritten" / "No new files would be added") and pass with the fix. Full
init-workspace.batssuite: 123 passed, 0 failed. Fullprek run --all-fileshook suite: green (sync-manifest propagated the CHANGELOG entry to the scaffold copy).Refs: #949
Closes #949