Repository navigation
Conversation
The improved-plan cache held the improved plan and the elaborated plan it was made from, beside the elaborated-plan cache that already holds the latter. The improved plan is the elaborated plan with the units found in the store marked as installed, so improved-plan now holds only which of the plan's units are in the store, and the marking is redone from that set on each run. The store directory is monitored as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A dependency is planned until it is in the store and planned again once it is removed from there, with the project unchanged. OfflineFlag covers the first half; nothing covered the second. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
c53f2fa to
e17d443
Compare
| -- changes. So what is cached for the improved plan is only which of | ||
| -- the plan's units are in the store, not a second copy of the plan. |
There was a problem hiding this comment.
| -- changes. So what is cached for the improved plan is only which of | |
| -- the plan's units are in the store, not a second copy of the plan. | |
| -- changes. So, we only cache whether | |
| -- each of the plan's units are in the store, rather than an entire second copy of the plan. |
Maybe something like this is a bit clearer?
| The `improved-plan` cache file no longer holds two more copies of the install | ||
| plan, only which of the plan's packages are in the store. |
There was a problem hiding this comment.
This describes implementation changes. Changelog entries IMO should describe user facing changes instead
|
@PaleRoses, I think the new
The plan no longer lists On master, step 2 rebuilds let store = storeDirectory cabalStoreDirLayout (pkgConfigCompiler elaboratedShared)
storeUnits <-
rerunIfChanged verbosity fileMonitorImprovedPlan (store, planUnits) $
phaseImprovePlan elaboratedPlan elaboratedShared planUnits |
A dependency built into one store is planned again when the same project is built against a second, empty store, and is not planned once back on the first store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan's unit ids are the same whatever the store, and the cache only watches the store it last read. So after a build with one store, a build with another store reused the first store's answer and treated units missing from the second store as installed. The store directory for the plan's compiler is now part of the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reword the comment above the cached improvement step as suggested in review, and say in the changelog entry what changes for a user rather than how the cache is built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ulysses4ever thanks, I reproduced it with your steps. The PR narrowed the cache key to the plan's unit ids and dropped the store directory. I took your fix in 544a1c7 and added a test that switches stores and then switches back. @TeofilC sorry for the delay! I put both suggestions in b8444a1. |
This removes the duplicate plans from
cache/improved-plan. On master, the build cache holds every unit of the install plan three times: once inelaborated-planand twice inimproved-plan. The improved plan is the elaborated plan with units found in the store marked as installed.improved-plannow holds the set of the plan's units that are in the store, keyed by the store directory and the set of configured units. The store directory is monitored as before, and the marking is redone from the set on each run. Animproved-planwritten by an older cabal is treated as stale and overwritten without re-solving.This is the follow-up I offered on #12463. #12464 and #12500 have merged since, so the table's last two rows are master and this PR today. Each unit still keeps its own copy of the finalized
PackageDescription, the follow-up already named in #12464.I measured HLS at
bc2bbb8ewith the method from #12464, using GHC 9.12.4,-O1, assertions enabled and a populated dependency store. These are medians of six order-balancedcabal build all --dry-runruns on a shared macOS development machine. I applied the diff to0687f8d2f. For the last column, I added one entry to the store between runs.improved-plancache/0687f8d2fThe dry-run build list and
plan.jsonwere identical with and without the PR on every run, including after store additions and removals and toggling--disable-testsand back.AI disclosure: written with Claude Code (Fable 5.2 and Opus 5.5).
significance: significantin the changelog file.StoreUnitRemoved,StoreDirChanged)QA Notes
Build a project with a dependency from Hackage;
dist-newstyle/cache/improved-planis a few KB. Build again; the second build is up to date. Delete the dependency's directory from the store;cabal build --dry-runlists it again.StoreUnitRemovedcovers this. Run the dry run again with--store-dirpointing at an empty directory; the dependency is listed, and going back to the first store it is not.StoreDirChangedcovers that.