Skip to content

test: regression guard for (root_module ...) + (libraries ...)#14439

Draft
robinbb wants to merge 1 commit intoocaml:mainfrom
robinbb:robinbb-test-root-module-tight-deps
Draft

test: regression guard for (root_module ...) + (libraries ...)#14439
robinbb wants to merge 1 commit intoocaml:mainfrom
robinbb:robinbb-test-root-module-tight-deps

Conversation

@robinbb
Copy link
Copy Markdown
Collaborator

@robinbb robinbb commented May 6, 2026

Summary

Adds test/blackbox-tests/test-cases/per-module-lib-deps/root-module-tight-deps.t, a forward-looking guard that asserts a library declaring (root_module ...) alongside (libraries ...) builds correctly when its modules reference the dep library through the Root alias.

Root modules carry their own dep-rule shape: dune synthesises the .d file for the Root module (no .all-deps, to avoid the cycle that would arise from a Root that references itself transitively). Any future change to inter-library dep handling that misses the synthesised-.d path would regress this scenario. On current main the build path uses a broad-glob over the dep library's objdir, so the test passes trivially today; the synthesised-.d path is still exercised by rule generation, and that is what the test pins.

Same shape as #14400 (cross-lib pre-pp guard) and #14403 (invalid -open guard) — small standalone tests landed ahead of larger work that would touch the same code paths. Spun out of #14116 so #14116's chain doesn't carry the test.

Test plan

  • dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/root-module-tight-deps.t passes on this branch.

@robinbb robinbb self-assigned this May 6, 2026
@robinbb robinbb requested a review from Copilot May 6, 2026 19:23
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

Adds a new blackbox regression test to guard Dune’s build correctness when a library uses (root_module ...) alongside (libraries ...), specifically when consumer modules reference a dependency through the synthesized Root alias (covering the synthesized-.d dependency-rule path for root modules).

Changes:

  • Add a new cram/blackbox test case root-module-tight-deps.t under per-module-lib-deps/ to assert the scenario builds successfully.

Adds [test-cases/per-module-lib-deps/root-module-tight-deps.t].
Asserts that a library declaring [(root_module ...)] alongside
[(libraries ...)] builds correctly when its modules reference the
dep library through the Root alias.

Root modules carry their own dep-rule shape: dune synthesises the
[.d] file for the Root module (no [.all-deps], to avoid the cycle
that would arise from a Root that references itself transitively).
Any future change to inter-library dep handling that misses the
synthesised-[.d] path would regress this scenario.

Forward-looking guard. The build path on current main uses a
broad-glob over the dep library's objdir, so the test passes
trivially today. The synthesised-[.d] path is still exercised by
rule generation, and that is what the test pins.

Signed-off-by: Robin Bate Boerop <me@robinbb.com>
@robinbb robinbb force-pushed the robinbb-test-root-module-tight-deps branch from b0d33fe to 960145f Compare May 6, 2026 21:53
@robinbb robinbb requested a review from Copilot May 6, 2026 21:53
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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.

2 participants