Skip to content

ocamlformat: Add constraints on Dune 3.22#29568

Merged
mseri merged 3 commits intoocaml:masterfrom
Julow:ocamlformat-constraints-dune322
Mar 25, 2026
Merged

ocamlformat: Add constraints on Dune 3.22#29568
mseri merged 3 commits intoocaml:masterfrom
Julow:ocamlformat-constraints-dune322

Conversation

@Julow
Copy link
Copy Markdown
Contributor

@Julow Julow commented Mar 20, 2026

The behavior of the (diff) rules with non-existant files has changed in Dune 3.22, which break OCamlformat's testsuite.

I updated the constraints of all versions of ocamlformat-lib and ocamlformat.0.24.1. Earlier versions of ocamlformat has a upper bound on Dune and later versions depend on ocamlformat-lib.

The behavior of the (diff) rules with non-existant files has changed in
Dune 3.22, which break OCamlformat's testsuite.
@Julow
Copy link
Copy Markdown
Contributor Author

Julow commented Mar 20, 2026

Related change in Dune: ocaml/dune#13696

"cmdliner" {>= "1.1.0" & < "2.0"}
"base" {>= "v0.12.0"}
"dune" {>= "2.8"}
"dune" {>= "2.8" & (>= "2.8" | < "3.22" & with-test)}
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.

This does not work, in the right statement, left is true, so it remains true when not < 3.22

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.

I think the following should work

Suggested change
"dune" {>= "2.8" & (>= "2.8" | < "3.22" & with-test)}
"dune" {>= "2.8"}
"dune" {< "3.22" & with-test}

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.

Thanks!
I got this with the following in Dune:

  (dune
   (or
    (>= 2.8)
    (and
     (< 3.22)
     :with-test)))

Is it wrong too ?

Copy link
Copy Markdown
Member

@mseri mseri Mar 23, 2026

Choose a reason for hiding this comment

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

I think you need to add

  (dune
    (and
     (< 3.22)
     :with-test))

In any case, adding dune constraints to the dune file is brittle in my experience. Since dune always adds itself with the appropriate lower bound and since it does not reduce the constraints properly, if often ends up being messy (or wrong like in this case). The only way I can think of right now is be to use a template file.

Otherwise we can add a comment (say in the opam file with a template) to fix it manually on release.

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.

Thanks for your help :) I've lifted the constraints in the dev version so next release won't have the same issue.

@mseri
Copy link
Copy Markdown
Member

mseri commented Mar 23, 2026

In the meantime I suggest we merge this

@Julow
Copy link
Copy Markdown
Contributor Author

Julow commented Mar 23, 2026

@mseri
Copy link
Copy Markdown
Member

mseri commented Mar 23, 2026

It installs ocamlformat-lib without the "with-test" flag, so it picks up dune 3.22, then it re-installs ocamlformat with "with-test" and it seems that at this point it kind of ignores that conflict, but then the call to build dune build -p ocamlformat -j 71 @install @runtest runs all tests and make it fail.

@Julow
Copy link
Copy Markdown
Contributor Author

Julow commented Mar 24, 2026

I propagated the change to ocamlformat, let's see!

@Julow
Copy link
Copy Markdown
Contributor Author

Julow commented Mar 25, 2026

The issue in the testsuite is gone but there are new errors that I don't understand.

@mseri
Copy link
Copy Markdown
Member

mseri commented Mar 25, 2026

The remaining failures do not depend on this. Thanks!

@mseri mseri merged commit 3f91b1a into ocaml:master Mar 25, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants