Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## compiler-request-isolation #8780 +/- ##
===========================================================
Coverage 80.94% 80.94%
===========================================================
Files 453 453
Lines 62839 62839
===========================================================
Hits 50865 50865
Misses 11974 11974 🚀 New features to boost your workflow:
|
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8780 |
ea54579 to
042e314
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
042e314 to
2a090ed
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
bfb3808 to
374d93a
Compare
374d93a to
ca31093
Compare
|
@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: ca31093b2e
ℹ️ 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".
ca31093 to
82047c0
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82047c029d
ℹ️ 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".
Signed-off-by: Christoph Knittel <ck@cca.io>
Like Rust rewatch, a package listed by its parent rescript.json builds with the parent's output settings. Every package now uses the root's settings, replacing the separate build owner that made outputs depend on build history. Belt's own lib/es6 and lib/js outputs are no longer tracked. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A string namespace with a namespace-entry is Pascal-cased as by Rust's convert_case, so "my_lib" is named MyLib again. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Children run in their own process groups, so these signals reached only rescript and left the children and the build lock behind. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also document the exit statuses the CLI actually uses. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follows #8756: Rust rewatch no longer passes -bs-jsx-mode and accepts both fields with any value. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The warning cleanup on exit gives up after about two seconds instead of waiting up to a minute. Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christoph Knittel <ck@cca.io> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The watcher now logs each watch path at debug level, as Rust rewatch does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Ports the copy skip from Rust rewatch (#8769). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Mutex.protect needs OCaml 5.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
The formatter emits CRLF on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Windows rejects locking an unbounded range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
macOS can deliver both edits in one batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
A clean test-repo build takes over 20 seconds on macOS Intel runners. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Rust now capitalizes only an ASCII first letter (#8797), as this port did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
The next build then publishes the .cmi or .cmj again instead of reading a truncated one. Copies stay in place, like Rust rewatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
The test failed once on macOS Intel CI without leaving output to diagnose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Coarse file times could hide a same-size edit, so the watcher missed it and a unit test hung on Windows CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Port of Rust rewatch's schema test from #8835. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
The copies differed in timeouts and diagnostics; the shared ones wait 20 s and report what they waited for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Rust rewatch does this too since #8540. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
… change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WZbCuRQ1Tn31bnKzLj5e72 Signed-off-by: Christoph Knittel <ck@cca.io>
82047c0 to
002d5dd
Compare
cristianoc
left a comment
There was a problem hiding this comment.
Not going to read this one. Seems pretty well tested.
Stacked on #8864, which the in-process follow-up #8781 builds on.
This PR replaces the Rust implementation of rewatch, ReScript's build system and CLI, with an OCaml port as the
rescriptexecutable on Linux, macOS, and Windows. The Rust implementation still ships asrescript-rustfor comparison and as a fallback.The compiler and almost all supporting tools are OCaml. Moving the build system to OCaml gives the project one implementation language. It also shrinks the dependency surface: about 143 crates become 14 OPAM packages. And it lets the build system call the compiler directly later on. In this PR
bscstill runs as a separate process for every parse and compile, exactly as with Rust rewatch. The follow-up PR stacked on this one moves compilation in-process onto OCaml domains, which is where the performance gains are.Behavior
The port follows Rust rewatch's architecture and algorithms. It does not translate the Rust code line by line. On the
rewatch/testrepofixture, both implementations run the samebscinvocations for clean, unchanged, and single-edit builds (1031 / 4 / 6). They also produce identical file sets and byte-identical generated JavaScript,.cmi,.cmj, ASTs, and namespace maps. The sharedrewatch/testssuite runs against both executables.Deliberate differences from Rust rewatch
rescript.jsonmaps interpreted by the build system reject duplicate keys instead of silently using the last one.namespace-entrywithout a namespace is an error instead of being ignored.rescript cleanalso removes out-of-source JavaScript outputs.--no-timingno longer takes a value;--filtersupports the common subset of Rust's regex syntax. Unsupported constructs such as(?i)are rejected with an error.path: messageform (path:line:column:for JSON syntax errors), and they name the field and the accepted values instead of the parser's internal types.format -vandcompiler-args -vwrite their logs to stderr, so stdout stays formatted source or JSON.--after-buildcommand makes the build fail.Rust rewatch bugs that the port does not have
rescriptleft compiler children running.lib/ocamlthat failed partway left a truncated.cmior.cmjfor the next build; the port removes it, so the next build publishes it again.Debugrepresentation. Both implementations now print the same plain sentence (a small change inrewatch/src/project_context.rs).Like Rust,
rescript.jsonmust be standard JSON: comments, unquoted keys, andNaNare rejected.Performance
These numbers come from interleaved clean builds of
rewatch/testrepoon a 10-core Linux container, comparing against release Rust:The remaining clean-build overhead is in subprocess handling: every
bscchild gets reader threads for its pipes. The in-process follow-up removes it.Packaging
The platform packages contain both
rescript.exe(OCaml) andrescript-rust.exe. Linux binaries are linked statically. The luv/libuv dependency is built from a small overlay in.github/opam-repositorythat fixes static linking on arm64 musl. License notices for the bundled OCaml libraries ship in each platform package.Reviewing this PR
Of the about 29k added lines, 12.9k are the implementation in
rewatch-ocaml/. Most of the rest is tests: 5.4k unit tests and 5.7k shell tests. There are also 2.6k lines of license notices, one copy per platform package, and the infrastructure: CI, the opam overlay, the JS launchers and the scripts.rewatch-ocaml/README.mdmaps each area to its modules, andrewatch-ocaml/AGENTS.mdstates the rules the code follows: OS code behindplatform.mli, one owner for every child process, pipe, lock and temporary file, and signal handlers that only record the request.Suggested reading order, with the Rust counterparts for side-by-side comparison:
rescript_ocaml,cli,output,source_filtermain.rs,cli.rsstrict_json,config_decode,config,project_context,package_resolution,package_traversal,source,package_graphconfig.rs,project_context.rs,build/packages.rs,helpers.rsplatform.mli,platform_unix,platform_windows,windows_job_stubs.c,process_child,process,build_lock,file_utillock.rs; Rust usesstd::processand rayonmodule_graph,build_preparation,build_artifacts,compiler_info,package_parse,package_compilation,compiler_scheduler,compiler_process,build_attempt,build_session,build,clean,formatbuild.rs,build/*.rs,format.rsnative_watcher,watch_scope,watch_snapshot,watcherwatcher.rs,queue.rsrescript buildrunsBuild.run, thenBuild_preparation.run: discovery, stale-output cleanup, parallel parse and the module graph. After that comePackage_parseandPackage_compilationper package, and finallyCompiler_scheduler.runonProcess.run_dependency_graph.Where review time is best spent:
process.ml;process_child.ml, which owns the pipes, the reader and waiter threads, and the escalation from SIGTERM to SIGKILL for the process group;rescript_ocaml.mlandwatcher.ml.build_lock.ml, which covers hard-link publication, stale-lock takeover and the liveness probes inplatform_*.ml. A probe that is too lax steals a live build's lock, and one that is too strict leaves a lock that never clears.Build_artifacts.cleanup_stale, which decides which public JavaScript outputs the build owns;Compiler_info.clean_package;Clean;File_util.remove_tree.Build.prepare_incremental, the session kept after failed attempts, and the snapshot reconciliation inwatch_snapshot.ml, which keeps changes from being missed.platform_windows.mlandwindows_job_stubs.c(Job Objects, inherited-handle lists, quoting forcmd.exe). They only run on Windows CI, though the unit tests type-check them on every platform.Safe to skim: config decoding and its error messages, which
check_config_acceptance.shcompares with Rust; the Cmdliner definitions; output formatting; and the small helpers.Besides the shared
rewatch/testssuite, thecheck_*.shscripts run Rust and OCaml side by side, comparing exit codes and output for command validation, configuration acceptance, verbose output and interactive (pty) output.Tests
tests/rewatch_ounit_tests: unit tests for configuration, package and module graphs, invalidation, compiler arguments, scheduling, locks, and the watcher. New cases cover:convert_case);rewatch-ocaml/tests/run.sh: focused end-to-end tests, including:js-post-buildhook;compiler-args -vkeeping stdout valid JSON;formatreporting a package-name mismatch once;tests/build_tests/cli_help: compares the help output exactly, and checks that output piped through a color-capable terminal contains no escape codes.rescript,rescript-rust, the dune development executable), in both implementations, so a reused PID of anotherrescript-*tool no longer keeps a stale lock. Unit tests cover the names on both sides.The shared
rewatch/testssnapshots are unchanged from master. The Rust implementation gets two small changes:🤖 Generated with Claude Code