test(kicad): timer-park repro lever — deterministic concurrent-Asyncify window

kicadTestArmTimerPark(delayMs, parkMs): a one-shot wxTimer whose Notify()
emscripten_sleep()s, entering through the exact GAL-refresh-timer path
(emscripten_async_call → TimerCallbackFunc::Run → dispatch guard → Notify) —
the fresh-entry-that-parks the prod board-load trap family needs. Pollable
kicadTestTimerParkState(); inert unless armed. Registered beside
kicadTestSetOpenPark in pcbnew + the merged kicad_editor image.

tests/kicad/timer-park-repro.spec.ts drives four escalating cycles (park
only, 2× + fiber hammering, + 256MB heap growth mid-park) and asserts the
runtime survives every rewind AND that the [wx-asyncify] diagnostics observed
the window — engagement is asserted, so a run where the lever never created
the overlap cannot pass vacuously.

Result so far (docs/features/async/15-timer-park-repro.md): GREEN through
both rounds — genuine double-parks, live currData cross-restores, fiber
swaps, and mid-park heap growth are all handled by the shim + runtime. The
prod trap needs an ingredient this window still lacks (ranked in the doc);
the spec stays as the regression gate for whatever the eventual fix is.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019SE4o46Lnq3hF574FFq8x4
This commit is contained in:
Gergő Törcsvári 2026-07-31 20:34:32 +02:00
commit f86ef9e433
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
5 changed files with 589 additions and 0 deletions

View file

@ -41,6 +41,7 @@
#include "pcbjam_libs_reload.h"
#include "open_gate.h"
#include "timer_park.h"
using namespace emscripten;
@ -175,6 +176,18 @@ static void kicadTestSetOpenPark( int aMs )
pcbjam_open::testParkMs() = aMs;
}
// Test-only (timer-park repro, timer_park.h): a one-shot wx timer whose
// Notify() Asyncify-parks — the deterministic concurrent-park window.
static bool kicadTestArmTimerPark( int aDelayMs, int aParkMs )
{
return pcbjam_timer_park::arm( aDelayMs, aParkMs );
}
static std::string kicadTestTimerParkState()
{
return pcbjam_timer_park::stateJson();
}
// Canvas-only chrome toggle (features/mobile): hide/show every AUI pane
// except the central draw canvas, plus the menubar and status bar, so the GAL
@ -529,6 +542,8 @@ EMSCRIPTEN_BINDINGS(kicad_editor) {
function("kicadOpenFile", &kicadOpenFile);
function("kicadOpenFileBusy", &kicadOpenFileBusy);
function("kicadTestSetOpenPark", &kicadTestSetOpenPark);
function("kicadTestArmTimerPark", &kicadTestArmTimerPark);
function("kicadTestTimerParkState", &kicadTestTimerParkState);
// Canvas-only mobile mode (features/mobile).
function("kicadSetChrome", &kicadSetChrome);