refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653
refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653andreabedini wants to merge 2 commits into
Conversation
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.)
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.
dbe0770 to
c501d41
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.
c501d41 to
e569a04
Compare
|
Rebased on current master and resolved the merge conflict in Also added missing golden file updates for two tests that were not in the original PR but also exercise
|
Add `HasCallStack` constraints to `rebuildProjectConfig`, `rebuildInstallPlan`, `phaseElaboratePlan`, `elaborateInstallPlan`, and `elaboratedInstallPlan` in `ProjectPlanning`, so that errors propagated through these functions carry actionable call-stack information. fix: update missing golden files for Fail4 and Fail5
e569a04 to
2a3a0c7
Compare
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)