Repository navigation
test: observational baseline for an unreferenced transitive library dep - #14332
Merged
robinbb merged 2 commits intoApr 28, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an observational blackbox cram test that captures current over-invalidation behavior when an intermediate library declares a transitive dependency it never references, and verifies that touching an unreferenced module in the transitive library still causes the consumer executable module to rebuild.
Changes:
- Introduces a new cram test case for the “transitive but unreferenced library” corner.
- Uses
dune trace+jqto record the current rebuild-rule count forMainafter modifyinglibA’s unused module.
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 25, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
marked this pull request as ready for review
April 25, 2026 17:51
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 25, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 26, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 27, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
force-pushed
the
robinbb-test-transitive-unreferenced-lib
branch
from
April 27, 2026 15:41
2f27016 to
d34408b
Compare
Collaborator
|
For completeness you can do |
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 <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 27, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
An intermediate library [libB] declares [(libraries libA)] but its own source does not reference any module of [libA]. The consumer [main] uses [libB] and so transitively gains [libA] in its compilation context. Today's compile rules carry a glob over every transitively-reached library's public-cmi directory, so editing any of [libA]'s modules re-invalidates [main]. The test records the current rebuild count. Adds a baseline that future per-module dependency tracking work (ocaml#4572) can promote to a smaller number when the over-invalidation is fixed. Reproducer originally from @nojb: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
force-pushed
the
robinbb-test-transitive-unreferenced-lib
branch
from
April 28, 2026 14:53
d34408b to
ff17e32
Compare
Collaborator
Author
|
@Alizter I have added the test that you implicitly suggested with your comment. Very helpful. Does this mean that you can be the reviewer for this PR? |
Alizter
approved these changes
Apr 28, 2026
Per Copilot review on ocaml#14332: [intermediate_lib] and the [main] executable were single-module stanzas. Dune's [dep_rules.ml] short-circuits ocamldep for single-module stanzas, so the test was exercising the cctx-wide glob fallback rather than isolating the per-module dependency filtering being baselined. A future change that flips the short-circuit (e.g. adding [not has_library_deps]) would change this test's count for an unrelated reason — the same conflation that ocaml#14310 had to undo retroactively. Add an unused [intermediate_dummy] module to [intermediate_lib] and an unused [main_dummy] module to the [main] executable so ocamldep runs unconditionally for both stanzas. Tighten the trace-probe regex to [dune__exe__Main\\.] so it only matches Main targets, not the new [Main_dummy]. Switch from a [length]-based count to the idiomatic [targetsMatchingFilter] JSON dump used elsewhere in this directory; the recorded targets are now the explicit [.cmi/.cmti] and [.cmo/.cmt] target_files lists for the two ocamlc invocations on Main. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
Apr 29, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 1, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 1, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 1, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 1, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 2, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 2, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Also promotes [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332) to assert zero rebuilds of [main] when an unreferenced library's module changes. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 3, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 4, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 6, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 7, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 8, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
to robinbb/dune
that referenced
this pull request
May 9, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from ocaml#14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: ocaml#14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 9, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 10, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 10, 2026
When the cross-library walk finishes with no entry of a library in the consumer's reference closure, and that library is tight-eligible (local, unwrapped, every entry has a known [Module.t]), the walk has full visibility and the negative result is positive evidence that the consumer does not reach the library. Drop the library from the consumer's compile-rule deps instead of falling back to a glob over its objdir. The link rule still pulls the library in through [requires_link], so executables and libraries that need its compiled artefacts at link time are unaffected. The dropped deps are purely about compile-time invalidation: a change in the library's modules no longer re-invalidates a consumer that does not actually reference any of them through any chain visible to the walk (intra-lib transitive closure, transparent module aliases, [-open]'d modules, or [-opaque]-aware impl-side propagation). Wrapped local libraries, externals, and virtual-impls still fall back to a glob: the walk does not have full visibility into them. Promotes the upstream observational baselines whose rebuild assertions are tightened by this commit (other affected baselines were already promoted in the preceding [.ml]-side skip commit, since their final state held there): - [transitive-unreferenced-lib.t] (the @nojb reproducer imported from #14332): asserts zero rebuilds of [main] when an unreferenced library's module changes. - [implicit-transitive-deps-false.t]: rewritten so the test scenario exercises the [-H]-glob path that this fix tightens. Under [(implicit_transitive_deps false)] with [Disabled_with_hidden_includes] mode, the consumer's compile rule globbed over a hidden-only library's objdir as part of the cctx-wide [-H] glob; the per-module filter now observes that no entry name reaches the consumer's reference closure and drops the lib from the compile-rule deps entirely, so [main] is no longer rebuilt. Closes the residual reported here: #14116 (comment) Signed-off-by: Robin Bate Boerop <[email protected]>
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 a corner that today over-invalidates: an intermediate library declares
(libraries X)but its own source does not reference any module ofX. A consumer that depends only on the intermediate still rebuilds whenever any ofX's modules change, because every consumer module carries a glob over every transitively-reached library's public-cmi directory.The test is observational. It records the rebuild-target count for
Mainafter editing one ofdep_lib's modules, asserting the current count of2.Why add this now
Reproducer originally from @nojb:
#14116 (comment)
Test plan
dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/transitive-unreferenced-lib.tpasses onmain.