Skip to content

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

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

refactor(Cabal, cabal-install): add HasCallStack to dieProgress and ProjectPlanning#11653
andreabedini wants to merge 2 commits into
haskell: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)

@ffaf1 ffaf1 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!

(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

Copilot AI left a comment

Copy link
Copy Markdown

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.

Comment thread Cabal/src/Distribution/Utils/LogProgress.hs
Comment thread Cabal/src/Distribution/Utils/LogProgress.hs Outdated
Comment thread cabal-testsuite/PackageTests/ReexportedModules/setup-fail-other.out Outdated
@andreabedini andreabedini force-pushed the refactor/has-callstack branch 3 times, most recently from dbe0770 to c501d41 Compare April 7, 2026 06:15
Comment thread cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
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 c501d41 to e569a04 Compare May 28, 2026 08:37
@andreabedini

Copy link
Copy Markdown
Collaborator Author

Rebased on current master and resolved the merge conflict in LogProgress.hs (upstream had refactored it to add WarnMsg/InfoMsg constructors; the conflict was just in the imports — combining upstream's hFlush/hPutStr additions with our GHC.Stack import).

Also added missing golden file updates for two tests that were not in the original PR but also exercise dieProgress:

  • Backpack/Fail4 (same LinkedComponent.hs call site as Fail3)
  • Backpack/Fail5 (new test added after the PR was branched, exercises the broken-packages error in Configure.hs)

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
@andreabedini andreabedini force-pushed the refactor/has-callstack branch from e569a04 to 2a3a0c7 Compare May 28, 2026 08:53
@andreabedini andreabedini added the merge me Tell Mergify Bot to merge label May 28, 2026
@mergify mergify Bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants