Repository navigation
feat(melange): add cmj artifact pform - #187
Open
anmonteiro wants to merge 388 commits into
Open
anmonteiro wants to merge 388 commits into
anmonteiro wants to merge 388 commits into
Conversation
anmonteiro
force-pushed
the
anmonteiro/melange-cmj-pform
branch
from
September 6, 2026 05:02
7a3a6a6 to
54cd0aa
Compare
anmonteiro
marked this pull request as ready for review
September 6, 2026 05:02
This was referenced Sep 6, 2026
anmonteiro
force-pushed
the
anmonteiro/fix-melange-artifact-pforms
branch
from
September 8, 2026 22:21
c23925a to
e63bc15
Compare
anmonteiro
added a commit
to ocaml/dune
that referenced
this pull request
Sep 8, 2026
Resolve cmi, cmt, and cmti against the OCaml module set first, falling back to Melange when the module is not selected for OCaml. Fixes the regressions in #16337 and #16338. CMJ support is split into anmonteiro#187; documentation remains in anmonteiro#186. --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro
force-pushed
the
anmonteiro/melange-cmj-pform
branch
from
September 18, 2026 06:54
54cd0aa to
07635fc
Compare
anmonteiro
changed the base branch from
anmonteiro/fix-melange-artifact-pforms
to
main
September 18, 2026 06:54
…6981) Strengthen the existing sandbox regression by requesting the same generated input concurrently through relative and absolute paths. Both spellings must return identical contents across copy, hardlink, and symlink sandboxes. This is a test-only change and passes without the unmerged absolute-path implementation changes. Signed-off-by: Rudi Grinberg <[email protected]>
…#16979) Cover generated absolute reads without forced sandboxing and compare generated and external inputs with an external build directory, reached either directly or through a symlink. Changing the generated input verifies that the symlinked case rebuilds rather than merely reuses cached output. Record the current bug where an external absolute input becomes unavailable through the build-directory symlink, despite working through its physical path. This PR contains tests only and does not depend on the unmerged path-handling fix. Signed-off-by: Rudi Grinberg <[email protected]>
Extract and expand the temporary-directory environment coverage from ocaml#16930 into a test-only prerequisite. Record the runtime value in both regular actions and `(cram ...)` actions for the default, an `env`-stanza override, and an action-level `setenv` override. The probe reads `TMPDIR` on Unix and `TEMP` on Windows; generated paths are normalized without rewriting the explicit override markers. Current `main` replaces both kinds of override with Dune's managed directory in both contexts. The test records that behavior and checks that a second unchanged build reuses regular and Cram results. Signed-off-by: Rudi Grinberg <[email protected]>
…l#16980) Register Melange's `@all` dependencies once per nonempty compilation context. 019ffd87-afd6-7983-99f9-1a7139620b20 Signed-off-by: Antonio Nuno Monteiro <[email protected]>
…ocaml#16937) Demonstrate that private wrapper aliases compile without sandboxing but fail in a fresh copy sandbox because the private CMI is unavailable. Found while checking the Melange counterparts of ocaml#16629. 01a12d8e-c091-7010-b0cd-3fdc40400e80 --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Track private CMIs as compilation dependencies so wrapper aliases work in sandboxes and private interface changes rebuild consumers. Uses the regression test from ocaml#16937. Fixes ocaml#16071. 01a12d8e-c091-7010-b0cd-3fdc40400e80 Signed-off-by: Antonio Nuno Monteiro <[email protected]>
…aml#16931) Demonstrate that public aliases of private Melange modules fail to compile, including in a fresh copy sandbox. Related to ocaml#16629. 01a12d8e-c091-7010-b0cd-3fdc40400e80 --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
…ocaml#16932) Demonstrate missing private CMIs through hidden transitive Melange dependencies, while checking that direct dependency names remain hidden. Related to ocaml#16629. 01a12d8e-c091-7010-b0cd-3fdc40400e80 --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Demonstrate the difference between OCaml and Melange when resolving a private module through its generated wrapper alias. Related to ocaml#16629. 01a12d8e-c091-7010-b0cd-3fdc40400e80 --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
…caml#16934) Demonstrate that aliases into installed private libraries work in OCaml but fail in Melange, while direct private references remain unavailable. Related to ocaml#16629. 01a12d8e-c091-7010-b0cd-3fdc40400e80 --------- Signed-off-by: Antonio Nuno Monteiro <[email protected]>
The updated buildDunePackage declares out, dev, man, and doc outputs. Our custom cross installer only installs bin/dune.exe and skips fixup, so Nix rejects the otherwise successful build for missing outputs. Declare only out for this binary-only derivation. Signed-off-by: Ali Caglayan <[email protected]>
Co-authored-by: Shon <[email protected]> Signed-off-by: mefyl <[email protected]>
Signed-off-by: mefyl <[email protected]>
Co-authored-by: Shon <[email protected]> Signed-off-by: mefyl <[email protected]>
The updated buildDunePackage declares out, dev, man, and doc outputs. Our custom cross installer only installs bin/dune.exe and skips fixup, so Nix rejects the otherwise successful build for missing outputs. Declare only out for this binary-only derivation. cc @anmonteiro this seems to have broken in the recent flake update.
## Description Enrich `Memo` API to split the installation of an error handler and the run/collection of errors, so that running multiple goals in parallel can still share an error handler and eventually deduplicate them between goals. ## Related Issue and Motivation Fixes ocaml#15609. The root cause is pretty clear: we split the run of goals for several good reasons, but in the process we lost deduplication of errors between goals. I tried several approaches to make the diff as minimal as possible; the most obvious & sensible one to me was to accumulate the errors in the handler itself. The whole point of it is to centralize the errors of every sub-computation, so deduplicating there seemed like a no brainer, but it ended up being a headache: * It changes what version of the exception are reported. I think the current implementation is timing dependent too, so maybe we can just accept it. A proper fix would be to not use a set of exceptions at all levels, but a map that deduplicates but still keeps a deterministic version of the stack. This would however mean comparing stacks whenever errors arise, so maybe too impactful performance-wise. * It reports more error: in the current version, some errors are passed to the handler but are absent in the final report. AFAICT it's already a bug, since an early report will happen for an error that actually disappears at the end, but relying on the handler for the final reports makes it worse since the extra error is now also part of the final report. <details> <summary>Scenario to trigger a phantom error in the error handler that is absent from the final report</summary> ``` - Run 1: A depends on B. B returns 0 and A returns 1, no errors. - B is invalidated. Both functions have internal state, so on the next computation A no longer needs B, while B now depends on A. - Run 2, building A: a. Memo tries to restore A from the cache. To do that, it first checks A's recorded dependency, B. B is out of date, so Memo recomputes it. b. B's new computation calls A, which is still being restored. That's a cycle, and B fails with Cycle_error. c. Because of the failure, B's error goes through report_and_collect_errors in compute, so the handler receives it. d. Since its dependency changed, A is recomputed. It doesn't call B anymore and returns Ok 0. ``` </details> I don't mind digging into this approach, which I think is fundamentally better, but it's going to take some decision making and some adjacent bug fixing. This fix is a bit more grunty, but it does the deed in a reasonable, if not elegant way, I think. ## Checklist - [x] Tests added, if applicable. - [x] [Change log entry added](../CONTRIBUTING.md#updating-the-changelog) for any user-facing changes. - [x] Documentation added for any user-facing changes.
Signed-off-by: Ali Caglayan <[email protected]>
Avoid forcing context-wide install rules when loading dependency-scoped package and binary layouts by moving their views from `_build/install/<context>` to `_build/_private/<context>`. Ordinary installation staging, layout keys, host selection, dependency tracking, and normal ancestor checks remain unchanged.
Move the OxCaml compiler and opam-repository pins into shared JSON data so Nix shells and CI can consume the same configuration. Keep the existing pins and release-tag consistency check, and expose separate release/latest compiler selections. Split out of ocaml#16969.
Signed-off-by: Ali Caglayan <[email protected]>
Use different contents for foo.txt in the main source and extra_sources. With a build action, check that the installed result contains the extra_sources version while the workspace file and prepared source file retain their original contents. Keep the existing no-action case: it leaves the workspace file unchanged but replaces the prepared source file with the extra_sources version. Signed-off-by: Ali Caglayan <[email protected]>
…aml#17146) Use `path_with_stats` for both synchronous and background digesting instead of repeating its setup in the async wrapper. The background scheduling decision is unchanged. Signed-off-by: Rudi Grinberg <[email protected]>
The bootstrap GC cram test symlinks the OCaml toplevel into its temporary tools directory. A toplevel built with `--with-relative-libdir` looks for the standard library relative to that path and fails with `Unbound module Stdlib` before the GC checks run, as seen in [the OCaml 5.5 CI job for ocaml#17149](https://github.com/ocaml/dune/actions/runs/44978457065/job/137075755744?pr=17149). Forward every tool call to the installed executable and only record GC settings for the compiler tools under test. The existing GC assertions are unchanged. Signed-off-by: Rudi Grinberg <[email protected]>
…aml#17155) Construct the default execution parameters as a record instead of forwarding every field through a private constructor with one caller. All defaults stay the same. Signed-off-by: Rudi Grinberg <[email protected]>
Build the method-name payload in one place for both RPC lookup failures. An invalid method and a method with no common version still report distinct errors. Signed-off-by: Rudi Grinberg <[email protected]>
Reuse the read-only pipe setup in the trace writer tests for write, flush, close, and descriptor cleanup failures. The assertions and expected errors are unchanged. Signed-off-by: Rudi Grinberg <[email protected]>
Share the context argument and lookup between the directory and module toplevel commands. Both commands keep the same context selection behavior. Signed-off-by: Rudi Grinberg <[email protected]>
Use the same single-file RPC build helper for `dune exec` and developer tools. Both callers encode the target and handle the build result the same way, with no change to when they use the running server. Signed-off-by: Rudi Grinberg <[email protected]>
…caml#17154) Use one path-aware environment merge for named and unnamed included dependencies. Keep the existing merge order in both cases. Signed-off-by: Rudi Grinberg <[email protected]>
Reuse the backslash write for named, template, and decimal escapes in the configurator’s standalone quoted-string encoder. The encoded output stays the same. Signed-off-by: Rudi Grinberg <[email protected]>
Use the same state monad for virtual-library substitution and re-export traversal. Each traversal still maintains its own accumulated libraries and visited set. Signed-off-by: Rudi Grinberg <[email protected]>
Declare the common action extension fields once and use that signature for the extension functor. The full action specification still adds the dynamic flag. Signed-off-by: Rudi Grinberg <[email protected]>
…cks (ocaml#17163) The project can lock a compiler whose `compiler-support` dependency exists only as a project pin. Relocking OCaml-LSP finds the pinned compiler but fails to resolve that dependency. Refs ocaml#16292.
Signed-off-by: Ali Caglayan <[email protected]>
…ools (ocaml#17173) Merlin and OCaml-LSP share a compiler target with each other, but not with the project. Check the rule dependencies as well as the build counts, and distinguish the helper shared by both tools from a package used only by the project. Refs ocaml#16292.
…verlay (ocaml#17169) Install a package with an extra source that shadows a file from its source tree, then remove the extra source and rebuild. Compare the installed file with a fresh build so the test catches stale contents without relying on the layout of the prepared source directory. Refs ocaml#16292.
…7168) Have mock Merlin record a marker from the compiler during installation. Changing only the project’s locked compiler recipe, without bumping its version, distinguishes using the project compiler from re-solving for the same version. With no explicit OCaml dependency, mock Merlin currently reports `no-compiler` both times. Refs ocaml#16292.
Use record updates when converting V1 diagnostics, replacing only the message and related diagnostics. The remaining fields and wire encoding are unchanged. Signed-off-by: Rudi Grinberg <[email protected]>
Use the same state transition to resume the pool runner after submitting a task or closing the pool. The existing checks for a closed pool stay in place. Signed-off-by: Rudi Grinberg <[email protected]>
When Homebrew adds a pkg-config search path, configurator passes an explicit `PKG_CONFIG_PATH` binding to `Unix.create_process_env`. That replaces the inherited environment and drops settings such as `PKG_CONFIG_LIBDIR` and `PKG_CONFIG_SYSROOT_DIR`, causing a package that depends on those settings to be reported as missing. Merge the explicit bindings with the inherited environment, with explicit bindings taking precedence. The macOS regression uses controlled `brew` and `pkg-config` executables to cover inherited variables, existing search-path precedence, and packages without a Homebrew directory. Related to ocaml#10805. The original vcpkg setup in that issue has not been reproduced. Validation performed against main at `5a68b1910384be91a56b8f99046b00db6b87b8ab`. - `./dune.exe build --cache=disabled @check @fmt` passed on macOS. - `./dune.exe runtest --cache=disabled otherlibs/configurator/test/blackbox-tests` passed on macOS. The saved before-fix regression reports `package missing`. - `./dune.exe build --cache=disabled @check @fmt @runtest` was run on Linux arm64 with OCaml 5.5.2 in the repository's pinned Nix development shell. The final fresh run failed in `pkg/opam-package-with-build-env.t` and `pkg/pkg-extract-fail.t` with `Lock directory is not active for context "default"`. Earlier runs hit the same error in other package-lock cases. A separate clean upstream checkout reproduced the same error in `pkg/pin-stanza/opam-template.t`. No expectations were changed or promoted. - The macOS full suite hit an `fsevents_tests.ml` expectation failure also reproduced on clean upstream. AI assistance was used to prepare and validate this change. --------- Signed-off-by: Aikhan Jumashukurov <[email protected]> Signed-off-by: Rudi Grinberg <[email protected]> Co-authored-by: Aikhan Jumashukurov <[email protected]> Co-authored-by: Rudi Grinberg <[email protected]>
Share the deferred state write and event stamp between job starts and stops, while keeping their distinct validity checks and error messages. Signed-off-by: Rudi Grinberg <[email protected]>
Extend `pkg/source-empty-dir.t` with the lockfile-adjacent `.files` overlay case. Keep regular files as controls and correct the introduction to reflect that empty directories are currently omitted. This records the existing input-staging limitation; it does not change staging behavior. Signed-off-by: Rudi Grinberg <[email protected]>
…aml#17175) Add cram reproductions for five directory-target bugs: ambiguous directory-dependency digests, missing empty subdirectories on workspace-local cache hits, recursive globs skipping generated descendants, an internal error when globbing through a regular file, and promotion flattening directories when using `(into ...)`. The tests document current behavior so each fix can update its own expectation independently. This PR does not change production code. Signed-off-by: Rudi Grinberg <[email protected]>
Defer JS/Wasm module action graph construction until the target is requested, avoiding unused graph allocation in native and bytecode-only builds. 019ffd87-afd6-7983-99f9-1a7139620b20 Signed-off-by: Antonio Nuno Monteiro <[email protected]>
This is constantly red and making it difficult to see the CI. I am disabling the action in this specific case. Signed-off-by: Ali Caglayan <[email protected]>
This is constantly red and making it difficult to see the CI. I am disabling the action in this specific case.
anmonteiro
force-pushed
the
anmonteiro/melange-cmj-pform
branch
from
November 22, 2026 19:31
befad26 to
8b73e23
Compare
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
anmonteiro
force-pushed
the
anmonteiro/melange-cmj-pform
branch
from
November 22, 2026 19:31
8b73e23 to
73b7cc1
Compare
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.
Add %{cmj:...} using Melange.Cm_kind.t for module artifacts. Follows ocaml#16339; documentation remains in #186.