Skip to content

fix: host-abort gates — Dropdown/Tabs rove on arch(wasm32), BrowserNavigator fails loud at construction#259

Merged
zzal merged 1 commit into
mainfrom
fix/host-trap-gates
Jul 20, 2026
Merged

fix: host-abort gates — Dropdown/Tabs rove on arch(wasm32), BrowserNavigator fails loud at construction#259
zzal merged 1 commit into
mainfrom
fix/host-trap-gates

Conversation

@zzal

@zzal zzal commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Audit backlog B5 + B6 (Part-3/Part-6 Mediums).

Ground truth: canImport(JavaScriptKit) is true on host, and JavaScriptKit's host stub is a bare abort() — the first JSObject.global access dies with no message.

  • Dropdown/Tabs rove (B5): the keyboard-rove JS crossings claimed "(a no-op on host)" but compiled on host — one keydown host test away from a messageless SIGABRT (Tabs aborted after mutating selection). Now arch(wasm32)-keyed; the pure decision + Tabs' selection move stay host-side. New TabsRovingTests drives the full keydown path in the harness (ArrowRight/Left wrap, Home/End, non-roving keys) — a suite that could not exist before the gate.
  • BrowserNavigator (B5): its accessor fatalErrors promise "host tests must inject a Navigator" but can never print on host (the abort fires inside the swjs stub first). The named failure moves to init under #if !arch(wasm32), so constructing RouterRoot via its public inits on host now says why it died.
  • TaskDiffTests (B6): held _swiflowDiagnosticOverride across await drain() with no cross-target lock — restore moved before the await (the diagnostic fires synchronously), closing the parallel-suite LIFO-restore race.

Whole-package swift test: 1906 tests, 353 suites, green. SwiflowUIDemo + MiniRouter wasm builds pass locally (CI skips examples).

🤖 Generated with Claude Code

…vigator fails loud at construction

canImport(JavaScriptKit) is true on host, and JavaScriptKit's host stub
aborts with no message on the first JSObject.global access. Three
consequences fixed:

- Dropdown/Tabs keyboard-rove blocks claimed '(a no-op on host)' but
  compiled their JS crossing into host builds — any host keydown test
  died in a messageless SIGABRT. The crossing is now arch(wasm32)-keyed;
  the pure roving decision and Tabs' selection move stay host-side, now
  covered by a live harness suite (previously impossible to write).
- BrowserNavigator's accessor fatalErrors ('host tests must inject a
  Navigator') could never print on host — the abort fired first. The
  named failure now happens at construction, where it still reaches the
  terminal.
- TaskDiffTests held _swiflowDiagnosticOverride across an await,
  racing the LIFO restore against parallel suites (the lock guarding
  this is target-local to SwiflowQueryTests). The diagnostic fires
  synchronously, so the restore moves before the await.

Whole-package swift test: 1906 green. SwiflowUIDemo + MiniRouter wasm
builds verified locally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📦 Bundle size

Artifact Baseline This PR Δ
App.wasm 5.06 MB 5.23 MB +3.45%
App.wasm (gzip) 1.80 MB 1.87 MB +3.56%
JS runtime 54.5 KB 54.5 KB +0.00%
JS runtime (gzip) 11.3 KB 11.3 KB +0.00%
Total (gzip) 1.81 MB 1.88 MB +3.54%

✅ Within budget (≤5% growth allowed).

Baseline: Swift 6.3, WASM SDK 6.3-RELEASE, measured 2026-06-18.

@zzal
zzal merged commit 6124a96 into main Jul 20, 2026
6 checks passed
@zzal
zzal deleted the fix/host-trap-gates branch July 20, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant