test: record consumer rebuild count when shadowed dep lib changes#14324
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox (cram) test case covering an OCaml module-name collision between two unwrapped libraries, ensuring the consumer still rebuilds when the shadowed library’s public interface changes—anchoring expectations for any future cross-library per-module dependency filtering work (issue #4572).
Changes:
- Introduce a new per-module-lib-deps cram test for library-vs-library module name shadowing via
-Ipath order. - Assert the consumer recompiles after a change to the losing library’s same-named module by inspecting
dune traceoutput withjq.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
210879f to
c8a0909
Compare
Adds a cram test for the corner where two unwrapped libraries export an entry module of the same name and a consumer depends on both. OCaml's [-I] path resolution picks the first library listed in [(libraries ...)]; the other lib's same-named module is shadowed. Editing the losing lib's module still triggers a rebuild of the consumer on current [main] — cross-library dep tracking is library-level, so the consumer depends on a glob over each lib's public cmi dir and any change invalidates. The test is observational. It anchors current behavior for this under-tested corner and documents the expectation for future per-module filtering work on issue ocaml#4572: without qualified-path analysis, the filter cannot disambiguate which lib's [Shared] the consumer resolves through and must conservatively track both. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
c8a0909 to
b0e81cc
Compare
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 27, 2026
Each of the dep PRs supplying a test in [per-module-lib-deps/] was renamed per Leonidas's review on ocaml#14309: generic [libA]/[modA1]-style names replaced by role-bearing names like [dep_lib]/[spurious_rebuild]. This commit applies the same renames to this PR's local copies of those tests so they stay convergent with the dep PRs' canonical versions. Touches: - single-module-unreferenced-lib.t (ocaml#14308) - sibling-unreferenced-lib.t (ocaml#14309) - unwrapped-tight-deps.t (ocaml#14310) - lib-vs-lib-name-collision.t (ocaml#14324) - opaque-mli-change.t, opaque-cmx-deps-local.t (ocaml#14331) - transitive-unreferenced-lib.t (ocaml#14332) - wrapped-reexport-via-open-flag.t (ocaml#14346) - auto-wrapped-child-reexport.t (ocaml#14347) Pure rename + path/dir adjustments. Count assertions preserved (this PR's promotions to the post-fix counts are unchanged). Test suite passes. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
Alizter
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a cram test for an under-tested corner: two unwrapped libraries export an entry module of the same name, and a consumer depends on both. OCaml's
-Ipath resolution picks the library listed first in(libraries ...); the other lib's same-named module is shadowed and unreachable from consumer code.The test is observational. It records the rebuild-target count for the consumer module after editing the losing (shadowed) lib's same-named module, asserting the count is positive. On current
main, cross-library dep tracking is library-level: the consumer depends on a glob over each declared library's public cmi dir, so any change to the losing lib's public cmis invalidates the consumer.Why add this now
Two reasons:
-Iorder) and has no existing test.ocamldep -modulesreports only the top-level reference, so the filter cannot know which lib'sSharedthe consumer resolves through. Any future filter must conservatively continue to track both. This test documents that expectation.The assertion is
> 0, so the test passes unchanged whether a future filter takes the library-level glob path or emits over-specified tight deps on both matching modules.Test plan
dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/lib-vs-lib-name-collision.tpasses.