Repository navigation
ariadne: --exec-policy, and pure exports on the read lane (G1, tenth part) - #1178
Merged
Merged
Conversation
…part)
G1's last part. A guest's priority: changed no pick under the stock
hosts, which build the app's scheduler round_robin before any document
loads and had no option to set state_exec.policy. And a reactive
expression (visible_when, a computed bind:) couldn't call a guest.
--exec-policy round_robin|priority|priority_rr is one of the general
flags, so ari, arigl and the x hosts take it. apply_exec_policy writes
state_exec.policy on the fresh app, before anything builds its scheduler.
Runtime::register_read_function adds a function to the read lane's
environment, beside its allowlist. It gets the lane's environment, so its
reads go through the lane's wrapped readers, and the expression's result
is kept until a path it read is written. A later registration replaces
it and drops the kept results.
ScriptLane::export_pure makes an activation such a function: its slices
run to the end inside the expression's eval, charged to the eval's steps,
with the eval's deadline checked between them. Its calls reach only the
read lane's environment (anything else is a PermissionError), a yield
goes straight on, and an await is a RuntimeError. ScriptSlice::may_wait()
is false there, so a wasm instance busy with another activation is a
RuntimeError at once rather than a wait. The wasm: block's export: takes
{name:, as:, pure: true}.
G1 is done.
transfix
enabled auto-merge (squash)
November 12, 2026 09:57
transfix
disabled auto-merge
November 12, 2026 09:59
#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.
…hread_local fails the singleton scan
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
# Conflicts: # docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md # src/cvc/tests/ariadne_wasm_test.cpp
transfix
added a commit
that referenced
this pull request
Nov 13, 2026
Conflicts: ari's and arigl's main, where #1178 adds --exec-policy's apply_exec_policy(app, o) and this branch adds setup_media(app, o), both right after the app is made. Both stay, the policy first ("before anything builds the scheduler").
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.
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.
G1, tenth and last part: a host option for the scheduler's policy, and pure exports on the read lane (roadmap §8.3, §8.5, §8.6). G1 is done.
The problem
state_exec.policy. So the policy was alwaysround_robin, and a guest'spriority:was stored but never changed which process ran next (risk 15).--set /state_exec.policy=...can't do it either: it's applied after the scheduler is built.visible_whenor a computedbind:can't call a guest's export. Roadmap §8.6 plannedpure: trueexports for that.The fix
--exec-policy round_robin|priority|priority_rr(host_cli.h):ari,arigl,arixandariglxall take it, validated at parse time.apply_exec_policywrites it to the app tree'sstate_exec.policy. Each host calls it right after making its app, before the scene graph,enable_netorregister_quitcan build the scheduler:ari test,ari run/check/snapshot, and arigl's window and terminal paths.round_robin.Runtime::register_read_function(name, fn):fngets the call's arguments and the lane's environment, and runs inline in the expression's eval, under that eval's step and time caps.ScriptLane::export_pure(name, make, options)makes an activation such a function:eval_deadline_check) is checked between slices.call_now()s andcall()s reach only the read lane's environment: the state readers, the allowlisted functions and other pure exports. A writer, a message or a host function is aPermissionError.RuntimeError.ScriptSlice::may_wait()is false there. So the wasm engine raisesRuntimeErrorat once for an instance busy with another activation, rather than spinning until the 5 ms cap.The
wasm:block:export:takes{name:, as:, pure: true}. The export stays a function of the document's programs too.Docs
ariadne.h,script_engine.h,host_cli.handwasm_engine.h.Tests
New:
ariadne_host_testAriadneHostCli.ExecPolicyIsTheSchedulersPolicy:--exec-policy priorityand=priority_rrreachapp.exec_scheduler().policy(), no flag keepsround_robin, andfifois a usage error.ariadne_runtime_testAriadneReactive.AReadFunctionsReadsKeepItsResult:visible_when;With the dropping of kept results taken out, this test fails.
ariadne_wasm_testWasmEngineTest.APureExportIsAFunctionOfTheReadLane: four guest exports markedpure, each a widget'svisible_when:get-xreads state through the lane;set-y's write is refused as aPermissionErrorand reported, and the state is untouched;nap's yields go straight on;echoreturns its arguments;get-x's kept result is reused untilxis written;Local, Windows static Release tree:
ariadne_wasm_test28/28,ariadne_script_engine_test30/30,ariadne_runtime_test263/263 andariadne_host_test58/58, three runs each.arix_wasm_blockandari_wasm_needs_arixctests.arix test --exec-policy priority src/ariadne_wasm/tests/wasm_block.aripasses,--exec-policy fifois refused with the usage, and--helplists it.Not tested: the busy-instance
RuntimeError, which takes an action parked mid-call while a frame renders. It's a plain throw where the wait would have been.After G1
The roadmap's next phases are G2 (the install-time transform and the browser backend), G4 (client guests on arisrvx) and G6 (WASI on arisrvx).