Semantic Diff

#8922 Leave files untouched when no migration applies

1 commit, rendered from its record.

Summary

RangeCommitsChangelogAreasJS output changesFormatsFailed checks
58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-89221๐Ÿ› Bug fixtoolstestsscripts0none0

Changelog draft

๐Ÿ› Bug fix
  • Make rescript-tools migrate leave files untouched when no migration applies instead of reformatting them.

58da277de4eeba0d27f17c8056fd4c192e7b7ad9..pr-8922

cf19fe6c7 ยท Christoph Knittel ยท Oct 19, 2026

Leave files untouched when no migration applies

๐Ÿ› Bug fixtoolstestsscripts

rescript-tools migrate and migrate-all reprinted every file whose printed form differed from the source, so files without any migration were reformatted and reported as migrated. A file is now reprinted only when the migration mapper changed its AST; otherwise it stays byte-identical, is reported as not needing migration, and --stdout prints the source as is.

Example ReScript

let   add = (a, b) =>   a + b
Before ReScript
let add = (a, b) => a + b
After ReScript
let   add = (a, b) =>   a + b
๐Ÿ› Bug fixMake rescript-tools migrate leave files untouched when no migration applies instead of reformatting them.

Review

No effect
Output: unchanged
Tests
other+ tests/tools_tests/src/migrate/NoMigration.res+ tests/tools_tests/src/migrate/NoMigration.resi+ tests/tools_tests/src/expected/NoMigration.res.expected+ tests/tools_tests/src/expected/NoMigration.resi.expected~ tests/tools_tests/test.sh (in-place migrate must keep the files unchanged)
10 files ยท +55 โˆ’10 ยท changelog 1 ยท scripts 2 ยท tests 5 ยท tools 2
Achanges/migrate-only-changed-files.fix.md+1โˆ’0
Mscripts/format.sh+1โˆ’1
Mscripts/format_check.sh+1โˆ’1
Atests/tools_tests/src/expected/NoMigration.res.expected+8โˆ’0
Atests/tools_tests/src/expected/NoMigration.resi.expected+6โˆ’0
Atests/tools_tests/src/migrate/NoMigration.res+7โˆ’0
Atests/tools_tests/src/migrate/NoMigration.resi+5โˆ’0
Mtests/tools_tests/test.sh+10โˆ’0
Mtools/src/migrate.md+1โˆ’0
Mtools/src/migrate.ml+15โˆ’8
with Claude Opus 5.5