Skip to content

test: verify incremental builds with alias re-exported libraries (#4572)#14129

Merged
rgrinberg merged 1 commit intoocaml:mainfrom
robinbb:robinbb-issue-4572-alias-reexport
Apr 10, 2026
Merged

test: verify incremental builds with alias re-exported libraries (#4572)#14129
rgrinberg merged 1 commit intoocaml:mainfrom
robinbb:robinbb-issue-4572-alias-reexport

Conversation

@robinbb
Copy link
Copy Markdown
Contributor

@robinbb robinbb commented Apr 10, 2026

Summary

Add test verifying that when a library re-exports a dependency via a
module alias (module Impl = Impl), incremental builds correctly
recompile consumers when the re-exported library's .cmi changes.

  • Soft changes (implementation only, no .cmi change) can safely skip
    recompilation due to -opaque
  • Hard changes (.cmi modified) must trigger recompilation to avoid
    inconsistent interface assumptions
  • The bug only triggers with multi-module executables (single-module
    executables skip ocamldep)

Reproduction case from @art-w.

Ref: #4572

Test plan

  • Test passes on main (no filtering active, all deps present)

@robinbb robinbb force-pushed the robinbb-issue-4572-alias-reexport branch from 98c11e5 to b0bd29d Compare April 10, 2026 16:50
…ml#4572)

Add test verifying that when a library re-exports a dependency via a
module alias (module Impl = Impl), incremental builds correctly
recompile consumers when the re-exported library's .cmi changes.

Soft changes (implementation only, no .cmi change) can safely skip
recompilation due to -opaque. Hard changes (.cmi modified) must
trigger recompilation to avoid inconsistent interface assumptions.

Reproduction case from @art-w.

Signed-off-by: Robin Bate Boerop <me@robinbb.com>
Main is rebuilt (necessary — impl.cmi changed and main.ml uses
Impl through the Alias re-export):

$ dune trace cat | jq -s 'include "dune"; [.[] | targetsMatchingFilter(test("Main"))] | length | . > 0'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need the length and predicate here? Seeing the target would be enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alas, yes, as the length is actually different on different platforms (Mac vs. non-Mac), which caused what I had here originally (the unfiltered uncounted output) to fail CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

... because the output was different on different platforms, and even the filtered output was different (hence the non-zero count check instead of a firm count).

@robinbb
Copy link
Copy Markdown
Contributor Author

robinbb commented Apr 10, 2026

@rgrinberg Back to you. I can't give you what you want (per my comment). I wanted it, too. :-(

@rgrinberg rgrinberg merged commit 7cc00c1 into ocaml:main Apr 10, 2026
30 checks passed
@robinbb robinbb deleted the robinbb-issue-4572-alias-reexport branch April 10, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants