Repository navigation
fix(clean): keep Coursier's JDK and sbt dependency cache out of cleanup - #2234
Merged
Merged
Conversation
The User app cache sweep removes each folder under ~/Library/Caches as a whole, and nothing kept ~/Library/Caches/Coursier. On macOS that folder holds Coursier's artifact cache (v1), where sbt 1.3 and later resolves dependencies by default, and its archive cache (arc), where cs setup installs a JDK when it finds none and points JAVA_HOME at it in the shell profile files. After mo clean, JAVA_HOME named a folder that no longer existed until cs setup ran again, and the next sbt build downloaded every dependency again, while clean_dev_jvm leaves sbt's older stores (~/.ivy2/cache, ~/.sbt/boot) alone on purpose. should_protect_path now keeps the folder next to the other tools that run from ~/Library/Caches (Playwright, Camoufox, Cypress, Puppeteer). No setting or whitelist row. Refs tw93#2233
The high-risk denylist case now requires should_protect_path to keep ~/Library/Caches/Coursier, a JDK under arc and a jar under v1. A new clean_user_essentials case drives the real safe_clean_guarded path in a fixture HOME and requires the JDK and the jar to survive, while an ordinary cache root beside them is removed, so the sweep is known to have run. Without the protection, should_protect_path returns 1 for these paths and the sweep takes the folder, so both cases fail. Refs tw93#2233
1 task done
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
Closes #2233
The
User app cacherow inclean_user_essentialsremoves each folder under~/Library/Cachesas a whole (lib/clean/user.sh:343-388), and nothing kept~/Library/Caches/Coursier. On macOS that folder holds Coursier's artifact cache (v1), where sbt 1.3 and later resolves dependencies by default, and its archive cache (arc), wherecs setupinstalls a JDK when it finds none and pointsJAVA_HOMEat it in the shell profile files. Aftermo clean,JAVA_HOMEnamed a folder that no longer existed untilcs setupran again, and the next sbt build downloaded every dependency again.clean_dev_jvmleaves sbt's older stores (~/.ivy2/cache,~/.sbt/boot,~/.sbt/launchers) alone on purpose (lib/clean/dev.sh:3522-3530).should_protect_path(lib/core/app_protection.sh) now keeps~/Library/Caches/Coursierand everything below it, in the arm that keeps the Playwright, Camoufox, Cypress and Puppeteer folders, with a comment that says what the folder holds. The root pattern also coversjvm/, where Coursier before 2.1 kept its JVMs._safe_clean_implchecksshould_protect_pathfor every target before sizing (bin/clean.sh:1037), in real and dry runs alike, so the sweep now logs the folder asSKIPPED ... protectedand the preview no longer lists it. The other folders under~/Library/Cachesare swept as before.Safety Review
mo cleanno longer removes~/Library/Caches/Coursier. Nothing new is swept or deleted.*/Library/Caches/Coursier | */Library/Caches/Coursier/*toshould_protect_path.Tests
./scripts/check.sh,./scripts/test.shvia GitHub Actions CI on this PR)tests/core_safe_functions.bats:should_protect_path applies high-risk cleanup denylistnow requires the folder itself, a JDK'sbin/javaunderarc(the layout of thecs java-homeexamples in Coursier'sdoc/docs/cli-java.md, with theContents/Homeof a macOS JDK) and a Scala jar underv1.tests/clean_user_core.bats:clean_user_essentials keeps Coursier's JDK and sbt dependency cache (#2233), next to the #1607 case it follows. It drives the realsafe_clean_guardedpath in a fixture HOME and requires the JDK and the jar to survive, while anordinary-appcache root beside them is removed, so the sweep is known to have run.On
main, no branch ofshould_protect_pathmatches these paths: the protected bundle globs and theshould_protect_datanames hold nothing for Coursier, Java or Scala, and the sweep's own filters (the namecase, the Chromium singleton check, the Deno root) do not apply. So both cases fail there.Commits:
112867a2fix(clean): keep Coursier's JDK and sbt dependency cache out of cleanup789f4f28test(clean): cover the Coursier folder in the user cache sweepSafety-related changes
~/Library/Caches/Coursierand everything below it against removal by the user cache sweep and any other sink that checksshould_protect_path.