Semantic Diff

#9000 Bump the magic numbers at release time instead of in pull requests

4 commits

f26ccd087d992d718a17898d0d393d27905bebe5..pr-9000

1c5a168a9 · Christoph Knittel + Claude · Oct 23, 2026, 15:51 UTC

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
Before
After
A.cmiA.cmiis not a compiled interface for this version of OCaml.It seems to be for an older version of OCaml.is not a compiled interface for this version of ReScript.It seems to be for an older version of ReScript.

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.
36bdb7be8 · Christoph Knittel + Claude · Oct 23, 2026, 16:11 UTC

Type the helpers of the cmi_magic_number build test

yarn typecheck rejected their implicitly typed parameters.

857f88e62 · Christoph Knittel + Claude · Oct 23, 2026, 16:19 UTC

Compare the magic numbers with the highest release below the version

Codex review: git describe took the nearest tag, so a maintenance branch merged into master made its newer tag of an older line, with other magic numbers, the previous release, and no number was bumped.

090f71153 · Christoph Knittel + Claude · Oct 23, 2026, 16:24 UTC

Install dependencies in the changelog workflow

Codex review: the changelog scripts now import semver, which a clean checkout lacks.