From 420fc53683bc0ffb5d4b7562a26cb586cda78627 Mon Sep 17 00:00:00 2001 From: Robin Bate Boerop Date: Thu, 23 Apr 2026 13:32:41 -0700 Subject: [PATCH 1/2] test: add regression guard for (wrapped (transition ...)) libraries Add a blackbox test that exercises a consumer of a library declared with (wrapped (transition "...")). Such libraries expose both wrapped (Base.Alpha) and bare-name (Alpha) entry modules, and form part of the per-module-lib-deps surface. The test asserts that a consumer using both access paths builds cleanly. It is a regression guard; no behavioural counts are asserted. Related: https://github.com/ocaml/dune/issues/4572 Signed-off-by: Robin Bate Boerop --- .../wrapped-with-transition.t | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t diff --git a/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t b/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t new file mode 100644 index 00000000000..b971e41f3c7 --- /dev/null +++ b/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t @@ -0,0 +1,57 @@ +Per-module tight deps and [(wrapped (transition ...))] libraries. + +A library declaring [(wrapped (transition ...))] exposes both wrapped +and bare-name entry modules for its public modules, so consumers can +refer to a module either as [Foo.Bar] or as [Bar]. Such libraries are +still wrapped ([Wrapped.to_bool] returns [true]), so per-module tight +deps do not apply: the bare-name compat shim reaches internal modules +whose cmis are not in the directly-named set. They must fall through +to the glob. + +Regression guard: verify that a consumer of such a library builds +correctly. + +See: https://github.com/ocaml/dune/issues/4572 + + $ cat > dune-project < (lang dune 3.22) + > EOF + +base is wrapped with a transition period, exposing both [Base.Alpha] +and bare [Alpha]: + + $ mkdir base + $ cat > base/dune < (library (name base) (wrapped (transition "transition description"))) + > EOF + $ cat > base/alpha.ml < let v = 1 + > EOF + $ cat > base/alpha.mli < val v : int + > EOF + $ cat > base/beta.ml < let v = 2 + > EOF + $ cat > base/beta.mli < val v : int + > EOF + +Consumer references the library via the wrapper. The transition +machinery emits deprecation alerts for the bare-name access, so we +silence them in the consumer flags and only exercise the wrapper +path here: + + $ mkdir consumer + $ cat > consumer/dune < (library + > (name consumer) + > (libraries base) + > (flags (:standard -alert -deprecated))) + > EOF + $ cat > consumer/c.ml < let via_wrapper = Base.Alpha.v + > let via_bare = Beta.v + > EOF + + $ dune build @check From 0bb4760ca4b56af073cc72cb9de4cba0728b5278 Mon Sep 17 00:00:00 2001 From: Robin Bate Boerop Date: Thu, 23 Apr 2026 13:48:22 -0700 Subject: [PATCH 2/2] test: clarify prose about wrapper vs bare-name access paths The test's consumer references `Base.Alpha.v` through the wrapper and `Beta.v` by bare name, but the surrounding prose claimed the transition exposes only `Alpha` and that the consumer "only exercises the wrapper path". Adjust the prose to reflect that the test intentionally exercises both access paths and silences deprecation alerts to do so. Signed-off-by: Robin Bate Boerop --- .../per-module-lib-deps/wrapped-with-transition.t | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t b/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t index b971e41f3c7..0ec98a8b5ef 100644 --- a/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t +++ b/test/blackbox-tests/test-cases/per-module-lib-deps/wrapped-with-transition.t @@ -17,8 +17,9 @@ See: https://github.com/ocaml/dune/issues/4572 > (lang dune 3.22) > EOF -base is wrapped with a transition period, exposing both [Base.Alpha] -and bare [Alpha]: +base is wrapped with a transition period: consumers can reach each +public module either through the wrapper (e.g. [Base.Alpha]) or by +its bare name (e.g. [Beta]): $ mkdir base $ cat > base/dune < val v : int > EOF -Consumer references the library via the wrapper. The transition +Consumer intentionally exercises both access paths. The transition machinery emits deprecation alerts for the bare-name access, so we -silence them in the consumer flags and only exercise the wrapper -path here: +silence them in the consumer flags while testing both the wrapper +path and the bare-name compat shim here: $ mkdir consumer $ cat > consumer/dune <