fix(ui): show synthesis as a 'Linking dynamic dispatch' phase; mute node:sqlite warning spam (#1299)
Two first-run UX bugs surfaced by indexing a real 1,342-file C repo: 1. After 'Resolving refs' hit 100%, the ~40 dynamic-dispatch synthesis passes ran with no progress surface, so the bar sat frozen at 100% long enough to read as a hang (the C fn-pointer pass alone can hold for a while on C-heavy repos). Synthesis now reports per-pass progress through a new 'linking' IndexProgress phase, rendered as 'Linking dynamic dispatch'. The step total is pinned by a test to the synthesizer's actual __mark() count so adding a pass without bumping it fails loudly. 2. node:sqlite's ExperimentalWarning is emitted once per THREAD, so the main process plus every parse worker printed it mid-index, interleaved with the progress UI. All launch paths now pass --disable-warning=ExperimentalWarning: both bundle launchers, the Windows npm-shim invocation, and the CLI self-relaunch (NODE_RUNTIME_FLAGS, deliberately excluded from the re-exec gate so an older installed launcher never triggers a pointless re-exec, and version-gated off nodes older than the flag). Verified end-to-end on the same repo: zero warnings, live linking bar, byte-identical graph (50,520 nodes / 148,232 edges). Full suite green. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
243ef1d3e2
commit
ad5300a601
@@ -73,7 +73,7 @@ const WORKER_RECYCLE_INTERVAL = 250;
|
||||
* Progress callback for indexing operations
|
||||
*/
|
||||
export interface IndexProgress {
|
||||
phase: 'scanning' | 'parsing' | 'storing' | 'resolving';
|
||||
phase: 'scanning' | 'parsing' | 'storing' | 'resolving' | 'linking';
|
||||
current: number;
|
||||
total: number;
|
||||
currentFile?: string;
|
||||
|
||||
@@ -40,6 +40,31 @@ import { spawnSync } from 'child_process';
|
||||
*/
|
||||
export const WASM_RUNTIME_FLAGS: readonly string[] = ['--liftoff-only'];
|
||||
|
||||
/**
|
||||
* Node CLI options (not V8 flags) passed alongside the WASM flags on every
|
||||
* launch path. `--disable-warning=ExperimentalWarning` mutes node:sqlite's
|
||||
* "SQLite is an experimental feature" warning, which is emitted once per
|
||||
* THREAD — the main process plus every parse worker — so during indexing it
|
||||
* prints repeatedly, interleaved with the progress UI. Node options apply
|
||||
* process-wide (workers inherit them), so the command line covers everything.
|
||||
*
|
||||
* Deliberately NOT part of the {@link processHasWasmRuntimeFlags} re-exec
|
||||
* gate: a launcher passing only the WASM flags (an older installed bundle
|
||||
* running a newer dist) must not trigger a whole re-exec over a cosmetic
|
||||
* warning.
|
||||
*/
|
||||
export function nodeRuntimeFlagsFor(nodeVersion: string): readonly string[] {
|
||||
// `--disable-warning` landed in Node 20.11 / 21.3; older nodes treat it as
|
||||
// a fatal "bad option" at spawn. Those runtimes can't run codegraph anyway
|
||||
// (node:sqlite needs >= 22.5), but let them reach our own version messaging
|
||||
// instead of a cryptic spawn failure.
|
||||
const [major = 0, minor = 0] = nodeVersion.split('.').map(Number);
|
||||
const supported = major > 21 || (major === 21 && minor >= 3) || (major === 20 && minor >= 11);
|
||||
return supported ? ['--disable-warning=ExperimentalWarning'] : [];
|
||||
}
|
||||
|
||||
export const NODE_RUNTIME_FLAGS: readonly string[] = nodeRuntimeFlagsFor(process.versions.node);
|
||||
|
||||
/**
|
||||
* Env var set on the relaunched child so a detection slip can never cause an
|
||||
* infinite re-exec loop. Also lets users force-disable the relaunch.
|
||||
@@ -76,8 +101,10 @@ export function buildRelaunchArgv(
|
||||
scriptArgs: readonly string[],
|
||||
execArgv: readonly string[] = process.execArgv
|
||||
): string[] {
|
||||
const preserved = execArgv.filter((arg) => !WASM_RUNTIME_FLAGS.includes(arg));
|
||||
return [...WASM_RUNTIME_FLAGS, ...preserved, scriptPath, ...scriptArgs];
|
||||
const preserved = execArgv.filter(
|
||||
(arg) => !WASM_RUNTIME_FLAGS.includes(arg) && !NODE_RUNTIME_FLAGS.includes(arg)
|
||||
);
|
||||
return [...NODE_RUNTIME_FLAGS, ...WASM_RUNTIME_FLAGS, ...preserved, scriptPath, ...scriptArgs];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user