jspi: fix the dead-tools ownership bug, emscripten-6 fallout, and green the full suite on Playwright 1.62

Live-app fix (Place Footprints / routing dead in Chrome): submodule
bumps carry the coroutine ownership fix (kicad 012d95ecb4) and the
handler-exception survival fix (wxwidgets 1b5f0e31f4).

Emscripten-6 fallout:
- occ/ngspice worker wrappers: mainScriptUrlOrBlob was removed
  upstream; pthread children re-run the wrapper blob, so an em-pthread
  realm now importScripts the glue and gets out of the way (before:
  recursive service boots, pool never fills, silent 180s boot hangs —
  every occ spec and ngspice bg_run).
- Makefile.wasm: -sASYNCIFY frankenlinks on the no-wx coroutine repro
  targets ported to -sJSPI (the JSPI-only libcontext crashed at first
  yield under them); mainloop/gl repro pages drive their tick through a
  promising export (emscripten_set_main_loop callbacks cannot suspend);
  retired inject-dyncall-shims lines removed (targets were unbuildable
  since Phase 8); $stringToNewUTF8 force-included (the EM_ASM value
  bridge aborted the runtime on the first decoded exception).
- fiber-park levers: neither embind shape can drive suspending levers
  (plain throws on strict-JSPI Firefox; emscripten::async() re-executes
  its invoker on settle) — kept sync for manual Chromium probing, spec
  coverage moved to the jspi-coroutine harness (18 cases).

Suite work:
- Playwright 1.61.1 -> 1.62.1 (Firefox 153: JSPI on by default).
- fiber-resume-park.spec retired -> coroutine-lifecycle.spec: census
  gate over boot / board load / chooser open / cancel (deterministically
  red on the pre-fix build).
- Blind asyncify-era pins re-keyed: quasimodal-strand + wait-beacons
  beacon regexes, footprint-chooser-close liveness -> wx parking-timer
  heartbeat (scheduler counters idle flat on Firefox).
- occ/ngspice test providers: 60s boot timeout + worker error
  surfacing (a worker death used to be a silent 180s timeout).
- Harness pages: stale 9.99 config dir -> 10.0 (library_manager wxCHECK
  noise, chooser had no libraries).
- gal-webgl harness: missing artifacts rebuilt (boost/glm extracted to
  the host sysroot), PgmOrNull stub added for the rebased GAL.
- jspi-scheduler: clean-shutdown console line restored (app-quit
  contract), quarantine never yanks SP from a live window.

Gates: test:e2e 699 passed / 0 failed (wx-chromium, kicad-firefox,
kicad-chromium, jspi-firefox, coroutine-firefox); web ff/cr/mobile 71
passed; lint:ci-coverage 166, lint:determinism 163, screenshots
manifest 492 current, corpus 7/7, tools:contract green. Offline
screenshot baselines show expected mass drift from the engine bump —
re-baseline (screenshots:noise -> promote) is a follow-up.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016X9eh1s5sTx1o9Em9KBuwR
This commit is contained in:
Viktor Vaczi 2026-08-13 17:41:28 +02:00
commit db819850ee
31 changed files with 577 additions and 359 deletions

View file

@ -20,6 +20,15 @@
*/
const GLUE = self.NGSPICE_GLUE_URL;
// PTHREAD CHILD REALM (emscripten 6): the glue spawns pthread workers
// (ngspice's bg_run thread) from _scriptName = self.location.href — THIS
// wrapper blob (mainScriptUrlOrBlob was removed upstream). Load the glue (its
// tail self-instantiates into pthread-child mode) and get out of the way; see
// occ-worker.js for the full story.
if (globalThis.name === "em-pthread") {
importScripts(GLUE);
} else {
self.addEventListener("error", (e) =>
console.error("[ngspice_service] worker error:", e.message, e.filename, e.lineno));
self.addEventListener("unhandledrejection", (e) =>
@ -29,12 +38,8 @@ importScripts(GLUE);
const modP = NgspiceService({
onAbort: (what) => console.error("[ngspice_service] ABORT:", what),
// Same blob-importScripts trick as boot.ts / occ-worker.js: the module's own
// pthread children (ngspice's bg_run thread) must boot from a same-origin
// script even when the glue lives on a CDN.
mainScriptUrlOrBlob: new Blob(
["importScripts(" + JSON.stringify(GLUE) + ");"],
{ type: "text/javascript" }),
// (emscripten 6 removed mainScriptUrlOrBlob; pthread children re-run this
// wrapper blob instead — handled by the em-pthread branch at the top.)
// A blob: worker has no http base URL — absolutize every asset path against
// the glue's URL or the .wasm fetch dies with "Failed to parse URL".
locateFile: (f) => new URL(f, GLUE).href,
@ -139,3 +144,5 @@ onmessage = async (e) => {
}
postMessage({ id, res }, transfer);
};
} // end non-pthread (top service) realm

View file

@ -13,6 +13,19 @@
*/
const GLUE = self.OCC_GLUE_URL;
// PTHREAD CHILD REALM (emscripten 6): the glue spawns its pthread workers from
// `_scriptName` = self.location.href — which, for a blob-booted service, is
// THIS wrapper blob (`Module.mainScriptUrlOrBlob` was removed upstream). Each
// child therefore re-executes this file. Detect the em-pthread realm, load the
// glue (its tail self-instantiates into pthread-child mode and installs its own
// onmessage for the wasmModule/wasmMemory handshake) and get out of the way —
// running the wrapper's own boot here would recursively spawn whole new
// services and clobber the pthread handshake handler (observed: occ_service
// boot hanging forever in a worker-spawn storm while the pool never fills).
if (globalThis.name === "em-pthread") {
importScripts(GLUE);
} else {
self.addEventListener("error", (e) =>
console.error("[occ_service] worker error:", e.message, e.filename, e.lineno));
self.addEventListener("unhandledrejection", (e) =>
@ -26,11 +39,8 @@ const noise = (s) => /(^|: )Debug: /.test(String(s));
const modP = OccService({
onAbort: (what) => console.error("[occ_service] ABORT:", what),
// The module's own pthread children must boot from a same-origin script even
// when the glue lives on a CDN — same blob-importScripts trick as boot.ts.
mainScriptUrlOrBlob: new Blob(
["importScripts(" + JSON.stringify(GLUE) + ");"],
{ type: "text/javascript" }),
// (emscripten 6 removed mainScriptUrlOrBlob; pthread children re-run this
// wrapper blob instead — handled by the em-pthread branch at the top.)
// A blob: worker has no http base URL — every asset path must be absolutized
// against the glue's own URL or the .wasm fetch dies with "Failed to parse
// URL" (root-relative bases like "/wasm" don't resolve).
@ -68,3 +78,5 @@ onmessage = async (e) => {
};
postMessage({ id, res: out }, out.bytes ? [out.bytes.buffer] : []);
};
} // end non-pthread (top service) realm