Skip to content

arigl joins a relay from a document's relay: block and --relay, in a browser page too - #1231

Merged
transfix merged 2 commits into
masterfrom
feat/arigl-relay-block
Nov 14, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/arigl-relay-block

Conversation

@transfix

Copy link
Copy Markdown
Owner

What

Stock arigl (in a window and --terminal), ariglx and arigl-web now join a relay from a document's relay: block and the --relay* flags, as ari and arix already do. A graphics client can then:

  • mirror the namespaces a server document publishes (relay: subscribe:);
  • present --relay-credential NAME, an OIDC sign-in's token (token: oidc:NAME);
  • call the server's functions with room-call.

Until now arigl joined only in conference mode (CVC_ARIADNE_RELAY). That shard applies conf alone, so a graphics client never received a published namespace, and it had no way to present a credential. CVC_ARIADNE_RELAY still wins when it is set: the block is then read and not joined, and --relay is ignored with a note.

How

  • attach_host_relay (relay_session.h): the join a host's flags ask for, moved out of ari's main.cpp unchanged, so ari and arigl share one helper.
  • In a browser page (__EMSCRIPTEN__):
    • The page's WebSocket dials ws:// and wss://; TLS is the browser's.
    • The socket opens from the page's event loop, which nothing may block. So the dial opens it and the frames look for the relay's Hello, with a 10 s deadline.
    • Every join in a page is therefore begun at the load, a token's too. A relay it can't reach shows in relay.status; the load does not fail.
    • The stock page needs no change. Its config's "flags": ["--relay", "{ws_origin}/<path>"] names the relay, and "fragment_env": {"token": "CVC_ARIADNE_ROOM_TOKEN"} carries a room token.
  • Native behaviour is unchanged. A token join waits at the load, a credential join is begun, and reconnects back off as before.

Tests

  • arisrvx_room_call_arigl_grpc and arisrvx_room_call_arigl_ws: arigl snapshot of the new src/arisrv/tests/relay_arigl.ari against arisrvx running call_service.py and call_server.ari. The client:
    • waits for the published svc to be mirrored;
    • calls echo and checks that the value kept its type and that the caller is its own pid;
    • checks relay.status and relay.joins.
  • They need a GL context, so they live in src/arigl/CMakeLists.txt next to the other arigl window tests, and pycvc-linux (which has Xvfb) now builds arigl.
  • relay_pair.py takes --client-command (test stays the default; arigl has none, so it runs snapshot).

Run locally (Linux, cp312 from cvcpkg, Xvfb and mesa from cvcpkg): both new tests pass, and so does the scripting-host regex pycvc-linux runs. Two local failures were environmental:

  • ariglx_python_program: this build had no pycvc_gl.
  • arisrvx_startup_fails: it passes with PYTHONNOUSERSITE=1; without it, ~/.local's starlette leaked into the embedded interpreter.

The browser path (__EMSCRIPTEN__) is compiled in CI's wasm jobs; I did not run it in a page.

Docs

  • ARIADNE.md §9.8.3: every host joins; how a browser page joins; conference mode first.
  • ARIADNE_SCRIPTING_HOSTS.md §6.5.7: an as-built note.

…browser page too

Stock arigl (a window, --terminal), ariglx and arigl-web now take the relay: block and the
--relay* flags as ari does: they join the relay, mirror the namespaces the block subscribes to,
present --relay-credential (an OIDC sign-in's token), and reach the server's functions with
room-call. Until now they joined only in conference mode (CVC_ARIADNE_RELAY), whose shard applies
conf alone, so a graphics client never received a published namespace. CVC_ARIADNE_RELAY still
wins when it is set.

- attach_host_relay (relay_session.h): the join a host's flags ask for, moved out of ari's
  main so ari and arigl share it.
- In a browser page the page's WebSocket dials ws:// and wss://. Nothing there may wait for the
  socket, which the page's event loop opens: the dial opens it and the frames look for the
  relay's Hello (10 s), so every join in a page is begun at the load.
- arisrvx_room_call_arigl_grpc / _ws: arigl snapshot of tests/relay_arigl.ari against arisrvx
  (call_service.py): the mirror of svc, a typed room-call, relay.status. relay_pair.py takes
  --client-command; pycvc-linux builds arigl.
@transfix
transfix enabled auto-merge (squash) November 14, 2026 19:32
@transfix
transfix merged commit da3195e into master Nov 14, 2026
28 checks passed
@transfix
transfix deleted the feat/arigl-relay-block branch November 14, 2026 21:45
transfix added a commit that referenced this pull request Nov 15, 2026
Master's #1217 keeps nothing per thread in state_exec: a native's context (call_args::context())
carries its group, registry and stream, async_host::call and begin_external take it, and the pool
drops in_pump_all() and the one-argument run_on_host.

- async_host.h: begin_external takes the context, as on master, and keeps this branch's note that
  a call is finished through the host it was made on.
- script_engine.cpp: the sliced form finds the calling program's group from the call's context
  (exec_group::current(ctx)), else group 0, and reads its data step from the context.
- ariadne.cpp: file-pick opens its picker through run_on_host for the group its verbs were bound
  for (the env's, as its host is), and inline in group 0 and the init lane.
- exec_pool: in_pump_all() is back, for the host-thread calls' debug assertion and
  ScriptLane::run's refusal, read from the pool's calls (their callers' and pumpers' thread ids)
  under its mutex rather than from thread-locals.
- ariadne_runtime_test: the init lane's cycles test no longer compares against the calling
  thread's own registry, which master removed; it is AriadneInit.RunsAScriptThatLeavesCycles.
- ci.yml: the sanitizer's required list names the test by its new name.
- STATE_EXEC_THREADED.md: B29-B31 and the file-pick and sliced-call notes name the context-based
  calls.
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