Skip to content

test: observational baseline for an unreferenced transitive library dep - #14332

Merged
robinbb merged 2 commits into
ocaml:mainfrom
robinbb:robinbb-test-transitive-unreferenced-lib
Apr 28, 2026
Merged

robinbb merged 2 commits into
ocaml:mainfrom
robinbb:robinbb-test-transitive-unreferenced-lib

Conversation

@robinbb

@robinbb robinbb commented Apr 25, 2026 •

Copy link
Copy Markdown
Collaborator

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 of X. A consumer that depends only on the intermediate still rebuilds whenever any of X'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 Main after editing one of dep_lib's modules, asserting the current count of 2.

Why add this now

  • Baseline anchor. The corner is mechanically simple but not currently covered by a dedicated test. Promoting it to a smaller count is the natural success criterion for a future precision improvement.
  • Sets up follow-on work in feat: per-module inter-library dependency filtering (#4572) #14116. The per-module filter introduced there narrows globs to specific cmi deps when it can prove the consumer references particular entry modules; it does not yet drop a transitively-reached library entirely when nothing of it is referenced. With the BFS in that PR, the negative evidence is available; using it is the next step. This baseline makes that improvement land as a one-line test promotion.

Reproducer originally from @nojb:
#14116 (comment)

Test plan

  • dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/transitive-unreferenced-lib.t passes on main.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + jq to record the current rebuild-rule count for Main after modifying libA’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
robinbb marked this pull request as ready for review April 25, 2026 17:51
@robinbb robinbb self-assigned this Apr 25, 2026
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
robinbb force-pushed the robinbb-test-transitive-unreferenced-lib branch from 2f27016 to d34408b Compare April 27, 2026 15:41
@Alizter

Alizter commented Apr 27, 2026 •

Copy link
Copy Markdown
Collaborator

For completeness you can do dune build @unused-lib to check that it genuinely is unused.

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
robinbb force-pushed the robinbb-test-transitive-unreferenced-lib branch from d34408b to ff17e32 Compare April 28, 2026 14:53
@robinbb

robinbb commented Apr 28, 2026

Copy link
Copy Markdown
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?

@robinbb
robinbb requested a review from Alizter April 28, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown

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 1 comment.

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]>

Copilot AI left a comment

Copy link
Copy Markdown

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 2 comments.

@robinbb
robinbb merged commit 3d3544b into ocaml:main Apr 28, 2026
33 checks passed
@robinbb
robinbb deleted the robinbb-test-transitive-unreferenced-lib branch April 28, 2026 22:13
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]>
@Alizter Alizter added this to the 3.24.0 milestone Jul 8, 2026
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.

3 participants