Repository navigation
arisrv: bound reads, a read scope per principal (S6) - #1147
Merged
Merged
Conversation
A service's read_scope hook (ARIADNE_SCRIPTING_HOSTS.md 6.5.6) names the path prefixes each
principal reads, and the relay sends each of that principal's connections only that part of the
tree: its bootstrap, its live stream, snapshot replies, the WS broadcasts, and the pushes and
messages it targets at it, on both planes. host.refresh_scope re-asks the hook, and each
connection is sent a delete of what it can no longer read and a snapshot of what it newly can.
- state_transport::set_read_scope and refresh_read_scope (gRPC, WS). A scoped connection is held
for its bootstrap until its Hello sets its scope; the scope joins the peer's delivery_view and is
checked under the connection's write lock on every tree write. A delete or reset above a
readable path still reaches it (delivers_below). state_prefix_filter is the prefix scope.
- A retraction is a delete_subtree from the origin <shard>#scope, sequenced by the shard clock, so
a client's seen-set never takes it for a journal entry.
- state_sync_adapter applies delete_subtree (it ignored the op, which nothing sent), and its
childChanged slot no longer makes a removed child again: a node made on the way to another came
back empty after a delete, a local (state-delete) included.
- room_read_scope: a participant always reads its own subtree, where its calls' replies land, and
the room's nodes above it.
- arisrvx: @host.read_scope and host.refresh_scope. The authenticate event hands the relay the
principal's prefixes before its verdict (ServerLink::set_scope); a refresh is applied on the
relay's next step. read_scope without authenticate fails the start, and arisrvx check says so.
- relay_pair.py checks --expect under --client-only too.
Tests: StateSyncAdapterTest.ARemoteDeleteTakesTheSubtreeOut, StatePrefixFilterTest,
StatePeerRegistryTest.AScopedViewDeniesWhatItsScopeDoes, StateReadScopeTest.*,
StateTransportGrpcTest/StateTransportWsTest.AReadScopeBoundsWhatAPrincipalReads,
RoomCallsTest.AReadScopeKeepsTheParticipantsOwnSubtree, arisrvx_read_scope{,_ws}.
Picks up #1146, which builds ocean_sea_test without FMA contraction: OceanSea.IsTheSameOnEveryPlatform failed every macOS job here, as it did on master.
transfix
added a commit
that referenced
this pull request
Nov 12, 2026
Only state_sync_adapter.cpp conflicted, two places where both sides added next to each other. Master's #1147 added drop_subtree and apply_remote's delete_subtree branch; this branch had added comments on the adapter's raw, creating lookups. Both are kept, master's code first. The connect_node comment now also says the childChanged slot's new removal check is a findDescendant, which makes nothing but holds nothing either. Master's #1159 adds a function-local thread_local memo in sea_surface::source (src/cvc/ocean/sea_surface.cpp). It is not on the allowlist, and #1159's release-grpc scan was cancelled, so the scan may flag it here. It is master's code, left unchanged; a fix on master is proposed separately.
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
…t (S7) (#1177) pycvc.ariadne.testing.ServerHarness (ARIADNE_SCRIPTING_HOSTS.md 6.5.8) plays arisrvx for a service's tests under plain python, with no relay and no network. It drives arisrvx's own dispatch, _Program, on host.loop with an in-process link in place of the relay, so the authenticate hook, the read_scope hook, the role gates, ctx, the timeouts, CallError and the per-principal limits are the same code a relay runs. - connect(bearer) asks the authenticate hook (Refused when the relay would refuse), or client(principal). A client's call, call_with (room-call-opts), acall and acall_with return the value or raise CallError with the client's code; progress[name] holds the latest call's steps. Values cross through pycvc's capsules, as the wire carries them. - get, get_tree and reads show what the relay would send the client: publish= namespaces, bounded by its principal's read scope, which host.refresh_scope updates. host.disconnect closes the principal's clients. - pycvc.ariadne.testing is registered by the module itself (one file). - The end-to-end ctest arisrvx_echo_service: tests/echo_service.py (an HTTP route and an export over one function, a fixed-token authenticate hook, the published echo subtree, a read scope of echo.public) against tests/echo_client.ari, which joins, calls the export, checks its reply and progress, reads what it wrote, is not sent echo.private, and fetches the route. relay_pair.py --client-net-asgi allows the origin the program serves on. - Roadmap: S6 is done (#1147), S7 built; ARIADNE.md 9.8.6. Tests: pycvc_ariadne_harness, arisrvx_echo_service. Also in this PR: - test_pycvc_ariadne_harness: skip the HTTP half when starlette's TestClient cannot load - arisrvx harness test: skip the HTTP half without httpx; CI installs it
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.
S6 of the scripting-hosts roadmap (docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md §6.5.6): bound reads. With S5's authenticate hook, a service can now say what each principal reads, and the relay sends each connection only that part of the tree.
What it adds
state_transport::set_read_scope,refresh_read_scope, on gRPC and WS).state_delivery_filterfor the connection admitted as a principal that identified (Hello) as a node id. A newstate_prefix_filtercovers the prefix case.delivery_view::scope). The admit snapshot, snapshot replies and the WS broadcasts take it from there.delivers_below), so a client never keeps data the relay removed.refresh_read_scope(principal)swaps the scope of each of that principal's connections, then sends it:<shard>#scope, with the shard clock's time as its sequence. So a client's seen-set never mistakes it for a journal entry, even after the relay restarts.state_sync_adapter.delete_subtreenow. It used to ignore the op, which nothing sent. The relay's inbound gate still admits onlyset_value,touchandset_datafrom clients, so a delete only ever comes from a relay.childChangedslot re-made a removed child that had no observer of its own (a node made on the way to another). So a deleted subtree came back empty, a local(state-delete …)included. A child that is gone is no longer re-made, and its observers are dropped, so a node made at that path later is observed afresh.room_read_scope(prefixes, room, pid)always adds the participant's own subtree, where its calls' replies land, and the room's nodes above it (a join waits for the room's node).@host.read_scopeandhost.refresh_scope(principal_id).ServerLink::set_scope), so they are in place as it admits the connection.read_scopebut noauthenticatefails to start, andarisrvx checkreports it.--expectagainst the relay's output under--client-onlytoo.Tests
StateSyncAdapterTest.ARemoteDeleteTakesTheSubtreeOut;StatePrefixFilterTest.DeliversItsPrefixesAndExactPathsOnly;StatePeerRegistryTest.AScopedViewDeniesWhatItsScopeDoes;StateReadScopeTest.AChangeRetractsRootsKeepsAncestorsAndGrantsand.ASubtreeOpAboveAReadablePathIsDelivered;RoomCallsTest.AReadScopeKeepsTheParticipantsOwnSubtree.StateTransportGrpcTest.AReadScopeBoundsWhatAPrincipalReadsandStateTransportWsTest.AReadScopeBoundsWhatAPrincipalReads. Each checks that:arisrvx_read_scope(gRPC) andarisrvx_read_scope_wsruntests/scope_service.pyagainsttests/scope_user.ari. Bob readssvc.publicand his project. Then:Run locally on Windows (static Release, gRPC + WS, pycvc core, wasmtime from cvcpkg):
state_sync_adapter_test: 11 passed, 2 skipped (the optional stress and perf cases);state_peer_registry_test: 21;state_transport_grpc_test: 54 passed, 3 skipped;state_transport_ws_test: 44;room_relay_integration_test: 22;ariadne_host_test: 57.-j 3.cvc,ariandarigl(the stacked PRs before this one showed why: that job runs only on PRs into master).Not in this PR
ServerHarnessand the end-to-end CI test (S7); the read-scope part of S7's test can now be written.