design-b D-1 gate: battery green scheduler-only; startModal import scrub + work log

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TEHGiiXMShNXbBr7gSJ7iz
This commit is contained in:
Gergő Törcsvári 2026-08-05 20:40:41 +02:00
commit d519ac89c0
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
5 changed files with 50 additions and 17 deletions

View file

@ -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 S0S6 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 23 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 S0S6
> 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 23 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).

View file

@ -17,5 +17,4 @@ env.emscripten_idb_*
# --- Project suspending imports ---
env.__asyncjs__*
env.emscripten_fiber_swap
env.startModal
env.js_*

View file

@ -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

View file

@ -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);

View file

@ -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[] = [];