Bump the magic numbers at release time instead of in pull requests
Why
Every pull request that changed a serialized type bumped the .cmi, .cmt or .ast magic number, so parallel pull requests kept conflicting on the same lines of config.ml. yarn changelog:release now bumps each counter when compiler/ml, compiler/ext or compiler/flow_parser changed since the previous release tag, and the changelog check rejects pull requests that bump one. The .cmi and .cmt numbers switch to ResCmi/ResCmt prefixes: with OCaml's Caml1999 prefix, they run into the numbers of OCaml releases (OCaml 5.5 writes Caml1999I037), and OCaml tools would take our files for theirs (#8947).
modifiedDiagnostic .cmi from an earlier compiler
diagnostic
Review
- Why not derive the magic numbers from a digest of the types? Tools that read .cmi files need a stable number per release that only changes when the format may have changed; a digest changes on every release and has no order.
- What about two dev builds that share a counter? Both build systems clean a package when the bsc hash changes, so only mixing files from different builds by hand reads a mismatched layout.