Skip to content

feat(pkg): ignore opam upper bounds on dune#14638

Draft
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-oswxvoqxxqyv
Draft

feat(pkg): ignore opam upper bounds on dune#14638
Alizter wants to merge 1 commit into
ocaml:mainfrom
Alizter:push-oswxvoqxxqyv

Conversation

@Alizter
Copy link
Copy Markdown
Collaborator

@Alizter Alizter commented May 21, 2026

Opam packages occasionally declare upper bounds on dune, e.g.

    depends: [ "dune" {>= "3.0" & < "3.17"} ]

Dune's backward-compatibility guarantee makes these bounds grow stale quickly, but until now they would cause a hard solver failure whenever the running dune didn't fit.

In many cases, asking the (archive) repository maintainers to lift these boudns is impractical because they have been added from an opam point of view.

There isn't anything meaningful we can do with an upper bound of dune. Relaxing this restriction adds flexibility to the kinds of packages that dune pkg is interoperable with.

We therefore strip upper bounds ([<], [<=]) on the dune atom from depends formulas before they reach the solver. Lower bounds, equality, inequality, and filter sub-atoms are preserved. The lower bound is still a meaningful "minimum dune required" signal, that would otherwise be an error much later in the build.

Two tests for this restriction have been accordingly updated:

Opam packages occasionally declare upper bounds on dune, e.g.

```
    depends: [ "dune" {>= "3.0" & < "3.17"} ]
```

Dune's backward-compatibility guarantee makes these bounds grow stale
quickly, but until now they would cause a hard solver failure whenever
the running dune didn't fit.

In many cases, asking the (archive) repository maintainers to lift these
boudns is impractical because they have been added from an opam point of
view.

There isn't anything meaningful we can do with an upper bound of dune.
Relaxing this restriction adds flexibility to the kinds of packages that
dune pkg is interoperable with.

We therefore strip upper bounds ([<], [<=]) on the dune atom from
depends formulas before they reach the solver. Lower bounds, equality,
inequality, and filter sub-atoms are preserved. The lower bound is still
a meaningful "minimum dune required" signal, that would otherwise be an
error much later in the build.

Two tests for this restriction have been accordingly updated:

- `test/blackbox-tests/test-cases/pkg/implicit-dune-constraint.t`
- `test/blackbox-tests/test-cases/pkg/unsatisfied-version-constraint-on-dune.t`

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter Alizter marked this pull request as draft May 21, 2026 18:01
@Alizter
Copy link
Copy Markdown
Collaborator Author

Alizter commented May 21, 2026

I'll let this sit as draft for a bit so the consequences of this change can marinate in my brain.

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.

dune should ignore upper bounds on dune

1 participant