refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653
Open
andreabedini wants to merge 2 commits intohaskell:masterfrom
Open
refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653andreabedini wants to merge 2 commits intohaskell:masterfrom
andreabedini wants to merge 2 commits intohaskell:masterfrom
Conversation
ffaf1
approved these changes
Mar 24, 2026
Collaborator
ffaf1
left a comment
There was a problem hiding this comment.
Thanks!
(CI failure is of course due to some golden tests missing new HasCallStack bits.)
geekosaur
approved these changes
Mar 24, 2026
355c348 to
bcfa0f5
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves call-stack propagation for Cabal/Cabal-install by adding HasCallStack constraints to key error/reporting functions and (for dieProgress) emitting the pretty-printed call stack in error output.
Changes:
- Add
HasCallStacktodieProgressand appendprettyCallStack callStackto the rendered error message. - Add
HasCallStackconstraints to several project planning/rebuild entrypoints incabal-install. - Update multiple cabal-testsuite golden outputs to include the new CallStack lines.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Cabal/src/Distribution/Utils/LogProgress.hs | Adds HasCallStack to dieProgress and prints a call stack in errors. |
| cabal-testsuite/PackageTests/ReexportedModules/setup-fail-other.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/ReexportedModules/setup-fail-missing.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/ReexportedModules/setup-fail-ambiguous.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/BuildDeps/DepCycle/setup.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/T8582/setup.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/T4447/setup.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal-fail.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/Fail3/setup.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/Fail2/setup.out | Updates expected output to include CallStack details. |
| cabal-testsuite/PackageTests/Backpack/Fail1/setup.out | Updates expected output to include CallStack details. |
| cabal-install/src/Distribution/Client/ProjectPlanning.hs | Adds HasCallStack to several exported planning/rebuild functions. |
Comments suppressed due to low confidence (1)
cabal-install/src/Distribution/Client/ProjectPlanning.hs:361
- These functions are exported from
Distribution.Client.ProjectPlanning, so addingHasCallStackchanges their public types. While direct calls usually remain source-compatible, downstream users who pass these functions as values (e.g. store them in records, use them as callbacks, or partially apply them) may now need extraHasCallStackconstraints and can get type errors. If this module is considered part of the supported library API, consider whether this should be paired with a changelog note / major bump, or whether the call-stack propagation can be limited to internal (non-exposed) entrypoints.
rebuildProjectConfig
:: HasCallStack
=> Verbosity
-> HttpTransport
-> DistDirLayout
-> ProjectConfig
-> IO
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cabal-testsuite/PackageTests/ReexportedModules/setup-fail-other.out
Outdated
Show resolved
Hide resolved
bcfa0f5 to
6c91b9c
Compare
Add a `HasCallStack` constraint to `dieProgress` and include the pretty-printed call stack in the error output, making it easier to locate the source of solver errors.
6c91b9c to
dbe0770
Compare
Add `HasCallStack` constraints to `rebuildProjectConfig`, `rebuildInstallPlan`, `phaseElaboratePlan`, `elaborateInstallPlan`, and `elaboratedInstallPlan` in `ProjectPlanning`, so that errors propagated through these functions carry actionable call-stack information.
dbe0770 to
c501d41
Compare
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.
Two related improvements to call-stack propagation:
HasCallStackconstraint todieProgressand include thepretty-printed call stack in the error output (
Cabal)HasCallStackconstraints torebuildProjectConfig,rebuildInstallPlan,phaseElaboratePlan,elaborateInstallPlan, andelaboratedInstallPlaninProjectPlanning(cabal-install)