Repository navigation
test: dune must not internal-error on invalid -open argument - #14403
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a blackbox regression test around the per-module inter-library dependency work, documenting that Dune must not raise an internal error when future rule-generation code inspects an invalid -open argument. It fits into the per-module-lib-deps test suite as a forward-looking guard for changes like #14116 that may start reading -open flags while computing module references.
Changes:
- Add a new cram test for a library stanza that passes an invalid OCaml module name to
-open. - Build the minimal project with
dune build @checkto exercise rule generation in the per-module-lib-deps path. - Assert that the output does not contain
Internal error, preserving the current non-crashing behavior.
robinbb
force-pushed
the
robinbb-invalid-open-flag-guard
branch
from
May 3, 2026 02:50
ac0275d to
90ec2dc
Compare
robinbb
force-pushed
the
robinbb-invalid-open-flag-guard
branch
from
May 3, 2026 03:03
90ec2dc to
b70bb6e
Compare
robinbb
force-pushed
the
robinbb-invalid-open-flag-guard
branch
from
May 3, 2026 03:31
b70bb6e to
db767fc
Compare
robinbb
marked this pull request as ready for review
May 3, 2026 03:36
Adds [test-cases/per-module-lib-deps/open-flag-non-uppercase-name.t]: when [(flags ... -open <name>)] receives a syntactically invalid OCaml module name (e.g. starting with a digit), dune must not raise an internal error during rule generation. The compiler is the authority on whether a given [-open] argument is acceptable; dune should not pre-empt that decision. Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
force-pushed
the
robinbb-invalid-open-flag-guard
branch
from
May 6, 2026 01:43
db767fc to
8cc8241
Compare
Sudha247
approved these changes
May 6, 2026
Sudha247
left a comment
Member
There was a problem hiding this comment.
LGTM, and makes sense to have this futuristic guard.
I was wondering if the case of the -open flag working as expected is already covered, and that seems to be done in auto-wrapped-child-reexport.t.
This was referenced May 6, 2026
robinbb
added a commit
that referenced
this pull request
May 11, 2026
…4440) ## Summary Adds `test/blackbox-tests/test-cases/per-module-lib-deps/ppx-runtime-libraries.t`, a forward-looking guard that asserts a consumer using `(preprocess (pps bar))` — where `bar` declares `(ppx_runtime_libraries baz)` — has a compile-rule dep that covers every cmi in `baz`'s objdir. A glob over `baz/.baz.objs/byte/*.cmi` is the natural shape and what this test pins. The runtime libraries' modules are referenced by ppx-rewritten output, so ocamldep on the consumer's source cannot reason about which of them are referenced — the next ppx invocation may use any module of `baz`. Without a recorded dep that covers all of `baz`'s cmis, a change to any cmi in `baz` would not invalidate the consumer's `.cmi` rule and an incremental rebuild could silently use a stale artefact. Same shape as #14400, #14403, and #14439 — small standalone tests landed ahead of larger work that would touch the same code paths. Spun out of #14116 so its chain doesn't carry the test. Reported by @rgrinberg via @art-w in #14116 (comment). --------- Signed-off-by: Robin Bate Boerop <[email protected]>
robinbb
added a commit
that referenced
this pull request
May 12, 2026
## Summary Adds `test/blackbox-tests/test-cases/per-module-lib-deps/root-module-tight-deps.t`, a forward-looking guard that asserts a library declaring `(root_module ...)` alongside `(libraries ...)` builds correctly when its modules reference the dep library through the Root alias. Root modules carry no ocamldep dep-rule: the kind matches `Root | Alias _` in `Dep_rules.read_transitive_deps_of_module` and `read_immediate_deps_of`, both of which short-circuit to empty deps, avoiding the cycle that would otherwise arise from a Root that references itself transitively. Any future change to inter-library dep handling that misses this short-circuit would regress this scenario. Same shape as #14400 (cross-lib pre-pp guard) and #14403 (invalid `-open` guard) — small standalone tests landed ahead of larger work that would touch the same code paths. Spun out of #14116 so #14116's chain doesn't carry the test. --------- 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
test/blackbox-tests/test-cases/per-module-lib-deps/open-flag-invalid-identifier.t, asserting that when a stanza's(flags ... -open <name>)receives a syntactically invalid OCaml identifier (e.g. starting with a digit, like1bad), dune does not abort with an internal error, does not pre-empt the compiler with its own "invalid module name" diagnostic, and does not silently drop the-openargument. Instead, the build fails with an OCaml compiler error whoseFile "command line argument: ..."preamble is unmistakably the compiler's CLI-parser diagnostic format. The test pins this exact output.Today on
main, no in-dune code path parses-openargument names throughModule_name.of_string, so the test passes trivially. The guard is forward-looking: it pins the invariant for any future code (notably the per-module dependency filter in #14116) that reads-openargument names while computing rule-time module references.Test plan
dune runtest test/blackbox-tests/test-cases/per-module-lib-deps/open-flag-invalid-identifier.tpasses on this branch.