Skip to content

Refuse to migrate files that changed since their last build - #8916

Merged
cknitt merged 1 commit into
masterfrom
migrate-stale-cmt
Oct 21, 2026
Merged

cknitt merged 1 commit into
masterfrom
migrate-stale-cmt

Conversation

@cknitt

@cknitt cknitt commented Oct 19, 2026

Copy link
Copy Markdown
Member

rescript-tools migrate applies the deprecation locations stored in the file's .cmt/.cmti. Running it again before rebuilding used those stale locations on already migrated code, which produced dict<dict<dict>> from dict<dict<string>>.
The tool now compares the source digest recorded in the build artifact with the file on disk and refuses stale files with an error asking to rebuild (migrate-all counts them as failed).

Fixes #8242.

New test: tests/tools_tests/test.sh edits a .res and a .resi after the build and checks that migrate fails with the out-of-date error.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo

@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.14%. Comparing base (d19633d) to head (a795397).

Files with missing lines Patch % Lines
tools/src/migrate.ml 83.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8916   +/-   ##
=======================================
  Coverage   81.13%   81.14%           
=======================================
  Files         456      456           
  Lines       63754    63760    +6     
=======================================
+ Hits        51728    51738   +10     
+ Misses      12026    12022    -4     
Files with missing lines Coverage Δ
tools/src/migrate.ml 81.58% <83.33%> (+1.32%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8916

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8916

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8916

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8916

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8916

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8916

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8916

commit: a795397

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T06:56:09.549416Z a795397 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 35b1f78576

ℹ️ 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:
    `rescript-tools migrate` takes the locations of deprecated uses from the
    file's .cmt/.cmti. When the source changed after that build, for example
    because the file was already migrated and the project was not rebuilt,
    the locations point at the wrong code: migrating twice turned
    `dict<dict<string>>` into `dict<dict<dict>>` (#8242).

The tool now compares the source digest recorded in the build artifact with
the file on disk before migrating, and fails when they differ; `migrate-all`
counts such files as failed.

Diagnostic added (stale build artifacts):
After (diagnostic):
    error: failed to run migration for /path/to/File.res because build
    artifacts are out of date. rebuild the project and run the migration again

Review: Does this affect files without migrations? The check runs before the
AST comparison, so an unchanged file with a stale build also fails instead
of reporting "File did not need migration".

Fixes: #8242
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo
Signed-off-by: Christoph Knittel <[email protected]>
@cknitt
cknitt force-pushed the migrate-stale-cmt branch from 35b1f78 to a795397 Compare October 21, 2026 06:41
@github-actions

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review October 21, 2026 06:41
@cknitt
cknitt requested a review from cristianoc October 21, 2026 06:41
@cknitt

cknitt commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: a79539761d

ℹ️ 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".

@cknitt
cknitt merged commit 38ba55a into master Oct 21, 2026
28 checks passed
@cknitt
cknitt deleted the migrate-stale-cmt branch October 21, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migration on dict cause invalid code

2 participants