From 475cfbc1bdd0273d5ad5c44083ca01834db6c211 Mon Sep 17 00:00:00 2001 From: natew Date: Tue, 27 Oct 2026 00:37:21 -1000 Subject: [PATCH] fix(vxrn): distinguish bundle and bytecode preparation in traces Validation: actual handler and response recorder probe, 17 cases including deferred stages and baseline response equivalence; oxfmt and oxlint on both changed paths; git diff --check. No native rerun or timing cause claim. Team-Machine-Session: r134555 --- packages/vxrn/src/plugins/reactNativeDevServer.ts | 5 +++++ tests/test/scripts/nativeBundleTrace.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/vxrn/src/plugins/reactNativeDevServer.ts b/packages/vxrn/src/plugins/reactNativeDevServer.ts index 4696a926a1..5e8d19f5e4 100644 --- a/packages/vxrn/src/plugins/reactNativeDevServer.ts +++ b/packages/vxrn/src/plugins/reactNativeDevServer.ts @@ -615,7 +615,10 @@ export function createReactNativeDevServerPlugin( } try { + // the opt-in response trace separates bundle preparation from bytecode. + res.emit('vxrn:bundle-phase', 'bundle:start') const bundle = await (await getDevEngine(platform)).getBundle() + res.emit('vxrn:bundle-phase', 'bundle:ready') let body: string | Buffer = bundle.code if ( (platform === 'ios' || platform === 'macos') && @@ -625,10 +628,12 @@ export function createReactNativeDevServerPlugin( root, platform )) + res.emit('vxrn:bundle-phase', 'bytecode:start') body = await compile( bundle, `${url.origin}/index.bundle?platform=${platform}` ) + res.emit('vxrn:bundle-phase', 'bytecode:ready') } // a client that connects after this response starts from the current // route map and does not need the pending reload intended for the diff --git a/tests/test/scripts/nativeBundleTrace.ts b/tests/test/scripts/nativeBundleTrace.ts index 5328197c9d..01bd071ac2 100644 --- a/tests/test/scripts/nativeBundleTrace.ts +++ b/tests/test/scripts/nativeBundleTrace.ts @@ -28,6 +28,7 @@ export function nativeBundleTrace(path: string | undefined): Plugin { ) } record('request', { url: req.url, accept: req.headers.accept }) + res.on('vxrn:bundle-phase', (phase: string) => record('phase', { phase })) const writeHead = res.writeHead.bind(res) res.writeHead = ((...args: Parameters) => { record('headers', { status: args[0] })