documentation: True runs Haddock for inferred multi-repl targets

Aperta Adatta ai principianti
#12,242 5 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@jadhavgaurav ci sta già lavorando.

Dal 5/10/2026.

  • #12409 di @jadhavgaurav — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
haskell

Direzione di ricerca

Inizia da add_repl_target e confronta la sua elaborazione con setRootTargets, che gestisce già i target REPL espliciti. Riproduci il malfunzionamento abilitando documentation: True in cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.project ed eseguendo il test multi-repl esistente oppure cabal repl --enable-multi-repl pkg-c pkg-a. Il lavoro è completato quando il pkg-b inferito viene caricato senza eseguire Haddock e il test di regressione passa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

attention: pr-welcome cabal-install: cmd/repl type: bug

Describe the bug

When documentation: True is enabled, cabal repl --enable-multi-repl can run Haddock for a component that was added to the multi-repl session by dependency-closure calculation. That component is configured as BuildInplaceOnly InMemory, so one of its promised in-memory dependencies is not present in the installed package index used by Haddock. Haddock then fails with Cabal-4569.

This is similar to #10166, which was closed by #10248. That pull request fixed the package version passed through --promised-dependency. The reproduction below still fails with the fix from #10248 present, including on the current master, because the inferred multi-repl target retains elabBuildHaddocks = True.

haddock-internal is not required to reproduce the problem.

To reproduce

Starting from Cabal master at a21f3544700afb25529db8b825ad25a05e7a145c, add documentation: True to the existing multi-repl closure test project:

diff --git a/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.project
@@
 packages: pkg-a/*.cabal
 packages: pkg-b/*.cabal
 packages: pkg-c/*.cabal
+documentation: True

Then run the existing test, or run the equivalent multi-repl command against pkg-a and pkg-c:

cabal repl --enable-multi-repl pkg-c pkg-a

pkg-b is added to the session to satisfy the multi-repl closure property. The command then attempts to build its documentation and fails:

Running Haddock on library for pkg-b-0...
Error: [Cabal-4569]
internal error when calculating transitive package dependencies.
Debug info: []

As a control, the same multi-repl command succeeds when documentation is disabled.

Expected behavior

Every component configured as BuildInplaceOnly InMemory for a multi-repl session should have elabBuildHaddocks = False. The command should load pkg-a, inferred pkg-b, and pkg-c into GHCi without running Haddock for any of those interactive components.

The explicit REPL-target path already clears elabBuildHaddocks in setRootTargets. The dependency-closure path in add_repl_target sets elabReplTarget and elabBuildStyle, but does not clear elabBuildHaddocks.

A one-field change fixes the reproduction:

{ elabReplTarget = maybeToList (ComponentTarget <$> elabComponentName ecp <*> pure WholeComponent)
, elabBuildHaddocks = False
, elabBuildStyle = BuildInplaceOnly InMemory
}

I also tested a regression change that enables documentation: True in PackageTests/MultiRepl/EnabledClosure and asserts that Haddock is not run for inferred pkg-b. The test fails with Cabal-4569 before the one-field change and passes after it.

Why this matters for HLS

Haskell Language Server uses Cabal multi-repl when the editor enables both whole-project checking and multiple-component session loading. A project that wants all three of the following currently cannot use them together when its component graph triggers the closure path:

documentation: True
haskell.checkProject: true
haskell.sessionLoading: multipleComponents

Disabling documentation avoids the Cabal failure but also prevents the normal project build from generating Haddock documentation.

System information

  • macOS 26.6.1 on Apple Silicon
  • GHC 9.12.2
  • Reproduced with cabal-install 3.16.1.0 and Cabal 3.16.1.0
  • Reproduced with Cabal and cabal-install 3.19.0.0 development versions from master at a21f3544700afb25529db8b825ad25a05e7a145c
Lingua principale
Haskell
Stelle
1.8k
Fork
763
Merge medio
5g 16h
PR unite (30g)
29

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/cabal

Tutte le issue di haskell/cabal

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.