pcbjam/wasm/stubs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Istvan Matejcsok c14e76651c findings(E-5,E-8,E-9): module-identity ngspice events + runWaitCompletion admission gate
E-8 (re-implemented for JSPI — the codex gate is entangled with the dropped
execution owner; under JSPI a fresh non-suspending JS→wasm entry while
another activation is suspended is structurally safe on its own stack, so
the admission boundary for worker completions is liveness + trap state, not
execution ownership):
- jspi-scheduler.js grows `terminal` (trapped instance; distinct from `dead`),
  canTouchNative(), _terminalizeNativeTrap() (WebAssembly.RuntimeError +
  cross-realm string classification), and runWaitCompletion(site, token,
  prepare, inertResult): prepare runs immediately and owns ALL native work;
  stale tokens and dead/terminal instances drop loudly without resolving
  (resolving would resume the parked frame inside the damaged module); a
  trap latches terminal; a plain JS bug resolves inertResult so the wait
  fails instead of stranding. beginWait refuses (token 0) when dead/terminal.
- all four delayed completion sites route their native work through the
  gate: 'OCC export completion' (exporter_step_stub), 'OCC model completion'
  (oce_plugin_stub — the MEMFS cache write moves inside the gate too),
  'ngspice request completion' and 'ngspice vector completion'
  (sharedspice_client — every HEAP32/HEAPF64/malloc write inside prepare,
  inertResult 1 = transport error). Every wxWasmBeginWait caller in the
  stubs bails on token <= 0.
- deliberately NOT ported from codex: ownerModule, enqueueNativeCompletion,
  executionBarrier, the byte-credit native-entry FIFO — completions are
  one-shot per wait token and stream volume is bounded at the E-6 transport
  credit window. Cross-refs logged for group M (M-2/M-6/M-8).

E-5 (re-implemented; codex shape kept, owner APIs replaced with the E-8
gate): js_ngspice_install_events binds the handler to the EXACT installing
module (handler.__pcbjamNgspiceOwnerModule stamp; presence is not identity),
re-installation replaces a foreign module's handler, a superseded handler
disarms itself, native entry goes through installingModule._malloc/
._pcbjam_ngspice_event (never lexical Module), each dispatch checks
canTouchNative() (loud drop on a dead/terminal module), and a trap on the
per-line entry latches the terminal gate.

Tests: scheduler-shim.test.ts +7 (gate happy/stale/dead/terminal/cross-realm/
js-bug/beginWait-refusal). e2e specs updated from the codex line: occ-export
decode-fault recovery (real onmessageerror transition via failDecode, J-4),
ngspice-probe direct-service coverage, eeschema-sim rewritten onto the E-7
applied-generation receipt (codex's executionBarrier await replaced with a
pendingWaits('ngspice') drain poll — the JSPI-line equivalent).

Also bumps the kicad submodule to the E-7/E-9 commit (dd5751038f7).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 18:18:21 +02:00
..
GL Add missing GLU_TESS_BOUNDARY_ONLY constant for idftools 2026-01-03 11:24:24 +01:00
ngspice eeschema simulator: lazy ngspice_service worker — static sharedspice (XSPICE registry + CIDER), init_dll ifdef, e2e both engines 2026-07-19 15:59:21 +02:00
nng Enable 3D viewer in KiCad WASM build 2025-12-21 14:21:29 +01:00
3d_canvas_stub.cpp feat(wasm): Disable 3D viewer with comprehensive stubs 2026-01-10 15:15:50 +01:00
3d_scenegraph_stub.cpp feat(wasm): Disable 3D viewer with comprehensive stubs 2026-01-10 15:15:50 +01:00
3d_viewer_stub.cpp feat(wasm): Disable 3D viewer with comprehensive stubs 2026-01-10 15:15:50 +01:00
api_plugin_stub.cpp wasm-port-rebase: KiCad 10.0.4 rebase + WASM build adaptations 2026-06-24 10:30:25 +02:00
char_traits_uint16_workaround.h feat(schematic): eeschema WASM build + e2e harness 2026-05-29 16:01:17 +02:00
curl_stub.c Enable 3D viewer in KiCad WASM build 2025-12-21 14:21:29 +01:00
eeschema_frame_stub.cpp feat(schematic): eeschema WASM build + e2e harness 2026-05-29 16:01:17 +02:00
exporter_step_stub.cpp findings(E-5,E-8,E-9): module-identity ngspice events + runWaitCompletion admission gate 2026-08-31 18:18:21 +02:00
libgit2_stub.c fix(wasm): KiCad 10 kiplatform/libgit2 stubs, e2e fixtures, asyncify -g hook 2026-06-24 10:30:25 +02:00
model_substitution_stub.cpp fix(wasm): add MODEL_SUBSTITUTION no-op stub for 3D-disabled pcbnew/footprint build 2026-06-26 08:14:47 +02:00
nl_gerbview_plugin_stub.cpp feat: gerbview WASM port 2026-06-03 14:23:57 +02:00
nl_pcbnew_plugin_stub.cpp Fix KiCad WASM build and runtime errors 2025-12-22 16:30:53 +01:00
nl_pl_editor_plugin_stub.cpp feat: pl_editor WASM port + browser file dialog fixes 2026-06-01 10:30:56 +02:00
nng_stub.c Enable 3D viewer in KiCad WASM build 2025-12-21 14:21:29 +01:00
oce_plugin_stub.cpp findings(E-5,E-8,E-9): module-identity ngspice events + runWaitCompletion admission gate 2026-08-31 18:18:21 +02:00
pcb_frame_stub.cpp Fix KiCad WASM build and runtime errors 2025-12-22 16:30:53 +01:00
pcbnew_scripting_stub.cpp Enable 3D viewer in KiCad WASM build 2025-12-21 14:21:29 +01:00
python_manager_stub.cpp Fix KiCad WASM build and runtime errors 2025-12-22 16:30:53 +01:00
scripting_stub.cpp Fix KiCad WASM build and runtime errors 2025-12-22 16:30:53 +01:00
sharedspice_client.cpp findings(E-5,E-8,E-9): module-identity ngspice events + runWaitCompletion admission gate 2026-08-31 18:18:21 +02:00