Repository navigation
Conversation
Keep the configured program database shared and fingerprint its complete records once per project for per-component cache invalidation. Cover PATH/REPL changes and a tool version change at a fixed path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PathRecomp already checks that a PATH change reaches the REPL. Keep the checks the fingerprint adds: a tool version change at a fixed path reconfigures, and elaborating again with the same programs does not. Use a checked-in package instead of writing it from the script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0fdb3c2 to
eb9d0af
Compare
The haddock names the shared program database the fingerprint stands for and why it lives in the component: that record is the configure cache key. The test's comments say what it checks and what PathRecomp covers, and why editing cabal.project is what makes the plan elaborate again. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ulysses4ever
left a comment
There was a problem hiding this comment.
Thanks, this looks right to me. One comment inline on the test, and two on the description.
What I checked:
-
The field had one job: cf4083b (#2015) added it so that the
cache/configkey changes whenPATHdoes, whichPathRecomptests. Nothing reads it, and the key is compared with==(normaliseConfiguredPackageonly toucheselabProgramArgs), so a hash of theBinaryencoding notices the same changes. It is computed once, in thewhereofelaborateInstallPlan. -
The complete records are needed. Hashing
programDbSignature compilerProgDbinstead makesPathRecompfail, and clearing everyprogramVersionmakesConfiguredProgramCachefail; each test passes when only the other one's part is broken, so the new test isn't redundant. It also passes at the base, as it should for a change that keeps the behaviour. -
It merges cleanly with #12464, and the merge passes
ConfiguredProgramCache,PathRecompandT12463. -
On the #12463 repro (40 public sublibraries, 16 flags; GHC 9.10.3 on Linux, in a nix shell whose
PATHhas 43 entries), a no-opcabal build all, five runs each:improved-plancache/config(42 files)no-op base 0687f8d2f32.6 MB 16.4 MB 0.82–0.84 s this PR 30.2 MB 15.2 MB 0.56–0.57 s #12464 + this PR 2.8 MB 1.4 MB 0.14 s
On the description:
- It could say why
PATHhas to stay in the key: #2015 added the field so that aPATHchange reconfigures, andprogramDbSignaturedropsPATH(it keeps the versions, so "keepingPATHand tool versions" reads as if it didn't). - The QA notes say that changing only the version the script prints makes the next build reconfigure. It doesn't, at the base or with this PR: nothing monitors the tool, so the next build is up to date until
cabal.projectchanges too, as in the test.
The later commits fix up the first, whose message still mentions the PATH/REPL test that the third one removed, so I'd merge with squash (squash+merge me).
| -- The script is the monitored file, not the version file it reads, so | ||
| -- editing cabal.project is what makes cabal elaborate the plan again. |
There was a problem hiding this comment.
Nothing monitors the script either: editing only the script, so that it prints a new version, leaves the next build up to date (at the base and with this PR). cabal probes the version when it elaborates the plan, and nothing monitors the programs that phaseElaboratePlan configures with configureAllKnownPrograms. That gap is older than this PR. Maybe:
| -- The script is the monitored file, not the version file it reads, so | |
| -- editing cabal.project is what makes cabal elaborate the plan again. | |
| -- Nothing monitors the tool, so cabal probes its version again only when | |
| -- it elaborates the plan again, which editing cabal.project makes it do. |
The script is not monitored either; cabal probes the tool's version only when it elaborates the plan again, which the cabal.project edit forces. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thanks for checking all of that. I applied your comment on the test in 26cfc11. The description now says why Squash sounds right to me. |
| , elabConfiguredProgramsHash :: HashValue | ||
| -- ^ Fingerprint of the configured programs in 'pkgConfigCompilerProgs'. | ||
| -- This record is the configure cache key, so the fingerprint keeps every | ||
| -- program's location, version, arguments and environment, @PATH@ included, |
There was a problem hiding this comment.
The fact that PATH is copied into programs is a complete misdesign in my opinion (see #12481). So we should absolutely not enshrine that into a comment as if it was desired behaviour.
There was a problem hiding this comment.
I agree; now the comment is more minimal.
The haddock listed what a configured program holds, PATH included, which read as if copying PATH into the records were intended (see haskell#12481). It now says only what the field is: a hash of the configured programs that changes the configure cache key when one of them changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This removes
elabConfiguredProgramsfrom each elaborated component. Nothing read it; it was part of the configure cache key. Each component now keeps one hash of the list, computed once per project, and the records themselves stay in the sharedProgramDb.On #12463, Andrea traced the extra copies to #11768 and suggested stripping the field as
programDbSignaturedoes. I hashed the complete records instead: #10817 added the field for #2015 so that aPATHchange reconfigures, andprogramDbSignaturedropsPATH.Follow-up to #12464; applies with or without it.
On HLS at
bc2bbb8e, using the method from #12464, the second dry run of ten order-balanced rounds:improved-plan538d465eb00d86feb5eb9d0af60With #12464 the plan is within 3% of 3.16.
AI disclosure: written by Codex and Claude Code with Opus 5.5, following the review on #12464.
significance: significantin the changelog file.ConfiguredProgramCache)QA Notes
Build a package twice; the second build is up to date. Point
--with-haddockat a script that prints a version, then editcabal.project; the next build is still up to date. Change the version the script prints and editcabal.projectagain; the next build reconfigures. Changing only the version leaves the build up to date, at the base too, because nothing monitors the tool.ConfiguredProgramCachecovers this.