Help needed to debug dune fmt behavior in CI

This is already driving me crazy! In my local environment I have the same version of dune (3.13.1), untracked files include only .vscode/ folder and some local .sh script. OCaml 4.14.1 in my local opam switch. Same version of ocamlformat (it’s version is in config file, so if it runs with different version - it will error out). I do exactly the same command opam exec -- dune build --verbose @fmt as CI is doing and see wildly different behavior. In CI it did not produce any output at all, while in my environment dune fmt was chaging a lot of source files and dune files. I tried messing up some .ml files and dune files and commit them to CI - now the pipeline fails, dune tries to format OCaml sources back, but completely ignores messed up dune files. I’m completely lost on the root cause for this. Sounds like different configuration is getting used for ocamlformat in CI then locally somehow. And why dune ignores dune files for formatting - no idea at all. Dune lang is set to 2.0, according to documentation this already includes formatting of OCaml sources and dune sources out of the box. I’ve tried to specify this behavior explicitly with (formatting (enabled_for ocaml dune)) - changed nothing.

This is the CI run in question: Check source code formatting in CI · mransan/ocaml-protoc@ac03314 · GitHub

Your PR touches a dune-project file, which is not formatted by dune. (enabled_for dune) or the default behaviour of formatting dune files do not apply to dune-project files. See dune-project not formatted with @fmt · Issue #3223 · ocaml/dune · GitHub

Very confusing… Anyways, Simon has introduced necessary changes into master branch while I was preempted with another stuff, and now it just works for me as well. Pulled master branch right into the same opam swich which was acting upon me and now dune fmt is not doing anything. Maybe I was adding this somehow wrong in the CI so that it didn’t show me any changes. Simon’s commit seems to have the diff that my local environment was also applying with dune fmt.