GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update recorder to the version free of OpenSSL dependency by Andarist · Pull Request #123 · replayio/node

Conversation

@Andarist

@Andarist Andarist commented Apr 16, 2026

Copy link
Copy Markdown
Member

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Andarist added 3 commits April 16, 2026 12:11
@Andarist
Update recorder to the version free of OpenSSL dependency
bf494fb
@Andarist
remove stale API usage
858c1b1
@Andarist
update recorder version
effa31c
@Andarist
Andarist requested a review from bhackett1024 April 16, 2026 15:56
bhackett1024
bhackett1024 approved these changes Apr 16, 2026
View reviewed changes
@Andarist
Andarist merged commit c9366b6 into master Apr 16, 2026
2 of 3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

bhackett1024 added a commit that referenced this pull request Nov 5, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
568c156
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
944ab28
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
f3583c2
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
64fcba0
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
3d9b0a5
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,
#168, #169, #176, #178, #181 and #215.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
ea96dda
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
15df7ba
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
e7f2f49
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
be78ef7
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
974cae7
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
b157f26
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
b48a07f
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
2419347
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,
#168, #169, #176, #178, #181 and #215.

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
8a49aa5
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 6, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
c0459bf
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
90ae258
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,
#147, #172, #185, #186, #198, #200, #219, #221, #225 and #227.

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
2b6bf99
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
1344673
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
e1e28fe
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
7255162
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
0c3a4ae
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
20ffc1a
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
b3f5e8e
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
900997e
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
3aa7f6f
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
4025be3
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
78d8547
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
894a2e2
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
039da9a
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
243f724
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
ed1860e
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
ef4da18
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
0bde591
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
ab99556
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
a7cf652
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
cb105ed
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
57aa4c3
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
c86031f
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
2f53f7f
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
dec52f8
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
f789a83
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
4e62c2e
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
9187d9c
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
7bce9e9
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
9b295e2
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 10, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
ff2cade
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Andarist
Add build system for Replay fork
b931d38
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist pushed a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Andarist
Add Node.js record/replay driver integration and API
5e9c2a5
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
ee86a9d
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
8f615b8
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
2129e40
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 11, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
cac7b47
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 12, 2026
@bhackett1024 @Domiii
@Andarist @claude
Add build system for Replay fork
04127b9
Add build.js script for downloading the Replay driver and compiling
Node.js, REPLAY_BACKEND_REV for version tracking, .gitignore updates,
and node.gyp change to include node_record_replay_driver.cc. build.js
can use a local driver (REPLAY_LOCAL_DRIVER_DIR), builds into out/,
strips Nix paths from the build environment, and only rewrites
node_record_replay_driver.cc when its contents change, so make does not
rebuild the embedded driver needlessly.

Includes later changes from #123, #124, #125, #127, #128, #132, #136,

Co-authored-by: Domi <[email protected]>
Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Andarist added a commit that referenced this pull request Nov 12, 2026
@bhackett1024 @Andarist @claude
Add Node.js record/replay driver integration and API
2397c59
Add src/node_recordreplay.cc with Replay's node integration: loading
the driver (InitializeRecordReplay and OpenDriverHandle, from
RECORD_REPLAY_DRIVER or the copy embedded in the binary), the symbol
table of driver function pointers, attaching the recorder with the
build ID, recording the command line arguments and the argv metadata,
and RecordReplayFinishRecording, which appends the recording ID to
RECORD_REPLAY_RECORDING_ID_FILE unless the recording is unusable. The
node::recordreplay namespace holds the helpers the rest of node uses:
callback region scopes, whether the recording has finished, whether a
call is inside a callback the driver intercepts, whether events are
available (recording or replaying, with events neither disallowed nor
passed through and no divergence) or recorded, and
ThrowIfEventsUnavailable, which makes an operation that cannot be
replayed throw instead of running unrecorded.

Expose the recording primitives to JavaScript as process binding
methods: RecordReplayLog, the CDP message pair (a callback for
responses and events, and sending a message through a process-owned
inspector session), the annotation hook, assertions, script ignoring,
the recording ID, the current execution point and elapsed time, and
the external references for all of them. Replay's own session
connects, dispatches and delivers messages to the frontend as replay
code with events disallowed, so none of that work can diverge, and the
session is reset from AtExit, where node normally waits for external
debugger frontends to disconnect: process.exit() skips Environment
destruction, so the session would otherwise survive until static
destruction, after V8's platform has been disposed. That also disables
the debugger, which leaves WebAssembly modules tiered down (see
V8Debugger::disable).

In node.cc, initialize record/replay and mark the sibling group map
ordered before anything else, apply the old space limit the driver
asks for (REPLAY_RECORD_MAX_OLD_SPACE_MB /
REPLAY_REPLAY_MAX_OLD_SPACE_MB, read through
RecordReplayMaxOldSpaceMb) as a V8 flag after the command line's, so
that the arguments and process.execArgv stay the same when replaying,
print the build ID and exit for --print-build-id, create the first
checkpoint on the main thread before the entry script runs, and leave
V8's WebAssembly trap handler disabled while recording/replaying, so
V8 keeps emitting bounds checks instead of relying on a SIGSEGV the
recorder treats as a crash.

libuv keeps a pointer into argv for the process title rather than copying
it, so whichever argv uv_setup_args() sees decides the title. Start()
calls it before InitializeOncePerProcess(), where the driver replaces the
arguments with the recording's, so a replay reported its own argv[0]
instead. Node sends that title to a debugger frontend as the execution
context's name, where it diverged from the recording's and the write to
the frontend's socket was a different length, so the replay sets the
arguments up again once the driver has installed them.

CDP messages from the inspector are accepted as Latin-1: node 26 hands them
over in that encoding, and decoding them as UTF-8 corrupted any message with a
byte above 0x7f.

Rebase note: nearly all of this is new code in
src/node_recordreplay.cc, so conflicts should only come from the call
sites, which are one line each. InitializeRecordReplay() must run
early in InitializeOncePerProcess, before V8, OpenSSL and the platform
are initialized, and the driver's old space limit is applied after
node has processed the command line's V8 options, so that it wins. The
--print-build-id early return sits with the other print-and-exit
options, and StartExecution creates a checkpoint on the main thread
before running the entry script. The process methods are only added to
the process_methods binding, so upstream changes to how bindings
register methods (for example env->SetMethod(target, ...) becoming
SetMethod(context, target, ...) in later v16 releases) must be applied
to these registrations too, and the method names must stay in sync
with lib/internal/bootstrap/node.js.

Includes later changes from #123, #130, #151, #155, #164, #166, #167,

Co-authored-by: Mateusz Burzyński <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bhackett1024 bhackett1024 bhackett1024 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Andarist @bhackett1024
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.