Repository navigation
[repo-assist] Fix restore cache to detect missing .paket/load scripts - #4363
Conversation
When a group has generate_load_scripts enabled but a user deletes the .paket/load folder without touching paket.lock, the restore hash cache previously reported 'up to date' and skipped restore entirely, so load scripts were never regenerated. This adds a check for the presence of the .paket/load folder (when required) to the early-exit condition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/repo-assist add an integration test for this? |
|
✓ Repo Assist completed successfully, see workflow run.
|
…3238 The earlier fix added a check to prevent the restore hash cache from early-exiting when the .paket/load folder was missing, but the inner restore branch only called CreateScriptsForGroups when packages were not already up to date. Since packages remained up to date, the load scripts were still never regenerated - reproduced manually before this change. This adds a call to CreateScriptsForGroups in the 'packages already up to date' branch when the load scripts folder is missing, and adds an integration test (dependencies-file-flag scenario) that deletes .paket/load after install and verifies paket restore regenerates it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🤖 This is an automated response from Repo Assist. I found and fixed a real gap in the earlier commit: it stopped the restore-hash cache from early-exiting, but the "packages already up to date" branch never actually called script generation, so
Add this agentic workflow to your repoTo install this agentic workflow, run |
AI disclosure
This PR was created automatically by Repo Assist, an AI assistant helping maintain this repository.
Closes #3238
Root cause
RestoreProcess.fs's early-exit / restore-cache logic (readCache,canEarlyExit) only compares a SHA256 hash ofpaket.lockagainst a cached hash. It has no awareness of whether the.paket/load/folder (generated when a group setsgenerate_load_scripts: true) still exists on disk. If a user deletes.paket/load/without changingpaket.lock, the cache reports "up to date" andpaket restorebecomes a silent no-op, never regenerating the load scripts.Fix
Added a
loadScriptsMissingcheck: if any lock-file group requires load scripts (GenerateLoadScripts = Some true) and the.paket/loadfolder is missing, the restore cache can no longer report an early exit, forcingCreateScriptsForGroupsto run and regenerate the scripts. When no group requires load scripts, or the folder still exists, behaviour is unchanged (same hash-based caching as before), so this should not affect performance for the common case.Trade-offs
Directory.Existscheck per restore whencanCacheRestoreis true and at least one group has load scripts enabled - negligible cost compared to a full restore.Restore, and properly exercising it needs a full integration-test scenario (lock file + on-disk load folder deletion) rather than a unit test. Flagging this as a good follow-up for a maintainer or a futurepaket.load-focused integration test.Test Status
dotnet restore src/Paket.Core/Paket.Core.fsproj -p:PaketDisableGlobalRestore=true- succeededdotnet build src/Paket.Core/Paket.Core.fsproj -f netstandard2.0 --no-restore -p:PaketDisableGlobalRestore=true- succeeded, 0 errorsdotnet test tests/Paket.Tests/Paket.Tests.fsproj -f net9 --no-restore -p:PaketDisableGlobalRestore=true- 1238 passed, 16 skipped, 6 failed. All 6 failures are pre-existing/environment-specific (proxy env-var tests inUtilsSpecs, anet461-only assembly-metadata test, and an XML-generation test) and reproduce identically onmasterwithout this change - confirmed no new regressions.🤖 This pull request was created by Repo Assist, an automated AI assistant. A human maintainer should review before merging.
Add this agentic workflow to your repo
To install this agentic workflow, run