Skip to content

arisrvx: each client's limits for its programs and guests (ID4a), and arisrv reserved from publish: - #1296

Merged
transfix merged 7 commits into
masterfrom
feat/arisrv-client-limits
Nov 20, 2026
Merged

transfix merged 7 commits into
masterfrom
feat/arisrv-client-limits

Conversation

@transfix

@transfix transfix commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

ID4a of the identity plan (docs/roadmap/ARISRV_IDENTITY.md §2.6, drafted in the identity work): each client can get caps of its own for the programs (S3) and WebAssembly guests (G4) it runs on the relay. It builds on G4's first part (#1283, merged), and is rebased onto master since.

// arisrv's main(), from the client registry (the identity work, ID1)
doc.set_client_limits([&registry](const std::string &pid, ServerDocument::ClientKind kind,
                                  const ClientLimits &document) {
  ClientLimits caps = document;                 // the document's, as its server: block has them
  if (const auto *o = registry.limits(pid)) {
    if (o->memory_mb) caps.max_memory = o->memory_mb << 20;
    if (kind == ServerDocument::ClientKind::guest && !o->guests) caps.on = false;   // forbidden
  }
  return caps;                                  // may go above the document's, up to the lane's (D2)
});

The seam

  • ClientLimits (an alias of ClientPrograms: on, max_steps, max_time, max_memory), and ServerDocument::ClientKind { program, guest }. Python guests will add a third kind, so the struct needs no allow flags.
  • ServerDocument::set_client_limits(fn(pid, kind, document)). The function returns the whole caps that client's code of that kind runs under.
    • on false refuses the client that kind: forbidden, which the client sees as PermissionError.
    • 0 leaves the document's cap.
  • It is asked at each start, right after the pid check. So a change applies from the client's next program or guest, not to one already running. A held guest (its module still compiling) starts under the caps it was given. A function that throws refuses the start with unavailable.
  • Without a function, nothing changes: every client runs under client_programs: and client_guests:.

D2: up to the ceiling

The owner settled D2 as "Yes, up to ceiling". A client's limits replace the document's caps for that client: lower, or higher up to the action lane's (ariadne.limits.action_max_*), which hold over every process. A guest's memory stays under ariadne.limits.wasm_max_memory. So client_programs: and client_guests: are what every client gets, and an admin can give one client more or less. ServerDocument::kClientLimitsAboveDocument (now true) switches this, and the tests follow it.

arisrv reserved from publish:

arisrv joins publish:'s reserved roots (with conf, ui, ariadne, state_exec and room). So no server document can replicate the relay's own records, the client registry's arisrv.clients.*, to its clients.

server.* names refused by export()

arisrv answers server.* room-calls itself, before a call reaches Python (the identity work's ID1, #1293). So pycvc.ariadne.export now raises ValueError for a name under server., which could never run. A name that only begins the same way, such as serverless, is still fine.

Not in it

  • The registry and the main() wiring above (the identity work's ID1, which owns src/arisrv/main.cpp).
  • Python guests (ID4b's recipe, ID4c's route).
  • A per-client concurrency: programs and guests stay one at a time per client, by design.

Tests

  • ServerDocumentTest.EachClientsLimitsLowerItsProgramsCaps:
    • one client lowered, and its change applying at its next start;
    • one asking for more getting it, above the document's (D2);
    • one refused, forbidden;
    • the lane's caps holding over both;
    • the function asked once per start, with the document's caps.
  • ServerDocumentTest.EachClientsLimitsCapItsGuests, on the fake engine:
    • the guest's memory, its own, above the document's;
    • its steps, a held guest's too;
    • a refusal of guests alone, with its programs still allowed;
    • a throwing function, unavailable.
  • ServerBlockTest.RefusesWhatItCannotPublish gains arisrv and arisrv.clients.
  • test_pycvc_ariadne_server gains the server. refusal: 31 checks pass. The 40 pycvc_ariadne*, arisrvx* and arisrv_* ctests all pass.
  • Rebased onto master (e8b457e): 194 of 194 pass across arisrv*, pycvc_ariadne*, the room and server-document suites, the script lane and engine, and every Wasm*.
  • Before the rebase, locally on Windows (static Release, wasmtime 45): all 22 ariadne_server_document_test cases pass, as do the 31 G4-targeted ctests (G4's 29 plus the two new) and the 232 neighbouring ones (room relay, room-call, every arisrv*, the script lane and engine, every Wasm*). The tests follow the D2 switch: 22 of 22 pass with it true, as they did with it false.
  • Lint: g++ 16 -fsyntax-only -Wall -Wextra is clean on server_document.cpp and the test. clang-format 18.1.8 is clean on the changed lines against master.

Docs: ARIADNE.md §9.7 (publish:'s roots), §9.7.1 and §9.7.2. ARISRV_IDENTITY.md, which they link to, lands with the identity work's doc PR.

transfix added a commit that referenced this pull request Nov 16, 2026
…view

From the arisrvx session's review, and Joe's answers to both sessions:

- client_registry keeps a client's limits as client_limits (programs and guests as optional
  booleans; steps, time and memory_mb, where 0 is the document's), and limits(pid) returns them
  as an optional. That is what ServerDocument::set_client_limits (#1296) reads.
- concurrency and python are not keys. Programs and guests run one at a time per client, and ID4c
  adds python.
- The doc:
  - #1290's ledger keys on the principal or the verified device tag, never the client id;
  - packaged clients keep their names;
  - #1296's seam as built;
  - client Python needs a WASI CPython, not W5's Emscripten build;
  - parts are named by session;
  - D2 is being confirmed, since Joe answered the two sessions differently.
Base automatically changed from feat/arisrv-client-guests to master November 16, 2026 05:32
transfix added a commit that referenced this pull request Nov 16, 2026
…view

From the arisrvx session's review, and Joe's answers to both sessions:

- client_registry keeps a client's limits as client_limits (programs and guests as optional
  booleans; steps, time and memory_mb, where 0 is the document's), and limits(pid) returns them
  as an optional. That is what ServerDocument::set_client_limits (#1296) reads.
- concurrency and python are not keys. Programs and guests run one at a time per client, and ID4c
  adds python.
- The doc:
  - #1290's ledger keys on the principal or the verified device tag, never the client id;
  - packaged clients keep their names;
  - #1296's seam as built;
  - client Python needs a WASI CPython, not W5's Emscripten build;
  - parts are named by session;
  - D2 is being confirmed, since Joe answered the two sessions differently.
@transfix
transfix force-pushed the feat/arisrv-client-limits branch from 1bc804e to e4374f6 Compare November 16, 2026 06:12
@transfix
transfix marked this pull request as ready for review November 16, 2026 06:40
transfix added a commit that referenced this pull request Nov 16, 2026
…ove the document's caps, up to the ceiling

Joe confirmed to the arisrvx session "Yes, up to ceiling", as he had told the identity session.
#1296 sets kClientLimitsAboveDocument = true.
@transfix
transfix enabled auto-merge (squash) November 16, 2026 06:43
… arisrv reserved from publish:

The relay can now cap each client's code separately
(docs/roadmap/ARISRV_IDENTITY.md §2.6, ID4a; the identity work's client
registry will set it).

- The seam. ServerDocument::set_client_limits takes a function of the
  pid, a ClientKind (program or guest) and the document's caps. It
  returns the caps that client's code of that kind runs under, as a
  ClientLimits (ClientPrograms' fields: on, max_steps, max_time,
  max_memory). on false refuses it, as forbidden.
- Held to the document's. Per decision D2, settled by the owner, a
  client's limits never go above the document's caps; a server sets
  those for its biggest clients. 0 leaves the document's, and the action
  lane's caps hold over both. ServerDocument::kClientLimitsAboveDocument
  switches this, and the tests follow it.
- At each start. run_client_program and run_client_guest ask right after
  the pid check, so a change applies from the client's next start. A held
  guest starts under the caps it was given. A function that throws refuses
  the start (unavailable).
- A guest's linear memory is capped by its client's memory cap, else by
  kClientGuestMemory.
- arisrv joins publish:'s reserved roots, so no server document can
  publish the relay's own records (the registry's arisrv.clients).

Tests:
- ServerDocumentTest.EachClientsLimitsLowerItsProgramsCaps.
- ServerDocumentTest.EachClientsLimitsCapItsGuests, on the fake engine.
- ServerBlockTest.RefusesWhatItCannotPublish gains arisrv's cases.

Docs: ARIADNE.md §9.7 (publish:'s roots), §9.7.1 and §9.7.2.
…-in calls)

arisrv answers server.* room-calls itself, before a call reaches Python
(the identity work's ID1, #1293). An @export with such a name could
never run, so export() now raises ValueError for one.

Test: two new checks in test_pycvc_ariadne_server.
…caps to the action lane's

The owner settled decision D2 (docs/roadmap/ARISRV_IDENTITY.md §4) as
"Yes, up to ceiling". So ServerDocument::kClientLimitsAboveDocument is
now true.

A client's limits replace the document's caps for that client. They can
be lower, or higher up to the action lane's (ariadne.limits.action_max_*),
which hold over every process. A guest's memory stays under
ariadne.limits.wasm_max_memory. The document's client_programs: and
client_guests: are what every client gets, and an admin can give one
client more or less.

The tests follow the switch: ServerDocumentTest's limits cases now
expect the raise. Docs: ARIADNE.md §9.7.1 and §9.7.2.
…ne's 0.1 s

ServerDocumentTest.EachClientsLimitsLowerItsProgramsCaps failed on
CI's Linux Debug build. The raised client's program came back
resource_exhausted. That was the action lane's default 0.1 s time cap
stopping it: in Debug, its 1500 additions take longer than 0.1 s. Its
steps (about 6000) were well under the 50000 it was raised to.

The test is about step caps, so it now sets
ariadne.limits.action_max_time to 0 (no limit). Locally, a 0.2 ms cap
reproduces CI's failure exactly, and the fix passes all 22 cases.
@transfix
transfix force-pushed the feat/arisrv-client-limits branch from 50aaa3c to bd243d1 Compare November 19, 2026 00:23
transfix added a commit that referenced this pull request Nov 19, 2026
# Conflicts:
#	src/arisrv/main.cpp
#	src/cvc/CMakeLists.txt
…Integration), which PRs skip

#1356 put TilerBunny on every PR. That's about 13 s in Release, but a
Debug build runs the bunny's SDF and the tiling many times slower.
package-linux's libcvc-debug took about 450 s on a quiet runner (#1357,
#1358). On a loaded one it ran past its 900 s timeout three times over
(#1296, #1360), and failed that required job for every PR.

So in a Debug build the suite is TilerBunnyIntegration. ci.yml's
STRESS_REGEX takes Integration as a heavy suite, which no PR or Debug job
runs; Release pushes still do. A Release build keeps the name TilerBunny,
so every PR's Release lanes still run it.

The tests' CMakeLists comment and the VolumeRover ports roadmap say the
same.
@transfix
transfix disabled auto-merge November 19, 2026 20:48
@transfix
transfix enabled auto-merge (squash) November 19, 2026 20:48
@transfix
transfix merged commit dcb893a into master Nov 20, 2026
29 checks passed
@transfix
transfix deleted the feat/arisrv-client-limits branch November 20, 2026 00:31
transfix added a commit that referenced this pull request Nov 21, 2026
…guests (ID4) (#1406)

An admin could already set a client's limits with server.limits (ID3). They were kept in the
client's record and shown under limits.*, but nothing used them. #1296 (ID4a) added the hook,
ServerDocument::set_client_limits, and this sets it in arisrv's main() from
client_registry::limits(pid) (docs/roadmap/ARISRV_IDENTITY.md §2.6).

- A programs or guests flag set false refuses the client that kind (forbidden). true allows only
  what the document already allows.
- steps, time and memory_mb (in bytes; a huge value saturates) replace the document's caps where
  they aren't 0. Under D2 that means lower, or higher up to the action lane's caps, which the
  document enforces.
- It's asked at each start, on the room loop's thread, so a change applies from the client's next
  program or guest.
- At shutdown the callback is cleared before the registry it reads goes away.

Test: ctest arisrv_client_limits runs stock arisrv with client_programs_server.ari (5000 steps)
and rcon. The client makes itself an admin, then:
- refuses its own programs (forbidden);
- allows them again with t;
- lowers its steps to 5, so a 40-addition program ends resource_exhausted;
- sets steps back to 0, the document's, and the program runs again.
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