feat(web): fence dart:ffi behind web stubs so the WASM build compiles (T-438, D-100)
`flutter build web --wasm` had been broken since the tree-sitter/PTY dart:ffi pivot. Per D-100 (resolving Q-50: keep the web "happy accident" alive), every native binding now sits behind a `dart.library.ffi` conditional import with a graceful web stub. Desktop builds are unchanged — no fidelity loss; the web target degrades (no terminal, native git, or syntax highlighting). Discriminator is `dart.library.ffi`, not `dart.library.io` — dart2wasm provides dart:io, so FFI is the only blocker. Fences: - PTY: pty_session → pty_backend_io / pty_backend_web (stub throws). - tree-sitter: pure types → syntax_result.dart; tree_sitter_service is now a facade over _ffi/_stub; tree_sitter_boot_io/stub fences TreeSitterLib.init(). - watchdog: watchdog_windows_stub (all -1 sampler). - claude ABI probe: native_abi_io/stub (was `dart:ffi show Abi`). - testmode fd-check: fd_check_io/stub. Also dart2js-safe: the 64-bit FNV literals in session_naming.dart + paths.dart (the dual JS fallback rejected them) — split into 32-bit halves, dropped a no-op 64-bit mask. Desktop/wasm hash values unchanged. CI: added a `web-wasm` job (flutter build web --wasm) so the fence can't rot. Two FFI-constructing tree-sitter tests import _ffi.dart directly (the analyzer resolves the conditional facade to the stub branch). Verified: `flutter build web --wasm` → built; `flutter analyze` clean; `make test` green. Full Playwright e2e harness wiring is the tracked follow-on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,13 +114,21 @@ jobs:
|
||||
path: ${{ github.workspace }}/clide-logs
|
||||
if-no-files-found: ignore
|
||||
|
||||
# The web-WASM Playwright job is withheld: `flutter build web --wasm` cannot
|
||||
# compile the tree since the tree-sitter/PTY dart:ffi pivot (dart:ffi is
|
||||
# unavailable on the wasm target). Whether the web target gets conditional-
|
||||
# import fences or is dropped is an open question — see Q-50 in
|
||||
# governance/questions/architecture.md. Re-add the job (setup-node, npm
|
||||
# install + playwright install in tools/ui, `make test-e2e`) when Q-50
|
||||
# resolves toward keeping it.
|
||||
web-wasm:
|
||||
name: web build (wasm compile gate)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: subosito/flutter-action@v2
|
||||
with: { channel: stable, cache: true }
|
||||
- run: flutter pub get
|
||||
# Compile gate for the dart:ffi web fence (D-100 / T-438, resolving Q-50):
|
||||
# every native binding lives behind a `dart.library.ffi` conditional import
|
||||
# with a web stub. If a new one lands without its stub, this fails — the
|
||||
# fence can't silently rot. Build-only for now; the full web-WASM Playwright
|
||||
# e2e (`make test-e2e`: setup-node + playwright install in tools/ui +
|
||||
# serve) is the follow-on once the harness is wired back up.
|
||||
- run: flutter build web --wasm
|
||||
|
||||
docs:
|
||||
name: dart doc (lib API)
|
||||
|
||||
Reference in New Issue
Block a user