test: regression guard for cross-lib reads of single-module leaf libs#14389
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox regression test to guard against a failure mode in per-module inter-library dependency tracking when a dependency library is a single-module “leaf” that doesn’t produce ocamldep .d output.
Changes:
- Add a new cram test case that builds a multi-module consumer library depending on a single-module unwrapped leaf library.
- Document (in-test) the expected shape and the specific “No rule found” regression this is meant to prevent.
4906d19 to
8d54e20
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox cram test that guards against a specific regression in inter-library dependency tracking: consumers of a single-module “leaf” library (which doesn’t produce ocamldep .d files due to Dune’s single-module fast path) must still build successfully.
Changes:
- Add a new per-module-lib-deps test case that builds a multi-module consumer library depending on a single-module leaf library.
- Document within the test why the leaf shape is sensitive to cross-library ocamldep-walking implementations.
8d54e20 to
f99e835
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox regression test case to ensure a multi-module consumer can build against a single-module “leaf” library where Dune’s singleton-module fast path produces no ocamldep .d artifacts—guarding against future inter-library dep tracking changes that might incorrectly require those .d files.
Changes:
- Add
no-ocamldep-leaf-lib.tblackbox test constructing a single-module leaf lib and a multi-module consumer that references it. - Assert
dune build @checksucceeds for that shape to catch “No rule found” regressions tied to missing.drules.
7fec8a0 to
657ca03
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox cram test case to guard against regressions where inter-library dependency tracking attempts to read ocamldep .d artifacts for a single-module “leaf” library stanza (where Dune may skip ocamldep and therefore not produce .d rules), ensuring a multi-module consumer can still build successfully.
Changes:
- Add a new observational baseline cram test for a multi-module consumer depending on a single-module, dependency-free leaf library.
- Exercise both
.mland.mlipresence in the leaf library to cover impl/intf-side dependency-walk behavior. - Assert successful build via
dune build @checkfor this project shape.
Leonidas-from-XIV
left a comment
There was a problem hiding this comment.
Looks good however I am a bit wary of writing so much about the internal workings of Dune in the description of the test. In case that changes for whatever reason whoever changes it must be aware of this test and change the text to reflect the implementation details or will forget in which case this test will contain misleading information that doesn't match the implementation.
Adds [test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t]. Documents that a multi-module consumer of a single-module leaf library builds without error today. Companion to the other observational baselines under [test-cases/per-module-lib-deps/]: each pins a structural shape that an inter-library filter must respect. Signed-off-by: Robin Bate Boerop <me@robinbb.com>
657ca03 to
1ed3ac9
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new blackbox regression test case to guard against a specific per-module inter-library dependency tracking pitfall: consumers must not require ocamldep-generated .d files from single-module “leaf” libraries where Dune intentionally skips ocamldep.
Changes:
- Add a new
per-module-lib-depscram test that builds a multi-module consumer library depending on an unwrapped, single-module leaf library. - Assert the build succeeds to prevent regressions where rule evaluation demands a nonexistent leaf
.dfile.
|
I have made the change that you implicitly suggest, @Leonidas-from-XIV . |
Summary
Adds
test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t, an observational baseline asserting that a multi-module consumer of a single-module leaf library builds without error.Why
The dep is a "leaf": one
.mlmodule, no library dependencies of its own. Single-module stanzas trigger a fast path in dune that skips ocamldep for the stanza, so no.drule is produced for the leaf's module. Any future inter-library dependency tracking that walks consumer ocamldep into dep libraries must recognise this shape and not demand a nonexistent.dfile — otherwise the consumer's compile fails with "No rule found" during rule evaluation.This pitfall surfaced during #14116 development. The test guards against the same shape of regression in any future inter-library dep-tracking change.
Test plan
maintoday:dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.tpasses.consumer/c.mlto reference an unbound module — the test diffs against the resulting compile error, confirming the assertion catches build failures.The shape pinned here (single-module unwrapped leaf consumed by a multi-module consumer with a real cross-library reference) is not exercised by any existing test on
main. Companion to the other observational baselines undertest-cases/per-module-lib-deps/(cross-lib-ppx.t,private-modules.t, etc.): each pins a structural shape that an inter-library filter must respect.Related: #14116