Repository navigation
Description
Summary
The upgrade file report (--preview and the interactive --force confirmation) added in #886 shows empty OVERWRITTEN / ADDED / PRESERVED sections on the Nix-built image, so it tells a consumer "No existing files would be overwritten. No new files would be added." immediately before an upgrade that actually rewrites the managed scaffold. This defeats the reviewable-upgrade safety net #886 exists to provide.
Found during local 0.5.0-rc2 validation against real consumers (see PR #938 comment). Verified on talys: --preview reports nothing, a real --force rewrites ~21 tracked files.
Root cause
assets/init-workspace.sh:534 classifies template files with:
done < <(find "$TEMPLATE_DIR" -type f ! -path "*/.git/*" -print0)On the Nix image the baked template /root/assets/workspace is a tree of symlinks into the nix store (the read-only-symlink layout the script itself documents near the rsync -avL copy). find … -type f does not match symlinks, so the loop iterates zero files and every classification bucket (OVERWRITTEN/ADDED/PRESERVED) stays empty. The real copy uses rsync -avL, which dereferences the links and works — so only the report is blind. The DELETED (mode-prune) section is unaffected because it scans the workspace, not the template.
Evidence from the 0.5.0-rc2 image:
find /root/assets/workspace -type f → 0
find -L /root/assets/workspace -type f → 1872
find /root/assets/workspace -type l → 998
Expected vs actual
- Expected:
--previewon an already-scaffolded consumer lists the managed files that would be overwritten and any newly added files. - Actual: every run reports "No existing files would be overwritten / No new files would be added" regardless of tree state.
Fix
Make the classifier follow symlinks — find -L "$TEMPLATE_DIR" -type f … — matching the rsync -avL copy semantics. Single-site change (line 534 is the only find over $TEMPLATE_DIR).
Acceptance criteria (TDD)
- A host-runnable test (e.g. in
tests/bats/init.bats, overridingTEMPLATE_DIR/WORKSPACE_DIR) that seeds a symlinked template file already present in the workspace, runsinit-workspace.sh --preview --force, and asserts the file appears in the OVERWRITTEN section. This test must fail on currentmain/releaseand pass after the fix. - No regression to the DELETED/PRESERVED reporting or the actual copy/prune behaviour.
Activity
test: cover upgrade preview report over symlinked templates
fix(workspace): upgrade preview report follows template symlinks
fix(workspace): upgrade preview report follows template symlinks (#949)…
fix(workspace): upgrade report excludes .venv/docs from the ADDED walk
fix(workspace): upgrade report excludes .venv/docs from the ADDED walk (
fix(workspace): ship nested scaffold docs + fix imageless DEVKIT_ORG …
chore: release 0.5.0 (#938)