Repository navigation
arisrv: server documents (--doc) and server: publish: namespaces (S0) - #1046
Merged
Merged
Conversation
`arisrv --doc server.ari` runs a document on the relay: a headless AppRuntime over the relay's app (cvc::ariadne::ServerDocument), for room rules, bots and checks in the DSL. It binds under ui.docs.arisrv, which the relay never sends, and reads the room through a read-only `room` hole. Its server: block's publish: list names namespaces every client is sent and only the server writes. ARIADNE_SCRIPTING_HOSTS.md S0 (§6.1, §6.5.3); the reference is ARIADNE.md §9.7. - arisrv reads the server: block before it listens (a bad one exits 2), loads the document once the room is seeded, and pumps it every room step ahead of the holon, with the holon's world clock at sim.tick / sim.time. (quit [code]) is arisrv's exit status; a failed load exits 1. A document that publishes needs --bind-writes on, which refuses client writes there. - Each published namespace is a writable hole of the same name in the document's chroot. - state_cluster_shard gets an outbound scope (add_publish_prefix): drain_local, replay_local and snapshot() send only what is under it, and the publish cursor moves past what is held back. arisrv scopes its whole-tree shard to conf plus the published namespaces, and the area of interest subscribes each participant to the same prefixes. - The sync adapter journals a node's content when a local write first shows it the node, so the first write to a fresh node replicates (it was lost: valueChanged fired before the lazy attach). A DSL program cannot touch() first as set_replicated does. - state-set-tree follows a writable link on every hop, as state-set does, so it can replace a published subtree. - The parsed scene: is kept on the runtime for the world runtime, with a warning that its physics is not simulated (ARIADNE_WORLDS.md §14). Other hosts ignore a server: block with a warning. Tests: ServerBlockTest, ServerDocumentTest, StatePublishScopeTest, RoomRelayLoopbackTest.ServerDocumentPublishesItsNamespaceOnly, adapter and state-set-tree cases, and the arisrv_doc_* and ari_server_block_ignored ctests.
The sync adapter now journals a fresh node's first write, so a test that wrote a throwaway
value first ("set twice") sends two frames where it waited for one, and could check before
the second landed (StateTransportGrpcTest.ThreeEndpointFanOut, TwoEndpointConvergence,
RoundTripSuppressedByDedup and StateTransportGrpcReconnectTest.StopRestartReconnect failed that
way on Windows). Each such pair loses its warm-up write and keeps the frame counts it had,
and the comments that explained the old loss go.
…, and a rev-order test - requires: [relay] holds in a relay's server document only (Runtime::set_relay_document, set by ServerDocument). Elsewhere a load fails with a hint that such a document runs on the relay (arisrv --doc). It is outside server.* and conference.world, so a world token can build on it. - A server: publish: entry that is, holds or lies inside the document's own prefix is refused, whatever prefix the runtime binds under. - RoomRelayLoopbackTest.ServerDocumentPublishesItsNamespaceOnly also writes a revisioned section by hand each step (echo.board's fields, then its rev last), and checks that a client never sees a rev before that revision's fields. The test also checks that the world clock the document copies (sim.tick) never goes back. - ari ctests: ari_server_document_needs_relay, and ari_server_block_ignored on its own document.
ARIADNE.md §9.7 and the scripting-hosts roadmap's §6.1 / §6.5.3: - the startup order, with --set before the seeds and the document (WD0 moves it last); - on_tick once per room step, with sim.tick as the world clock; - requires: [relay], and the rev-last order a live view relies on; - where S0 departs from §6.5.3's text: an outbound scope, not ingest interest; - one write path for the namespaces and, later, WD1's sections; - this runtime is the one the world will run in headless. ARIADNE_WORLDS.md: the §1 row, WD1's S0 dependency as met, the first-cut paragraph, the relay token under conference.world, and Q2 as S0 builds it.
…as built RoomRelayLoopbackTest.ServerDocumentPublishesItsNamespaceOnly checks the rev-last order for the late joiner as well: from its admit snapshot and the live frames after it, it never sees echo.board.rev before that revision's fields. ARIADNE_WORLDS.md's "Documents on the server" row says the parsed scene: is kept on ServerDocument::scene(), and points at §14's headless world runtime.
… warm-up write It wrote a throwaway "seed" before its 32 values, which the sync adapter now journals too (a fresh node's first write), so B received 33 mutations where the test counts exactly 32. v0 is now the first write and is journaled, so the count is 32 again.
This was referenced Nov 8, 2026
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.
Phase S0 of the scripting-hosts roadmap (
docs/roadmap/ARIADNE_SCRIPTING_HOSTS.md§6.1, §6.5.3, §10). It is the first step of the application-services cut that cy-pca/cyprov needs: S0 -> S1 (arisrvx) -> S2 + S5 -> S7. The reference is the new ARIADNE.md §9.7.What it does
arisrv --doc server.ariruns a document on the relay. It is a headlessAppRuntimeover the relay's own app (cvc::ariadne::ServerDocument,inc/cvc/ariadne/server_document.h), for room rules, bots and checks written in the DSL.In arisrv
server:block before it listens on anything. A document that doesn't parse, or a bad block, exits 2.init:runs then. A failed load exits 1.sim.tickandsim.time.(quit [code])stops the relay with that exit status.--setis where it was: before the seeds and the document.requires: [relay]holds only in a server document. On another host the load fails and says it runs on the relay (arisrv --doc).The document's chroot
ui.docs.arisrv, which the relay never sends.cyprovthere is the tree'scyprov.roomis a read-only link onconf.rooms.<room>.conf,ui,ariadne,state_execorroom. No two may overlap, and none may overlap the document's own prefix.What the relay sends
state_cluster_shardhas an outbound scope (add_publish_prefix).drain_local,replay_localandsnapshot()keep only what is under it, so live writes, backfill, the admit snapshot and the WS re-broadcast all follow it. The publish cursor moves past what is held back, so a trim erases that too.confplus the published namespaces, with or without a document. Clients took nothing else before, since their interest isconf.confalone.Client writes. Bound writes already refuse a client's write outside its own participant. A document that publishes therefore needs
--bind-writes on, and arisrv refuses to start without it.Clients are all sent the published subtrees. They still apply only
confuntil S2'srelay: subscribe:adds the namespace to their interest.The scene. A
scene:isn't run on the relay yet. Its parse, physics and bodies included, is kept on the runtime (ServerDocument::scene()) for the world runtime that will make it the holon's one physics world (ARIADNE_WORLDS.md §14). The load warns that its physics isn't simulated. Other hosts ignore aserver:block, with a warning.Two core fixes it needed
state_sync_adapterattaches to a new node lazily, when an ancestor'schildChangednames it. That comes after the node's ownvalueChanged, so the first value was lost. C++ writers worked around it withtouch()first (set_replicated), and tests wrote everything twice. A DSL program can do neither, so the first(state-set "cyprov.jobs.42.status" ...)would have reached WS clients only on the next re-broadcast, and gRPC clients never. The adapter now journals a node's content (value, anddata()with a codec) when a local write first shows it the node. A remote apply is still suppressed, and a node without content (made on the way to another, or touched) journals nothing.state-set-treefollowed a link only at the last hop. So(state-set-tree "cyprov.jobs" ...)wrote the hole's own children, unpublished. It now walks through writable links on every hop, asstate-setdoes, so it can replace (and prune) a published subtree.state-deleteandstate-watchstill act on the physical path (ARIADNE.md §7.4). ARIADNE.md §7.4's list now namesstate-set-tree.Coordination with the worlds plan (ARIADNE_WORLDS.md, #1041 and #1043)
WD1 rides S0, so S0 is built for both uses of one
--doc: cyprov's service document and a world document. #1043 merged while this was open, so master is merged in, and both texts are the same.scene:(physics and bodies included) is kept for the world runtime (L0, then WD2) to attach to, as the holon's only physics world. S0 builds no physics of its own.ui.docs.arisrv(worlds Q2, settled as proposed).conf.rooms.<room>.*later, since those are already in the scope.revlast, arrive in that order;RoomRelayLoopbackTest.ServerDocumentPublishesItsNamespaceOnlypins it. So WD1's revisioned-section writer (in core, for L0 to share) is sugar over what the DSL can already do. It isn't built here.on_tickruns once per room step (60 Hz, the room-rules cadence).sim.tickis the holon's world clock (120 Hz, never backwards), so a future activation tick is a futuresim.tick.ServerDocument(app, room, prefix)makes one runtime per room under its own prefix (RM1, RM2).relaytoken stays clear ofconference.world,cvc://worlds/*and theserver.*feature tokens, andconference.worldcan build on it.For Joe, where S0 settles something differently from the text:
init:'s writes, live. Making acceptance wait would mean reordering arisrv's startup, which I left alone.relay.Tests
ServerBlockTest(2) andServerDocumentTest(8), in the newariadne_server_document_test:state-set-treepruning;(quit 3);relaytoken on and off the relay.StatePublishScopeTest(4): drain, capped drain, replay and snapshot under the scope.RoomRelayLoopbackTest.ServerDocumentPublishesItsNamespaceOnly: a relay assembled as arisrv assembles it, with the area of interest on.echolive and a late joiner gets it from its admit snapshot; one that doesn't subscribe is sent it and filters it.ui.docs.arisrv, and its write toechois refused.echo.board.revbefore that revision's fields. That holds live, and for a late joiner from its admit snapshot onward. The world clock the document copies never goes back.state-set-treecases instate_sync_adapter_testandstate_exec_intrinsics_test.arisrv_doc_echo,arisrv_doc_quit_code,arisrv_doc_publish_conf,arisrv_doc_needs_bound_writes(arisrv on loopback ports, throughtests/run_arisrv.cmake, which checks exit status and output),ari_server_block_ignoredandari_server_document_needs_relay.Locally, on a Windows static Release tree (gRPC + WS, tests on), ctest run as CI runs it (same exclusions,
--repeat until-pass:3):The Linux-only IPC tests (
state_transport_ipc_test,state_multiprocess_ipc_test,state_reconnect_resilience_test) lost the same warm-up lines but weren't built here, so CI is their first run.Not in S0
--net, andon_signal:for arisrv's own signals.Both roadmaps are updated:
relaytoken underconference.world, and Q2 as built.