From 470971bf700eb1151a29ad9fceaf6a11b0819862 Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Sat, 5 Sep 2026 23:40:05 +0300 Subject: [PATCH] fix(install): keep the package store across an upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The install root is not only the artifact: `ludic add` caches fetched packages in /store, keyed by content hash. install_staged moved the whole root aside and replaced it, so re-running the installer — which is exactly what `ludic upgrade` does — deleted the cache and forced every project to refetch. The store is moved into the staged tree before the swap. Nothing else in the root is preserved, because everything else is the toolchain and should be replaced. Verified by staging an install, planting a store entry, upgrading, and reading the entry back. Co-Authored-By: Claude Opus 5 --- changes/installer-keeps-store.md | 6 ++++++ install.sh | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 changes/installer-keeps-store.md diff --git a/changes/installer-keeps-store.md b/changes/installer-keeps-store.md new file mode 100644 index 00000000..f5c969c8 --- /dev/null +++ b/changes/installer-keeps-store.md @@ -0,0 +1,6 @@ +bump: patch +type: fix +An upgrade keeps the package store. The installer replaces the whole install +root, and `ludic add` caches packages in `~/.ludic/store` — so re-running the +one-liner deleted every package a project had fetched. The store is carried +across now; everything else in the root belongs to the toolchain and is replaced. diff --git a/install.sh b/install.sh index dadf09e2..a098427c 100755 --- a/install.sh +++ b/install.sh @@ -182,6 +182,13 @@ install_staged() { if [ -d "$INSTALL_DIR" ]; then rm -rf "${INSTALL_DIR}.old" mv "$INSTALL_DIR" "${INSTALL_DIR}.old" + # The install root is not only the artifact: `ludic add` caches packages in + # /store, which is the user's data and takes a network round trip to + # rebuild. Carry it across rather than replacing the directory out from under + # it. (Anything else here is part of the toolchain and should be replaced.) + if [ -d "${INSTALL_DIR}.old/store" ]; then + mv "${INSTALL_DIR}.old/store" "${_staged}/store" || warn "could not carry the package store across" + fi fi mv "$_staged" "$INSTALL_DIR" rm -rf "${INSTALL_DIR}.old"