Repository navigation
ariglx-web: the threaded build (wasm-mt), cross-origin isolated (W3) - #1200
Merged
Merged
Conversation
#1159 (O7c) kept the last source sea_surface found in a thread_local, so the velocity a fluid field reads after a cell's height at the same point and time did not invert the sideways move again. A thread_local that keeps state between calls is a static cache, which libcvc's no-singletons rule forbids (VOLROVER-LIBRARY-PORTS-ROADMAP.md 1.3, tools/singleton_scan). #1159's release-grpc job, where the scan runs, was cancelled, so the scan never judged it; the next PR that merges master would fail that lane on it. The memo now belongs to the caller: - sea_surface::source_memo, and height() / velocity() overloads that take one. The plain reads share nothing. - fluid_surface::height_with / velocity_with and a surface_memo the caller owns; the defaults ignore it. ocean_surface passes it to the sea. - field_set::apply keeps one memo per cell, for the cell's height and its velocity at the same clipped centre. The memo is keyed on the point, the time and the digest as before, so every value is unchanged.
ariglx-web gets a wasm-mt leg, the lean tier, built as arigl-web's wasm-mt is: -pthread, mimalloc, and no WebSocket transport, since libopus has no -pthread build. It needs no pycvc-gl-cp312 package: the module compiles pycvc and pycvc_gl in its own tree, and python312 3.12.10+cvc.25 and numpy-cp312 2.4.6+cvc.6 are on the catalog for wasm-mt. - recipe.yaml: a wasm-mt matrix entry; the description says the threaded page must be cross-origin isolated. cvc_revision stays 1 (never published). - build-wasm.sh: CVC_PLATFORM wasm or wasm-mt sets CVC_WASM_PTHREADS, and the conference transport is looked for only single-threaded. The tier line and the sizes name the flavor. - src/arigl/CMakeLists.txt: ariglx links a pool of 8 workers on wasm-mt, where arigl has 4. Python's Thread.start() waits for its thread to run, and on the page's main thread a thread only runs on a worker the pool already has, since a new worker can't load while that thread waits. The shell holds one worker by init:, so a pool of 4 left room for 3 Python threads (a fourth hung the page) and 8 leaves 7 (measured: 7 ran, 8 hung). The wasm is byte-identical; only the JS glue's pool size changes, and startup didn't measurably change. Threads get the 8 MB STACK_SIZE (the default pthread stack follows it). - arigl_web_smoke.mjs: --isolated sends COOP, COEP and CORP on every response (files, configs, 404s), and every case must then find its page crossOriginIsolated. The CSP is unchanged. A DevTools call that runs on the page's main thread gives up when that thread is blocked: a read after 10 s, a --shots screenshot after 15 s (and no PNG is written). So a hung page fails its case on the timeout instead of holding the run, with --shots too. - threads.ari (wasm-mt only): four threading.Thread workers do numpy linalg and random at once and are joined, then a tick calls an is_async export, which must report it ran off the main thread. Called from init:, an async export runs inline, so the call is in the tick. - ci.yml: the ariglx-web job is a matrix over wasm and wasm-mt (fail-fast off, a concurrency group per leg), the wasm-mt smoke with --isolated. Each leg has its own path gate. The wasm leg keeps the job's old one: the shell, the engine, the bindings, the docset, the recipe, wasm_pyext.py and ci.yml. The wasm-mt leg's is narrower: src/arigl, src/ariadne_python, src/cvcGL/wasm, the recipe and wasm_pyext.py, so a bindings, docset or ci.yml edit alone builds the wasm leg only. The cost: every push and pull request now starts two ariglx-web jobs where it started one, and each takes a runner slot and a full-history checkout (about 40 s) just to skip. When its paths change, the wasm-mt leg builds and smokes for about as long as the wasm leg's 21-25 minutes, or a little more. Over master's last 40 commits its gate would have passed on 5, the wasm leg's on 14. - publish-cvcgl-wasm.yml: arigl-web's wasm-mt package is smoked --isolated as well, in place of checking its files only. - Roadmap §1, §5.4 (as built, with the numbers) and the §10 W3 row; CVCGL_WASM.md's ariglx-web section names both flavors, and its Testing paragraph gives --isolated and threads.ari; ARIADNE.md §9.6 and §11 no longer say ariglx-web is single-threaded only. Measured in headless Chrome against W1's single-threaded package in the same session (medians of three): ariglx.wasm 101.3 MB (27.5 MB gzip, 18.5 MB brotli) against 89.2 MB, the imports 4.31 s against 4.46 s, a 200000-step loop 88.0 ms against 80.0 ms. Left for later: a wasm-mt leg in publish-pycvc-gl-wasm.yml for the node-only pycvc_host package, the full tier (vtk-python-cp312 +cvc.8) on wasm-mt, and publishing ariglx-web. Tests: arigl_web_smoke.mjs --isolated --pydocs src/arigl/web/test/python on the local wasm-mt lean stage (10 of 10, threads.ari included; 10 of 10 with --shots, 10 PNGs). The same stage with its ariglx.js pool cut to 4, at the default 180 s timeout: threads.ari FAILs [timeout], "the page never reported its state", and the run reaches its summary, 1 of 10 failed, exit 1 (228 s); with --shots the same, plus "no screenshot" for that case and 9 PNGs (274 s). --isolated on the published arigl-web 3.7.13+cvc.1 wasm-mt (5 of 5; served without isolation 0 of 5, every page still loading at a 30 s timeout); arigl-web 3.7.13+cvc.1 wasm without --isolated (11 of 11); bash -n build-wasm.sh; node --check arigl_web_smoke.mjs; ci.yml parsed, and both legs' gates run over master's last 40 commits.
…ata scan passes
transfix
enabled auto-merge (squash)
November 13, 2026 03:54
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
The one conflict was arigl_web_smoke.mjs. Both sides are kept: - the /apps/up endpoint, with #1200's ISOLATION headers on its replies as on every response; - the settle probe reads out and isolated/sab; - each case runs its before/inject and #1200's isolation check. The headless-Chrome smoke passes 6/6 here, the picked-file upload included. Master since then: #1179, #1174, #1196, #1198, #1178, #1157, #1172, #1200.
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
#1200 (ariglx-web's threaded build) rewrote the end of the ariglx-web recipe's description, on the line where this branch renames the Host a program adopts. The description keeps #1200's wasm and wasm-mt sentence and says pycvc.ari.Host(). The wasm-mt build packs python312.zip the same way the wasm build does (cvc_ariadne_python_wasm_host), so it ships _pycvc_ari.py too.
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
…erf/threaded-s1b #925 starts ws-open's connect and ws-recv's wait where the transport does not block (the browser without threads), and their callbacks settle the call. Its start paths kept the async_host by reference and posted through it; here they take the host's finisher (host.make_finisher()) and settle_started through it, as http_work and uri_fetch_work do: the callbacks answer later, and an isolated document's group's host may be gone by then. - net_intrinsics.cpp: the conflict kept this branch's providers by kind; have_ws takes master's NetAccess::ws. The any provider's comment says a host's own WebSocket transport must be as thread-safe as the compiled backend. - ariadne_runtime_test: both sides' new L4 cases are kept, plus AStartedWebSocketCallKeepsTheHostItStartedOn, the WebSocket twin of AStartedRequestKeepsTheHostItStartedOn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Roadmap phase W3 of
docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md(§5.4, as-built note with the numbers, and the §10 W3 row): ariglx-web gets a threaded build (wasm-mt), served cross-origin isolated.What it adds
-pthread, mimalloc, and no WebSocket transport, since libopus has no-pthreadbuild. The description says the threaded page must be cross-origin isolated. It needs no pycvc-gl-cp312 package: the module compiles pycvc and pycvc_gl in its own tree, and python312 3.12.10+cvc.25 and numpy-cp312 2.4.6+cvc.6 are on the catalog for wasm-mt.cvc_revisionstays 1, since it was never published.CVC_PLATFORM=wasmorwasm-mtsetsCVC_WASM_PTHREADS. The conference transport is only looked for in the single-threaded build. The tier line and the size report name the flavor.Thread.start()waits until its thread is running. On the page's main thread, a thread can only run on a worker the pool already has, because a new worker can't load while the main thread waits. The shell holds one worker frominit:, so a pool of 4 left room for 3 Python threads (a fourth hung the page) and a pool of 8 leaves room for 7 (measured: 7 ran, 8 hung). The wasm is byte-identical; only the pool size in the JS glue changes, and startup time didn't measurably change. Threads get the 8 MBSTACK_SIZE.--isolatedsends COOP, COEP and CORP on every response (files, configs, 404s), and each case then checks that its page iscrossOriginIsolated. The CSP is unchanged. A DevTools call that runs on the page's main thread now gives up when that thread is blocked: a read after 10 s, a--shotsscreenshot after 15 s (no PNG is written). A hung page fails its case on the timeout instead of stalling the whole run, with--shotstoo.threading.Threadworkers run numpy linalg and random at the same time and are joined. Then a tick calls anis_asyncexport, which must report that it ran off the main thread. An async export called frominit:runs inline, which is why the call is in the tick.--isolated. Each leg has its own path gate (GATE_PATHSfrommatrix.paths). The wasm leg keeps the job's old gate. The wasm-mt leg's gate is narrower (src/arigl, src/ariadne_python, src/cvcGL/wasm, the recipe, wasm_pyext.py), so an edit that touches only bindings, the docset or ci.yml builds just the wasm leg. Over master's last 40 commits, the wasm-mt gate would have passed on 5 and the wasm gate on 14.--isolatedinstead of only having its files checked.--isolatedand threads.ari. ARIADNE.md §9.6 and §11 no longer say ariglx-web is single-threaded only.Measured in headless Chrome against W1's single-threaded package in the same session (medians of three): ariglx.wasm 101.3 MB (27.5 MB gzip, 18.5 MB brotli) against 89.2 MB; imports 4.31 s against 4.46 s; a 200000-step loop 88.0 ms against 80.0 ms.
How it was tested (Windows, sandipaws)
build-w3mt-web.bat: ninja had no work to do (BUILD_EXIT=0). The stage's ariglx.js, ariglx.wasm, python312.zip and arigl-web files have the same sha256 asbuild-w3mt-web/bin.smoke-w3mt.bat stage-w3mt-web --isolated --pydocs: 10 pass, 0 fail, threads.ari included (43 s; an earlier run took 38 s).smoke-w3mt.bat stage-w3mt-web --isolated --pydocs --shots: 10 pass, 0 fail, 10 PNGs written (72 s).stage-w3mt-web-pool4 --isolated --pydocs, default timeout): 9 pass, 1 fail, as expected. threads.ari FAILs [timeout] with "the page never reported its state"; the run still reaches its summary and exits 1 (228 s; an earlier run took 229 s).--shots: 9 pass, 1 fail, as expected, plus "no screenshot" for the hung case and 9 PNGs. The run reaches its summary and exits 1 (274 s).--isolated: 5 pass, 0 fail.--isolated,ARIGL_WEB_SMOKE_TIMEOUT_MS=30000: 0 pass, 5 fail, as expected. Every page is stuck at "loading" / "Starting…".node --check arigl_web_smoke.mjs: ok.bash -n build-wasm.sh: ok.-I): both include legs andGATE_PATHSresolve. I simulated each leg's gate shell logic over this branch (both legs run) and over master's last 40 commits (wasm 14, wasm-mt 5).git-clang-format --diff a5fbd479over CI's C/C++ globs (clang-format 18.1.8): "no modified files to format". The branch changes no C/C++.Left out
changesjob (withneeds:and a job-levelif, or a dynamic matrix), which would keep either leg from taking a runner slot when nothing changed. It would be new to ci.yml, and I couldn't run it without pushing. So both legs still start on every push and PR, only to skip: each skip costs a runner slot and a full-history checkout (about 40 s). The commit message and the job comment say so.-sPTHREAD_POOL_SIZE=4. The negative test uses a copy of the stage with only the JS glue's pool size patched (stage-w3mt-web-pool4.sh), which finding 5 lists as an acceptable route.Merging waits on Joe's review.