Skip to content

fix(pkg): isolate source overlays in package builds - #17219

Merged
Alizter merged 1 commit into
ocaml:mainfrom
Alizter:pkg-isolate-source-overlays
Nov 24, 2026
Merged

Alizter merged 1 commit into
ocaml:mainfrom
Alizter:pkg-isolate-source-overlays

Conversation

@Alizter

@Alizter Alizter commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Package build rules without any build or install instrutions may still
use .files or extra_sources and these may mutate the sources. Therefore
we should always be sandboxing these particular rules.

Without sandboxing we may mutate _build in an untracked way and cause
consumers of source/ to miss invalidation. The current pkg digests mask
this rebuild by creating a new rule. In #16292 we remove the pkg digests
which exposed this particular bug.

The bug can be observed directly on main in the cram test, but basically
has no ill-effect at the moment.

Reproduced in #17213. Related to #16292.

@Alizter Alizter added package management Dune's package management — `(pkg)` stanza, lockdirs, `dune pkg` commands sandboxing Related to dune's sandboxing of build actions no changelog labels Nov 24, 2026
@Alizter
Alizter marked this pull request as ready for review November 24, 2026 12:44
Package build rules without any build or install instrutions may still
use .files or extra_sources and these may mutate the sources. Therefore
we should always be sandboxing these particular rules.

Without sandboxing we may mutate _build in an untracked way and cause
consumers of source/ to miss invalidation. The current pkg digests mask
this rebuild by creating a new rule. In ocaml#16292 we remove the pkg digests
which exposed this particular bug.

The bug can be observed directly on main in the cram test, but basically
has no ill-effect at the moment.

Signed-off-by: Ali Caglayan <[email protected]>
@Alizter
Alizter force-pushed the pkg-isolate-source-overlays branch from 20ccf72 to f34382b Compare November 24, 2026 13:14
@Alizter
Alizter merged commit e189291 into ocaml:main Nov 24, 2026
35 of 36 checks passed
@Alizter
Alizter deleted the pkg-isolate-source-overlays branch November 24, 2026 13:31
Alizter added a commit that referenced this pull request Nov 24, 2026
Key package targets by owner and name instead of lock digest. Remove
`dune pkg print-digest`. Dev tools no longer share compiler or helper
targets
([`dev-tool-merlin-stale-compiler.t`](https://github.com/ocaml/dune/pull/16292/files#diff-3bced8e7c75548e5c7813d167832fca98394cd6756b40327ea1157bf12ba8088)).

No longer triggers a package rebuild:
- Editing the macOS recipe or adding Windows to the lock while building
on Linux
([`package-platform-rebuild.t`](https://github.com/ocaml/dune/pull/16292/files#diff-f74a927967af9a8a4830c34ae5888247144254f82c124ecbb1c19110c0e19de8)).
- Switching to an equivalent non-portable lock or writing `(depends)`
instead of omitting it
([`package-platform-rebuild.t`](https://github.com/ocaml/dune/pull/16292/files#diff-f74a927967af9a8a4830c34ae5888247144254f82c124ecbb1c19110c0e19de8)).
- Changing only `(avoid)` or a `depexts` hint
([`package-build-metadata.t`](https://github.com/ocaml/dune/pull/16292/files#diff-8fd74690f9797c0b1433efe61be270ddc61e6760647f85f564f1ceba2aa98dcc)).

The source-overlay regression was fixed on `main` in #17219.

Known regressions:
- Change a transitive export from `FOO=bar` to `FOO=baz`: incremental
installs `bar/1.2.3`; fresh installs `baz/1.2.3`
([`exported-env.t`](https://github.com/ocaml/dune/pull/16292/files#diff-c7c70fe8b69ea61216920e8b569a9389e6f59c809dec1001acbb27604d3073c5)).
- Reorder two providers of `foo`: incremental keeps the old provider;
fresh picks the other
([`installed-binary.t`](https://github.com/ocaml/dune/pull/16292/files#diff-930a79378895a539df0daa9cf288207bb9997ca5329eb14dec767561898b52e3)).

Part of #8652.
@Alizter Alizter added this to the 3.26.0 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog package management Dune's package management — `(pkg)` stanza, lockdirs, `dune pkg` commands sandboxing Related to dune's sandboxing of build actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant