From d519ac89c0c2df018a9d793cce848fb6f30e984d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20T=C3=B6rcsv=C3=A1ri?= Date: Wed, 5 Aug 2026 20:40:41 +0200 Subject: [PATCH] design-b D-1 gate: battery green scheduler-only; startModal import scrub + work log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gate results (single battery, scheduler-only): wx app battery + asyncify + coroutine 363 passed / 3 skipped / 0 failed; full kicad suite 138 passed / 30 skipped / 1 failed — the one failure is the pre-existing local occ-probe glb case (predates D-1, unrelated). Post-gate scrubs: vestigial 'startModal' removed from ASYNCIFY_IMPORTS (tests/apps/Makefile.wasm) and env.startModal from scripts/common/asyncify-imports.txt (the import no longer exists in any wasm; both lists are boundary supersets so behavior is identical). Stale comment pointers to the deleted legacy modal machinery updated. Doc 20: D-1 work log added, status flipped to IN PROGRESS. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01TEHGiiXMShNXbBr7gSJ7iz --- docs/features/async/20-design-b-core-plan.md | 42 ++++++++++++++++++-- scripts/common/asyncify-imports.txt | 1 - tests/apps/Makefile.wasm | 5 +-- tests/asyncify/asyncify-races.spec.ts | 10 +++-- tests/web/eeschema-fp-selector.spec.ts | 9 ++--- 5 files changed, 50 insertions(+), 17 deletions(-) diff --git a/docs/features/async/20-design-b-core-plan.md b/docs/features/async/20-design-b-core-plan.md index d64fa96..d212414 100644 --- a/docs/features/async/20-design-b-core-plan.md +++ b/docs/features/async/20-design-b-core-plan.md @@ -1,9 +1,10 @@ # 20 — Design B core: parkable activities as scheduler contexts -> **Status: PLAN (2026-08-05), not started.** The remaining core of Design B -> ([`06`](06-design-b-fiber-first-runtime.md) B1+B2), scoped against what S0–S6 actually -> built ([`17`](17-mailbox-scheduler-plan.md)) and motivated by the stranded-fiber hang -> ([`19`](19-quasimodal-fiber-strand.md)). Supersedes doc 12's phases 2–3 for this layer. +> **Status: IN PROGRESS — D-1 DONE (2026-08-05, work log §10).** The remaining core of +> Design B ([`06`](06-design-b-fiber-first-runtime.md) B1+B2), scoped against what S0–S6 +> actually built ([`17`](17-mailbox-scheduler-plan.md)) and motivated by the +> stranded-fiber hang ([`19`](19-quasimodal-fiber-strand.md)). Supersedes doc 12's +> phases 2–3 for this layer. ## 1. The one-sentence goal @@ -185,3 +186,36 @@ mailbox migration. the ambiguity — the 68/1 class is currently held closed by v0.1.28's scheduling trick, and D5 replaces a working mitigation with a structural one. Re-evaluate with D4's telemetry in hand rather than committing now. + +## 10. Work log + +### D-1 — legacy runtime deleted (2026-08-05) ✅ + +Baseline tag `d-1-pre-delete` on root/pcbjam/kicad/wxwidgets/binaryen before the first +deletion. Four commits, one per deletion group: + +- **D-1a** (pcbjam `e87d7f7`): `races_test_noheal`/`races_test_nosleepfix` link+inject + variants out of `tests/apps/Makefile.wasm`; the shim-redundancy pin specs out of + `asyncify-races.spec.ts`; `tests/README.md` open task resolved. +- **D-1b** (pcbjam `0a143ab`): injector injects asyncify-scheduler.js unconditionally — + `WX_SCHEDULER=0`, `SHIM_DISABLE_HANDLESLEEP`, `SHIM_DISABLE_TRAMPOLINE_HEAL` deleted; + `shims/handlesleep.js` deleted (423 lines); `.ci-cache-epoch` → 11. +- **D-1c** (wx `c44c684f7d`): every `wxWasmMailboxEnabled()` branch collapsed to the + scheduler lane (timer enqueue, wheel replay, modal wait, nested wait, unconditional + top-level tick, ungated deliver); probe deleted from mailbox.h; replaced by a + fail-fast `wxWasmSchedulerAssertInstalled()` abort at DoRun entry. +- **D-1d** (wx `24843897e8` + pcbjam `1831668`): `startModal`, `wxWasmRunNestedLoop`, + the wx-dom popup pump, `_wxModalResolvers`/`_endModal`/`_pendingModalResult`/ + `_wxNestedLoopExit`, and the bare `emscripten_async_call` timer entries deleted + (timer parked-retry re-arms via the mailbox, kept as a tripwire); the scheduler + shim's delivery-tick error path and diagnostics.js moved to wait-registry + containment/observation. + +**Gate (all scheduler-only, single battery):** wx app battery + asyncify (races + +scheduler core) + coroutine trio = 363 passed / 3 skipped / 0 failed; full kicad suite += 138 passed / 30 skipped / 1 failed — the failure is the pre-existing local +occ-probe `glb` case (known-unrelated, predates D-1). Vestigial `startModal` scrubbed +from `ASYNCIFY_IMPORTS` (Makefile.wasm) and `asyncify-imports.txt` post-gate. + +Consequence: every later phase is single-path — one code path per park site, one glue +per build, one battery per gate. Next: **D0** (park-site audit + the doc-19 red spec). diff --git a/scripts/common/asyncify-imports.txt b/scripts/common/asyncify-imports.txt index b8bc428..bc387e9 100644 --- a/scripts/common/asyncify-imports.txt +++ b/scripts/common/asyncify-imports.txt @@ -17,5 +17,4 @@ env.emscripten_idb_* # --- Project suspending imports --- env.__asyncjs__* env.emscripten_fiber_swap -env.startModal env.js_* diff --git a/tests/apps/Makefile.wasm b/tests/apps/Makefile.wasm index f40d4b5..9ac249c 100644 --- a/tests/apps/Makefile.wasm +++ b/tests/apps/Makefile.wasm @@ -61,14 +61,13 @@ CXXFLAGS += $(EH_FLAGS) # Base Emscripten flags (for all apps) # ASYNCIFY enables blocking modal dialogs (ShowModal waits for user) # ASYNCIFY_IMPORTS tells Emscripten which imported JS functions can unwind the stack -# - startModal: for modal dialogs # - js_writeTextToClipboard, js_readTextFromClipboard, js_clipboardHasText, js_clearClipboard: for clipboard # - js_enumerateFonts: for font enumeration via Local Font Access API BASE_LDFLAGS = $(EH_FLAGS) -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \ -s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32','ccall']" \ -sASYNCIFY=1 \ -sASYNCIFY_STACK_SIZE=65536 \ - -sASYNCIFY_IMPORTS=['startModal','js_writeTextToClipboard','js_readTextFromClipboard','js_clipboardHasText','js_clearClipboard','js_enumerateFonts'] + -sASYNCIFY_IMPORTS=['js_writeTextToClipboard','js_readTextFromClipboard','js_clipboardHasText','js_clearClipboard','js_enumerateFonts'] # LDFLAGS for non-GL apps (standalone tests) LDFLAGS_NOGL = $(DEBUG_LDFLAGS) $(BASE_LDFLAGS) $(WX_LDFLAGS_NOGL) @@ -103,7 +102,7 @@ COROUTINE_BASE_LDFLAGS = $(EH_FLAGS) -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_ -s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32','ccall']" \ -sASYNCIFY=1 \ -sASYNCIFY_STACK_SIZE=65536 \ - -sASYNCIFY_IMPORTS=['startModal','js_writeTextToClipboard','js_readTextFromClipboard','js_clipboardHasText','js_clearClipboard','js_enumerateFonts','emscripten_fiber_swap'] + -sASYNCIFY_IMPORTS=['js_writeTextToClipboard','js_readTextFromClipboard','js_clipboardHasText','js_clearClipboard','js_enumerateFonts','emscripten_fiber_swap'] LDFLAGS_COROUTINE = $(DEBUG_LDFLAGS) $(COROUTINE_BASE_LDFLAGS) $(WX_LDFLAGS_NOGL) # The asyncify-races harness must match PRODUCTION asyncify semantics: the KiCad diff --git a/tests/asyncify/asyncify-races.spec.ts b/tests/asyncify/asyncify-races.spec.ts index fed63f5..05999c9 100644 --- a/tests/asyncify/asyncify-races.spec.ts +++ b/tests/asyncify/asyncify-races.spec.ts @@ -90,10 +90,12 @@ test.describe('Asyncify races — green targets (full shims)', () => { page, testLogger, }) => { - // RED today: wx dialog.cpp keeps the modal resolver in a single slot - // (Module._endModal = fn; delete after use), so with three nested modals - // the middle EndModal resolves nothing and its ShowModal parks forever. - // GREEN after the Stage-3 wx fix (LIFO resolver stack). + // Historical red: the pre-scheduler wx dialog.cpp kept the modal resolver + // in a single slot (Module._endModal), so with three nested modals the + // middle EndModal resolved nothing and its ShowModal parked forever. + // Green since the LIFO resolver semantics, now the scheduler wait + // registry's per-kind stacks (doc 17 S4; legacy machinery deleted at + // doc 20 D-1). await page.goto('/standalone/asyncify-races/races_test.html#only=modal_in_modal_in_modal'); await tryLoadApp(page, 30000); diff --git a/tests/web/eeschema-fp-selector.spec.ts b/tests/web/eeschema-fp-selector.spec.ts index a06758b..4960804 100644 --- a/tests/web/eeschema-fp-selector.spec.ts +++ b/tests/web/eeschema-fp-selector.spec.ts @@ -31,11 +31,10 @@ async function canvasCenter(page: Page): Promise<{ x: number; y: number }> { // very commit that dropped its expected-fail marker): the no-fp-index path // trips the crash-free gate below with "[wxWasm] modal event pump error - // cancelling modal: RuntimeError: index out of bounds" — the known -// nested-modal-inside-doRewind asyncify pump limitation (see -// wxwidgets/src/wasm/dialog.cpp startModal comment and -// docs/features/ngspice-split/README.md "The editor side"). Needs the pump -// crash fixed (or the chooser's modal flow kept off the nested-rewind path), -// not a looser assertion. +// nested-modal-inside-doRewind asyncify pump limitation (historical: the +// legacy startModal pump was deleted at doc 20 D-1; modals are scheduler +// waits now — re-evaluate against the scheduler runtime; see also +// docs/features/ngspice-split/README.md "The editor side"). test.skip('symbol chooser footprint selector populates and preview renders (eeschema)', async ({ page }) => { test.setTimeout(420000); const logs: string[] = [];