Repository navigation
Bump the magic numbers at release time instead of in pull requests - #9000
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9000 +/- ##
==========================================
+ Coverage 81.27% 81.29% +0.01%
==========================================
Files 456 456
Lines 63834 63836 +2
==========================================
+ Hits 51882 51893 +11
+ Misses 11952 11943 -9
🚀 New features to boost your workflow:
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93dae5cdae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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).
Diagnostic modified (.cmi from an earlier compiler):
Before (diagnostic):
A.cmi
is not a compiled interface for this version of OCaml.
It seems to be for an older version of OCaml.
After (diagnostic):
A.cmi
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.
Review: 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.
Breaking: Tools that check for Caml1999I/Caml1999T magic numbers have to look for ResCmi/ResCmt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFCgV9acRwi6ohFaj9atR8
Signed-off-by: Christoph Knittel <ck@cca.io>
yarn typecheck rejected their implicitly typed parameters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QFCgV9acRwi6ohFaj9atR8 Signed-off-by: Christoph Knittel <ck@cca.io>
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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QFCgV9acRwi6ohFaj9atR8 Signed-off-by: Christoph Knittel <ck@cca.io>
93dae5c to
857f88e
Compare
|
@codex review |
Semantic Diff4 commits · 090f711 · Oct 23, 2026, 16:25 UTC · Full page Bump the magic numbers at release time instead of in pull requests1c5a168 · Christoph Knittel + Claude · Oct 23, 2026, 15:51 UTC
Diagnostic modified (.cmi from an earlier compiler)
A.cmi
-is 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
Type the helpers of the cmi_magic_number build test36bdb7b · Christoph Knittel + Claude · Oct 23, 2026, 16:11 UTC yarn typecheck rejected their implicitly typed parameters. Compare the magic numbers with the highest release below the version857f88e · Christoph Knittel + Claude · Oct 23, 2026, 16:19 UTC 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. ✨ Install dependencies in the changelog workflow090f711 · Christoph Knittel + Claude · Oct 23, 2026, 16:24 UTC · new Codex review: the changelog scripts now import semver, which a clean checkout lacks. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 857f88e62a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review: the changelog scripts now import semver, which a clean checkout lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QFCgV9acRwi6ohFaj9atR8 Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9000 |
Closes #8947.
Pull requests no longer bump the
.cmi,.cmtand.astmagic numbers incompiler/ext/config.ml, so parallel PRs stop conflicting on them.yarn changelog:releasebumps each counter whencompiler/ml,compiler/extorcompiler/flow_parserchanged since the previous release tag (git describe, excluding the tag of the version being released). These are themllibrary and the libraries it depends on, so they cover every serialized type and the types they reference. A counter that already differs from the tag is left alone, so running the release step again for the same version doesn't bump twice. The bump runs after all validation and before anything is written.changelog:releaselabel that bumps a counter. Switching to another prefix is allowed..cmi/.cmtmove fromCaml1999I040/Caml1999T048toResCmi040/ResCmt048. OCaml's numbers count up toward the same values (OCaml 5.5 writesCaml1999I037), so OCaml tools would eventually accept our files. Both numbers stay the same length, since.cmtreading compares one header with both..cmiwith aCaml1999I…header is reported as built by an older version. The message now says ReScript instead of OCaml.CONTRIBUTING.md,changes/README.mdandcompiler/AGENTS.mdnow describe the new process.There is one deliberate difference from the issue text: all four numbers use the same source directories. A per-format file list (e.g.
parsetree.mlonly) would miss dependencies such asExternal_ffi_typesandString_literal. Bumping too often is harmless.For the first release after this PR, the dry run against
v13.0.0-alpha.6bumps nothing: the new prefixes and the.astbumps made since that tag already make every number differ from it.Existing open PRs that bump a number will conflict with this one once more. After rebasing, they should drop the bump, or the new check fails.
New tests
scripts/magicNumbers.test.js: counter increments, bump rules (already-bumped numbers, previous release with other prefixes or withoutconfig.ml), and a temporary git repo with release tags covering unrelated changes, uncommitted changes, reruns once the version's tag exists, and the next release. Also the PR guard.scripts/changelog.test.js:run("release")writes the bumpedconfig.ml.tests/build_tests/cmi_magic_number: new.cmifiles start withResCmi…. Legacy, older, newer and unrelated headers each get the right error.🤖 Generated with Claude Code
https://claude.ai/code/session_01QFCgV9acRwi6ohFaj9atR8