Skip to content

Drop elabConfiguredPrograms from the elaborated plan - #12500

Merged
mergify[bot] merged 7 commits into
haskell:masterfrom
PaleRoses:program-cache-fingerprints
Nov 18, 2026
Merged

mergify[bot] merged 7 commits into
haskell:masterfrom
PaleRoses:program-cache-fingerprints

Conversation

@PaleRoses

@PaleRoses PaleRoses commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

This removes elabConfiguredPrograms from 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 shared ProgramDb.

On #12463, Andrea traced the extra copies to #11768 and suggested stripping the field as programDbSignature does. I hashed the complete records instead: #10817 added the field for #2015 so that a PATH change reconfigures, and programDbSignature drops PATH.

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:

Version improved-plan Median second dry-run Min–max
3.16.1.0 22.44 MB 0.556 s 0.541–0.596 s
PR base 538d465eb 59.85 MB 1.245 s 1.153–1.492 s
#12464 00d86feb5 32.21 MB 0.998 s 0.890–1.156 s
This PR eb9d0af60 50.68 MB 0.852 s 0.820–0.898 s
#12464 + this PR 23.04 MB 0.483 s 0.445–0.545 s

With #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.


QA Notes

Build a package twice; the second build is up to date. Point --with-haddock at a script that prints a version, then edit cabal.project; the next build is still up to date. Change the version the script prints and edit cabal.project again; the next build reconfigures. Changing only the version leaves the build up to date, at the base too, because nothing monitors the tool. ConfiguredProgramCache covers this.

@PaleRoses
PaleRoses force-pushed the program-cache-fingerprints branch from 0fdb3c2 to eb9d0af Compare November 4, 2026 05:35
@PaleRoses
PaleRoses marked this pull request as ready for review November 4, 2026 07:38

@ulysses4ever ulysses4ever left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/config key changes when PATH does, which PathRecomp tests. Nothing reads it, and the key is compared with == (normaliseConfiguredPackage only touches elabProgramArgs), so a hash of the Binary encoding notices the same changes. It is computed once, in the where of elaborateInstallPlan.

  • The complete records are needed. Hashing programDbSignature compilerProgDb instead makes PathRecomp fail, and clearing every programVersion makes ConfiguredProgramCache fail; 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, PathRecomp and T12463.

  • On the #12463 repro (40 public sublibraries, 16 flags; GHC 9.10.3 on Linux, in a nix shell whose PATH has 43 entries), a no-op cabal build all, five runs each:

    improved-plan cache/config (42 files) no-op
    base 0687f8d2f 32.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 PATH has to stay in the key: #2015 added the field so that a PATH change reconfigures, and programDbSignature drops PATH (it keeps the versions, so "keeping PATH and 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.project changes 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).

@PaleRoses

Copy link
Copy Markdown
Contributor Author

Thanks for checking all of that.

I applied your comment on the test in 26cfc11. The description now says why PATH stays in the key, and the QA notes say that the version change only reconfigures together with a cabal.project edit.

Squash sounds right to me.

@mergify mergify Bot added the 1️⃣ more approval needed Set by Mergify: has one of the two required approvals label Nov 10, 2026
@PaleRoses PaleRoses mentioned this pull request Nov 11, 2026
5 of 6 tasks
@mergify mergify Bot removed the 1️⃣ more approval needed Set by Mergify: has one of the two required approvals label Nov 14, 2026
@zlonast zlonast added the squash+merge me Tell Mergify Bot to squash-merge label Nov 14, 2026
@mergify mergify Bot added ready and waiting Mergify is waiting out the cooldown period merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days queued labels Nov 14, 2026
@mergify

mergify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · Build statically linked using alpine fails with this pull request

32 min in the queue, 21 min of it CI.

So far

The failure is in this pull request. It failed tested alone on top of master.

Reason

The merge conditions cannot be satisfied due to failing checks

  • Validate post job

Failing checks:

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, comment @mergifyio queue to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = Validate post job
    • check-skipped = Validate post job
    • check-success = Validate post job
  • any of · required by GitHub branch protection:
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
    • check-success = Bootstrap post job
10 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of · required by GitHub branch protection:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of · required by GitHub branch protection:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of · required by GitHub branch protection:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of · required by GitHub branch protection:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of · required by GitHub branch protection:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of · required by GitHub branch protection:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of · required by GitHub branch protection:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot mentioned this pull request Nov 17, 2026
40 of 92 tasks
@mergify mergify Bot added dequeued and removed queued labels Nov 17, 2026
PaleRoses and others added 6 commits November 17, 2026 12:56
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>
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>
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>
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>
@PaleRoses
PaleRoses force-pushed the program-cache-fingerprints branch from 39ccf3f to d7fc6bb Compare November 17, 2026 21:02
@mergify mergify Bot removed the dequeued label Nov 17, 2026
haskell#12464 imported Data.Binary qualified as Binary in ProjectPlanning.
Distribution.Compat.Binary re-exports Data.Binary, so importing both
under the same alias leaves one of them redundant, which -Werror rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PaleRoses
PaleRoses force-pushed the program-cache-fingerprints branch from d7fc6bb to 4d1b802 Compare November 17, 2026 22:37
@mergify mergify Bot added the queued label Nov 18, 2026
@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as ec570be at 00:38 UTC

10 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 18 Nov, 00:28 · rule squash-merge · triggered by rule Put pull requests in the squash+merge queue
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 00:38 · ec570be · squash
12 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of · required by GitHub branch protection:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of · required by GitHub branch protection:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of · required by GitHub branch protection:
    • check-success = Validate post job
    • check-neutral = Validate post job
    • check-skipped = Validate post job
  • any of · required by GitHub branch protection:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of · required by GitHub branch protection:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of · required by GitHub branch protection:
    • check-success = Bootstrap post job
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
  • any of · required by GitHub branch protection:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of · required by GitHub branch protection:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of · required by GitHub branch protection:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot merged commit ec570be into haskell:master Nov 18, 2026
60 checks passed
@mergify mergify Bot removed the queued label Nov 18, 2026
fendor pushed a commit to fendor/cabal that referenced this pull request Nov 19, 2026
* Fingerprint configured programs in elaborated components

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.

* Record the PR and issue numbers in the changelog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Narrow the configured-program test to what PathRecomp does not cover

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>

* Say what the program fingerprint is for

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>

* Say that nothing monitors the tool in the configured-program test

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>

* Do not describe the program records in the fingerprint's haddock

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>

* Use the Data.Binary import master already has

haskell#12464 imported Data.Binary qualified as Binary in ProjectPlanning.
Distribution.Compat.Binary re-exports Data.Binary, so importing both
under the same alias leaves one of them redundant, which -Werror rejects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-assisted merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days ready and waiting Mergify is waiting out the cooldown period squash+merge me Tell Mergify Bot to squash-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants