Skip to content

Commit 9d0dbcf

Browse files
jappeace-slothclaude
andcommitted
Add Backpack Fail5 test: reproduce opaque "broken package" error
Add a test case (Backpack/Fail5) that reproduces the real-world scenario from prrrrrrrrr where an indefinite Backpack library installed separately (e.g. via nix callCabal2nix) causes an opaque "broken package" error when a consumer tries to configure. The test installs an indefinite framework package (with App signature and a framework-utils sub-library) and a separate app-impl package, then tries to configure a consumer that depends on both. The linker correctly resolves App=app-impl:App, but the instantiated variant framework+<hash> was never built, triggering: "broken due to missing package framework-0.1.0.0+95RTb42ZWxa9J13cUStM0q" The error shows only an opaque hash — no hint about which signature instantiation is missing or how to fix it. The test documents this deficiency with assertOutputDoesNotContain, to be flipped when the error message is improved. Prompt: Implement the plan to reproduce prrrrrrrrr's Backpack "broken package" error in cabal test suite Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 48d01f8 commit 9d0dbcf

11 files changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
cabal-version: 3.0
2+
name: Fail5
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
library framework-utils
7+
exposed-modules: Utils
8+
hs-source-dirs: repo/framework-0.1.0.0/src-utils
9+
build-depends: base
10+
default-language: Haskell2010
11+
visibility: public
12+
13+
library framework
14+
signatures: App
15+
exposed-modules: Framework
16+
hs-source-dirs: repo/framework-0.1.0.0/src repo/framework-0.1.0.0/src-sig
17+
build-depends: base, Fail5:framework-utils
18+
default-language: Haskell2010
19+
visibility: public
20+
21+
library app-impl
22+
exposed-modules: App
23+
hs-source-dirs: repo/app-impl-0.1.0.0
24+
build-depends: base
25+
default-language: Haskell2010
26+
visibility: public
27+
28+
executable consumer
29+
main-is: Main.hs
30+
build-depends: base, Fail5:framework, Fail5:framework-utils, Fail5:app-impl
31+
hs-source-dirs: repo/consumer-0.1.0.0
32+
default-language: Haskell2010
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module App where
2+
appMessage :: String
3+
appMessage = "Hello from app-impl"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cabal-version: 3.0
2+
name: app-impl
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
library
7+
exposed-modules: App
8+
build-depends: base
9+
default-language: Haskell2010
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Framework (greet)
2+
import Utils (utilHelper)
3+
main :: IO ()
4+
main = putStrLn greet >> putStrLn (utilHelper "direct")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cabal-version: 3.0
2+
name: consumer
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
executable consumer
7+
main-is: Main.hs
8+
build-depends: base, framework, framework:framework-utils, app-impl
9+
default-language: Haskell2010
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cabal-version: 3.0
2+
name: framework
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
library framework-utils
7+
exposed-modules: Utils
8+
hs-source-dirs: src-utils
9+
build-depends: base
10+
default-language: Haskell2010
11+
visibility: public
12+
13+
library
14+
signatures: App
15+
exposed-modules: Framework
16+
hs-source-dirs: src src-sig
17+
build-depends: base, framework:framework-utils
18+
default-language: Haskell2010
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
signature App where
2+
appMessage :: String
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Utils where
2+
utilHelper :: String -> String
3+
utilHelper msg = "Framework: " ++ msg
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Framework where
2+
import App (appMessage)
3+
import Utils (utilHelper)
4+
greet :: String
5+
greet = utilHelper appMessage

cabal-testsuite/PackageTests/Backpack/Fail5/setup-external-fail.out

Whitespace-only changes.

0 commit comments

Comments
 (0)