Repository navigation
Conversation
cknitt
added this pull request to stack #8782
October 10, 2026 16:36
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## rewatch-ocaml-port #8781 +/- ##
=====================================================
Coverage ? 80.48%
=====================================================
Files ? 452
Lines ? 61778
Branches ? 0
=====================================================
Hits ? 49723
Misses ? 12055
Partials ? 0
🚀 New features to boost your workflow:
|
cknitt
force-pushed
the
rewatch-ocaml-in-process
branch
2 times, most recently
from
October 10, 2026 18:59
236cf9b to
3de8d08
Compare
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
cknitt
force-pushed
the
rewatch-ocaml-in-process
branch
from
October 12, 2026 05:57
0ba9249 to
6bcbfad
Compare
cknitt
force-pushed
the
rewatch-ocaml-in-process
branch
from
October 12, 2026 06:08
6bcbfad to
6a72ee9
Compare
cknitt
force-pushed
the
rewatch-ocaml-in-process
branch
2 times, most recently
from
October 12, 2026 19:03
99ad4fe to
20777a1
Compare
Signed-off-by: Christoph Knittel <ck@cca.io>
Signed-off-by: Christoph Knittel <ck@cca.io>
compiler-info.json records the bundled bsc.exe again, which editor tooling uses to find the platform binaries. RESCRIPT_BSC_EXE only affects Rust. 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>
Concurrent requests shared the counter and could reuse a name within one exhaustiveness check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Ctype's abbreviation memos and levels, and PPX cookies, now start fresh for each request. Parser hooks are installed once; Typetexp's unused pre_univars is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
On Windows this gives the same CRLF line endings as a bsc process. 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>
Concurrent requests mixed their sets, so Js_shake could drop a live function definition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Not reached concurrently today; same pattern as the Js_analyzer race. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Request_local keys get a fresh value per request and are restored after it, replacing the per-module with_fresh and reset functions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Christoph Knittel <ck@cca.io>
Partial_class_expr is gone (#8793). 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>
bsc.exe writes to its own stdout and stderr again; only in-process requests capture. A request that raises still reports what it wrote before. 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 first signal still waits for modules compiling in-process; a second one releases the held build locks and exits. 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>
setup_env and the drivers set the same flags again. 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>
In-process requests run in a different directory than the process. 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>
Threads may handle INT and TERM in either order, so the immediate exit reports 130 or 143. A two-second deadline still rules out the graceful stop. 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 cleanup also runs when the build is interrupted while a PPX runs. 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>
The large module from the second-signal test keeps the first build compiling. That test now checks the real output name, Slow.js. 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>
cknitt
force-pushed
the
rewatch-ocaml-in-process
branch
from
October 12, 2026 22:27
20777a1 to
ea7a294
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #8780.
This PR moves compilation into the OCaml rewatch process. Instead of starting
bscfor every parse and compile,rescriptlinks the compiler and runs requests on a bounded pool of OCaml 5 domains. That removes process start-up and pipe handling, which make the subprocess port about 6% slower than Rust on clean builds. It also opens the door to sharing compiler state between requests later.Changes
Js_config, warnings, environment and CRC caches, predefined types,Identstamps, printers, diagnostics and backend caches move into domain-local state. Almost all of it lives inRequest_localkeys: every request starts with fresh values, as a newbscprocess would, and the previous values are restored afterwards. OnlyIdentstamps, the request context, output capture and the order-sensitive predefined types keep explicit handling. The driver moves fromrescript_compiler_main.mltorescript_compiler_driver.ml, sobscand rewatch share it.bsc's CRLF line endings. Output written before an escaping exception is kept and reported with the failed module. The standalonebscstill writes directly to its stdout and stderr.REWATCH_COMPILER_DOMAINSoverrides it. Artifact publication stays on the scheduling domain. PPXs and hooks still run as external processes.rescript formatalso runs on the embedded compiler. PPXs,js-post-build,--after-buildand the lock-owner check are the only remaining subprocesses.RESCRIPT_BSC_EXEnow only affectsrescript-rust, and CONTRIBUTING.md says how to test a local compiler instead.lib/bs/compiler-info.jsonstill records thebsc.exeshipped next torescript.exe. The VS Code extension readsbsc_pathto findbsc.exeand the other platform binaries.Known issues before this can leave draft
An earlier domain build once produced a differing output that was never explained. Review since found and fixed shared or leaked state:
Js_analyzer's free-variable accumulator was shared between domains, soJs_shakecould drop a live function definition; this reproduced once in CI;Parmatch.Conv's name counter,Ctype's abbreviation memo and levels, and the parser hooks for error messages.An audit of top-level mutable records, visitors and tables found no other live case. Regression tests cover the
Js_analyzerrace and the leakedCtypememo.The first Ctrl-C waits for modules that are compiling in-process to finish; a second one releases the build lock and exits at once. The focused suite tests this with one large module.
ThreadSanitizer
An OCaml 5.5.0 ThreadSanitizer build of
rescriptreported no data races in compiler or rewatch code on clean builds ofrewatch/testrepo(4 domains),tests/tests(2, 8 and 12 domains), the gentype example and the React PPX tests, or in the rewatch unit tests. Two reports appeared in sometests/testsruns, both inside the runtime's parallel minor GC (oldify_oneagainstpool_allocate). With the sharedJs_analyzeraccumulator restored, the sametests/testsbuild reports 91 races, all inJs_analyzer, so the tool does catch this class of bug.Tests
tests/rewatch_ounit_tests/compiler_driver_tests.mlchecks that each kind of request-scoped state is isolated between consecutive and concurrent requests. The focused suite tests with one large module that a second build waits for the build lock of an in-process build, and that a failing PPX leaves no temporary files. A unit test checks that an exception escaping the compiler fails only its own module.rewatch-ocaml/benchcompares clean-build artifacts across domain counts; it does not run in CI.🤖 Generated with Claude Code