Skip to content

refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653

Open
andreabedini wants to merge 2 commits intohaskell:masterfrom
andreabedini:refactor/has-callstack
Open

refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653
andreabedini wants to merge 2 commits intohaskell:masterfrom
andreabedini:refactor/has-callstack

Conversation

@andreabedini
Copy link
Copy Markdown
Collaborator

Two related improvements to call-stack propagation:

  • Add a HasCallStack constraint to dieProgress and include the
    pretty-printed call stack in the error output (Cabal)
  • Add HasCallStack constraints to rebuildProjectConfig,
    rebuildInstallPlan, phaseElaboratePlan, elaborateInstallPlan, and
    elaboratedInstallPlan in ProjectPlanning (cabal-install)

Copy link
Copy Markdown
Collaborator

@ffaf1 ffaf1 left a comment

Choose a reason for hiding this comment

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

Thanks!

(CI failure is of course due to some golden tests missing new HasCallStack bits.)

Copilot AI review requested due to automatic review settings April 2, 2026 05:49
@andreabedini andreabedini force-pushed the refactor/has-callstack branch from 355c348 to bcfa0f5 Compare April 2, 2026 05:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 HasCallStack to dieProgress and append prettyCallStack callStack to the rendered error message.
  • Add HasCallStack constraints to several project planning/rebuild entrypoints in cabal-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 adding HasCallStack changes 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 extra HasCallStack constraints 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.

@andreabedini andreabedini force-pushed the refactor/has-callstack branch from bcfa0f5 to 6c91b9c Compare April 7, 2026 05:10
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.
@andreabedini andreabedini force-pushed the refactor/has-callstack branch from 6c91b9c to dbe0770 Compare April 7, 2026 05:12
Add `HasCallStack` constraints to `rebuildProjectConfig`, `rebuildInstallPlan`,
`phaseElaboratePlan`, `elaborateInstallPlan`, and `elaboratedInstallPlan` in
`ProjectPlanning`, so that errors propagated through these functions carry
actionable call-stack information.
@andreabedini andreabedini force-pushed the refactor/has-callstack branch from dbe0770 to c501d41 Compare April 7, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants