Skip to content

P0a: the action-intrinsic providers are each app's own; cvc::app::slot<T>() [4.0, breaking] - #1137

Merged
transfix merged 3 commits into
masterfrom
p0a/ariadne-registries
Nov 11, 2026
Merged

transfix merged 3 commits into
masterfrom
p0a/ariadne-registries

Conversation

@transfix

@transfix transfix commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

P0a step 2, first part (docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md §1.3, §7 P0a (2)). Breaking (4.0).

The bug it fixes (§1.3, bug 2, its action-intrinsic half)

Ariadne's action-intrinsic providers were one process-wide list. A provider registered for one app ran in every app's program lanes, and most providers capture their app (register_stream_intrinsics, register_room_intrinsics, register_net_intrinsics, the OIDC host, AppRuntime's verbs). So a second app's documents got verbs bound to the first app, and once that app was gone, they called into freed memory. Nothing in the library cleared the list, so hosts and tests had to call clear_action_intrinsics() before every app died. Each cvcGL runtime also appended its own copy of the stateless gl-bind-stream and media providers.

What moved

  • cvc::app::slot<T>() (new). The per-app home for the state of subsystems above core, so core needs no Ariadne or cvcGL types. Each app has one T, made on first use and destroyed with the app. T names its slot with static constexpr const char *app_slot. The key is a string because a type_info need not compare equal across shared libraries. The later parts of this step (widgets, blocks, decoders, node types and the rest) use it too.

  • The action-intrinsic providers are now the app's own list, in an app.slot table: register_action_intrinsics(app, provider) and clear_action_intrinsics(app). A provider goes with its app, so nothing has to clear the list before the app dies.

  • Keyed providers. register_action_intrinsics(app, key, provider) replaces the provider registered under key, in its place, instead of appending another copy. The providers registered once per app use keys:

    • register_stream_intrinsics;
    • register_room_intrinsics;
    • register_room_call_intrinsics, whose function-static list of apps already done (mu, done) is gone;
    • cvcGL's register_gl_stream_intrinsics(app) and register_media_intrinsics(app).

    A second AriRuntime on an app now keeps one copy of each.

  • The room-call client a host installs (room_call_client::install / for_app, from arisrvx: room-call, relay joins, TLS and a server document's python: (S2) #1122) is now the app's own, in an app.slot, so it goes with the app. ci: room_calls.cpp's process-wide objects on the writable-data scan's allowlist #1133 put the table and its mutex on the allowlist; this PR takes them off.

  • Room-call message ids were numbered by one process-wide counter (also on ci: room_calls.cpp's process-wide objects on the writable-data scan's allowlist #1133's lines). Each relay and client now numbers its own under a random tag. A plain per-object count would have repeated call-A-1 when a client joins again under the same pid, and the bus drops an id it has already seen from that origin.

Public API changes (the old forms are gone)

  • register_action_intrinsics(cvc::app &, ActionIntrinsicProvider) and register_action_intrinsics(cvc::app &, const std::string &key, ActionIntrinsicProvider).
  • clear_action_intrinsics(cvc::app &).
  • cvcGL: register_gl_stream_intrinsics(cvc::app &), register_media_intrinsics(cvc::app &).
  • cvc::app::slot<T>().

Callers updated in this PR: Ariadne's own providers (AppRuntime, stream, room, room calls, room media, net, OIDC), cvcGL (AriRuntime, bundles.cpp), the examples (nav_compute, ariadne_conference) and the tests. pycvc and pycvc_gl call none of these. The tests' clean-up guards that only cleared the list are gone. Two mid-test clears stay as clear_action_intrinsics(app): those tests enable the net again on the same app.

What the allowlist loses: 11 lines

Tests

ariadne_registries_test (new; later parts of this step add their registries' cases):

  • Two apps (ActionIntrinsicsAreEachAppsOwn): a provider registered on one app is bound there and not in the other's programs or has_function; clearing one app's list leaves the other's.
  • Gone with the app (AnAppsProvidersGoWithIt): a provider capturing an app is not reached from another app, nor from an app made after it is destroyed.
  • Keyed (AProviderUnderAKeyIsKeptOnce): three registrations under one key run the provider once per program env; re-registering replaces it in its place.
  • Order (ActionIntrinsicAnswersDoNotDependOnOrder): two apps registering and calling in either order, with and without a third app made and destroyed between, give the same answers.
  • Threads (AppsOnOtherThreadsKeepTheirOwnProviders): four apps registering and calling on four threads at once each get their own.
  • The room-call client (ARoomCallClientIsItsAppsOwn, AnInstalledRoomCallClientGoesWithItsApp): installed in either order, each app finds its own; clearing one leaves the other; an app's client is released with the app.

room_relay_integration_test's room-call case adds a client made again under the same pid, whose call must still be answered. It runs on the gRPC/WS lanes only, so it was not run locally.

app_test adds AppSlot.*: one object per app, made on first use and destroyed with the app; a slot constructor that asks for another slot; eight threads asking at once get one object.

Locally (Windows, MSVC 2022, Release, cvcGL + pycvc + examples, on master d30f7bd): the whole tree builds. ariadne_registries_test 7/7, app_test 121, ariadne_requires_test 18, ariadne_runtime_test 262, ariadne_media_test 55, room_avatar_test 9 and room_chat_test 14 pass, as do the cvcgl_media_*, cvcgl_stream_bind and cvcgl_ariadne_realize tests. (ariadne_ftxui_test has no cases in this build: no FTXUI here.)

The rest of this step: the split

One PR per group, in §7's order. Each adds its cases to ariadne_registries_test and drops its lines from the allowlist.

  1. This PR: app.slot<T>() and the action intrinsics.
  2. Ariadne's document registries: widget types, .ari blocks (loader.cpp, and the register_world_block / register_server_block once-flags), data decoders, script engines.
  3. cvcGL's scene node types and shader presets (scene_realize.cpp).
  4. The media player factory and play policy.
  5. The net and OIDC hosts, cvc::net's HTTP client, the URL opener and notice, and the browser hooks and disabled flag.
  6. cvcGL's ImGui font settings and VTK mapper policies, and state_exec's threaded-host flag.
  7. On its own: the URI schemes, the resolver byte caps and the HTTP options provider, with resolve() / resolve_async() / resolve_to_file() taking the app.

…t<T>()

Ariadne's action-intrinsic providers were one process-wide list: a provider
registered for one app (most capture their app) ran in every app's program
lanes, and called into a destroyed app once it was gone. They are now the
app's own list, kept in a new per-app slot (cvc::app::slot<T>(), keyed by a
string so it matches across shared libraries), and go with the app.

register_action_intrinsics and clear_action_intrinsics take the app. A
keyed form replaces the provider registered under its key instead of
appending another: the stream, room and room-call providers and cvcGL's
gl-bind-stream and media providers use it, so a second runtime on an app
keeps one copy, and room_calls' function-static list of apps is gone.

ariadne_registries_test: two apps, a provider gone with its app, keyed
providers, order, apps on threads. app_test: AppSlot. The allowlist loses
ariadne.cpp's four action_intrinsics lines.
…lay and client

The writable-data scan flagged three statics #1122 added in room_calls.cpp:
- the table of installed clients (clients()::c and its mutex) is now an
  app.slot, so an app's client goes with it;
- the process-wide message counter (g_messages) is now each relay's and
  client's own, under a random tag, so a client made again under the same
  pid, or a second relay on a shard, repeats no id the bus has seen.

Tests: ariadne_registries_test adds the two-apps (both orders) and
gone-with-the-app cases; the room-call loopback test adds a client made
again under the same pid.
# Conflicts:
#	tools/singleton_scan/allowlist.txt
@transfix
transfix merged commit cecaad3 into master Nov 11, 2026
33 of 35 checks passed
@transfix
transfix deleted the p0a/ariadne-registries branch November 11, 2026 20:31
transfix added a commit that referenced this pull request Nov 11, 2026
Master's #1137 makes the action-intrinsic providers each app's own (an
app.slot table, with a keyed form that replaces in place), and this branch
gives each provider a kind (any / host_proxied / host_only). Both are kept:

- ariadne.h: register_action_intrinsics takes the app, with or without a key,
  and with or without a kind; the forms without a kind register host_only.
- ariadne.cpp: the app's table holds this branch's registered_provider (key,
  provider, kind). install_providers, the placement generation and
  host_only_bindings read the app's table. A keyed registration replaces both
  the provider and its kind.
- The stream (any) and room (host_proxied) providers keep their kinds under
  master's keys. net, AppRuntime's seven providers, nav_compute and the tests
  pass the app.
- Tests: the guards that cleared the process-wide list (isolated_providers_
  cleared, StreamActionGuard, ari_providers_reset) are gone, since each test's
  providers now go with its app; use_host_in_contexts and register_thread_probe
  take the app. Master's job_intrinsics_test (#1113) still called the
  pre-#1137 forms, which do not compile at master's head; it passes the app.
- ci.yml's sanitizer list keeps both sides' tests. The allowlist is the
  three-way merge of both sides (802 lines, cvc 453), rendered by scan.py:
  #1137 dropped the registry's and room_calls.cpp's statics.
- Docs name the app-taking forms.
transfix added a commit that referenced this pull request Nov 12, 2026
#1137 made the action-intrinsic providers each app's own
(register_action_intrinsics(app, ...), clear_action_intrinsics(app)), and
#1113, merged just before it, added job_intrinsics_test with the
process-wide calls, so master's tests no longer build.
transfix added a commit that referenced this pull request Nov 12, 2026
Only job_intrinsics_test.cpp conflicted. Master's #1150 fixed the same
pre-#1137 calls this branch fixed in 600c144, but kept a ProviderGuard that
clears the app's providers on the way out; this takes master's version, so the
file matches master.

The rest merged cleanly: #1151's spawn points (world_spawns.cpp, the world
rules' spawns, the loader and scene-world tests), #1145's macOS libcurl with
WebSockets (CMake and a ci.yml configure assertion), #1148's wasmtime in the
arix and ariglx recipes, and #1149's ocean band. None of them registers an
action-intrinsic provider, and none adds writable process-wide state: their
only new statics are vehicle_view.cpp's constant colour tables.
transfix added a commit that referenced this pull request Nov 15, 2026
P0a's breaking changes (#1119, #1137) are on master, and v3.7.13 was the last 3.x release, so
the next release is 4.0.0. CMakeLists.txt and every cvcpkg recipe's upstream_version move to
4.0.0 (cvc_revision is already 1 everywhere).

cvcGL's SOVERSION follows the major version, as libcvc's does: libcvcGL.so.4 beside
libcvc.so.4. It was hardcoded to 3, which would have let a 4.x cvcGL load where a 3.x one was
linked.
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