Skip to content

Backport fixes to 12.3.0-beta.1#8407

Draft
cknitt wants to merge 24 commits intomaintenance/12.xfrom
version-12.3
Draft

Backport fixes to 12.3.0-beta.1#8407
cknitt wants to merge 24 commits intomaintenance/12.xfrom
version-12.3

Conversation

@cknitt
Copy link
Copy Markdown
Member

@cknitt cknitt commented May 3, 2026

This backports various fixes/improvements from master to 12.x.

I made it a beta version because lots of stuff is included, including the new rewatch scheduler (#8374).

cknitt and others added 11 commits May 3, 2026 15:24
…erive strategy (#8276)

* Extract fixpoint transitive-closure logic into ReactiveFixpoint module

Move the BFS reachability computation, incremental/full recompute, and
state management out of Reactive.ml into a dedicated private module
with a clean interface.

Signed-Off-By: Cristiano Calcagno <cristianoc@users.noreply.github.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* analysis/reactive: improve incremental fixpoint robustness

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>

* analysis/reactive: update fixpoint instrumentation and invariants

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>

* analysis/reactive: fix stale remove emission in fixpoint

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>

* analysis/reactive: add incremental fixpoint report and replay tool

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>

---------

Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md
Support `*` and `**` glob patterns in `reanalyze.suppress` and
`reanalyze.unsuppress` config entries (e.g. `**/bindings`, `src/Dead*`).
Plain prefix strings continue to work as before.

Closes #8259

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t position

When a switch on an untagged variant (e.g. JSON.t) with an Object case was in
statement position (not tail), compile_general_cases would set default=None for
empty default bodies, causing the null/array guard to be silently skipped. This
let null and arrays fall into the typeof "object" branch at runtime.

Two fixes:
- Handle the Some guard, None default case by emitting if (!(guard)) { ... }
- Use the type's block_cases to determine if arrays can appear at runtime,
  avoiding unnecessary Array.isArray guards for types without an Array case

Fixes #8251 (comment)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add String.localeCompare options

* CHANGELOG
* Fix rewatch panic when package.json has no "name" field

* CHANGELOG
* Fix exception record field regression

* Format
* Rewatch: ignore stale lock for unrelated process name

* CHANGELOG
# Conflicts:
#	CHANGELOG.md
@cknitt
Copy link
Copy Markdown
Member Author

cknitt commented May 4, 2026

Having trouble getting the rewatch tests to work. I think I'll keep the new scheduler v13 only for now.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 4, 2026

Open in StackBlitz

rescript

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

@rescript/darwin-arm64

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

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8407

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 52c0b6e

cknitt and others added 13 commits May 4, 2026 12:52
# Conflicts:
#	.github/workflows/ci.yml
* Branch lockfiles

* Add build.lock / await mechanism

* Remove build.lock when finished

* Rename loading lockfile message

* Short-circuit if path no longer exists

* Tests

* Drop lock after clean

* fmt
# Conflicts:
#	rewatch/src/main.rs
#	rewatch/tests/experimental/02-experimental-features-parse-error.sh
#	rewatch/tests/experimental/03-watch-invalid-experimental.sh
#	rewatch/tests/lock.sh
#	rewatch/tests/watch/04-watch-config-change.sh
* Fix loss of LOC during AST0 translation

* Changelog

* Format and completion test updates

* Fix build
# Conflicts:
#	CHANGELOG.md
* test: cover warning persistence after atomic saves

Add a rewatch integration test that simulates an editor-style atomic save by renaming B.res into place and verifies warnings from ModuleA.res remain in .compiler.log after the rebuild.

* Preserve warnings across watch full rebuilds

Atomic-save rename events force the watcher down the full rebuild path, which was recreating build state and dropping stored warnings for unchanged modules. Carry warning state forward into the new build state so unrelated module warnings continue to be re-emitted.\n\nAlso add unit tests for the warning carry-forward helper.

* docs: add changelog
# Conflicts:
#	CHANGELOG.md
#	rewatch/tests/02-watch-warnings-persist-atomic-save.sh
#	rewatch/tests/suite.sh
* propagate expected dict value type into dict literal typing

* cleaner impl

* change approach back to structural, and fix async as well

* changelog
# Conflicts:
#	CHANGELOG.md
When stdout isn't a TTY during `rewatch watch`, full rebuilds previously
produced no completion message. Emit a plain 'Finished compilation' line
so parent processes and non-TTY consumers can observe when a rebuild
finishes.
Change show_progress from `log_level_filter == LevelFilter::Info` to
`>= LevelFilter::Info` so that verbose flags (-v, -vv) add debug output
without silencing progress messages like 'Finished compilation'.
* Resolve workspace dependencies in editor analysis

* CHANGELOG
# Conflicts:
#	CHANGELOG.md
* improve deprecated attribute extraction and support record form

- Enhance `findDeprecatedAttribute` to extract the `reason` from record-form `@deprecated` attributes.
- Ensure deprecated attribute extraction works regardless of attribute order by reversing the list in `newDeclared`.
- Update tests and expected outputs to reflect improved deprecated reason extraction, including record-form deprecations.

* Update CHANGELOG.md

---------

Co-authored-by: Christoph Knittel <ck@cca.io>
# Conflicts:
#	CHANGELOG.md
* avoid warning 56 blowup for dict patterns

* changelog
# Conflicts:
#	CHANGELOG.md
@cknitt cknitt requested a review from fhammerschmidt May 4, 2026 11:09
@fhammerschmidt
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52c0b6e2d7

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

Comment thread rewatch/src/build.rs
) -> Result<(), IncrementalBuildError> {
let build_folder = build_state.root_folder.to_string_lossy().to_string();

let _lock = get_lock_or_exit(LockKind::Build, &build_folder);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Acquire build lock before running initialization

build.lock is now acquired inside incremental_build, but build::build still runs initialize_build beforehand; that initialization performs filesystem-mutating setup/cleanup (cleanup_previous_build) with no lock held. If two rewatch build processes start at the same time in the same project, both can mutate lib/bs before one waits on the lock, causing racey cleanup and nondeterministic build state. The lock should be taken before initialization (or moved to wrap the full build path) so pre-build cleanup is serialized too.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #8409, will backport from there once merged.

@cknitt cknitt marked this pull request as draft May 4, 2026 13:56
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.

8 participants