Skip to content

arisrv: an admin's server.limits apply to that client's programs and guests (ID4) - #1406

Merged
transfix merged 2 commits into
masterfrom
feat/arisrv-wire-client-limits
Nov 21, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/arisrv-wire-client-limits

Conversation

@transfix

Copy link
Copy Markdown
Owner

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

What changes

  • Refusing a kind. Setting programs or guests to false refuses the client that kind of code (forbidden). Setting it to true allows only what the document already allows.
  • Caps. steps, time and memory_mb replace the document's caps where they aren't 0. memory_mb is converted to bytes, and a huge value saturates instead of overflowing. Under D2 a client's cap can be lower than the document's, or higher up to the action lane's caps, which the document still enforces.
  • When it applies. The callback is asked at each start, on the room loop's thread (call_step). A change takes effect from the client's next program or guest, not one that's already running.
  • Shutdown. The callback is cleared before the registry it reads is destroyed.
  • Docs. ARISRV_IDENTITY.md's status line and §2.6 now describe this as built.

Tests

New ctest arisrv_client_limits: stock arisrv with client_programs_server.ari (5000 steps) and --rcon-password-file. 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 cap), and the program runs again.

With the callback disabled, cases c (forbidden) and e (resource_exhausted) fail, so the test does catch a missing hook.

Local runs, Windows Release on MSVC 14.44 (build-identity):

  • arisrv_client_limits, arisrv_rcon, arisrv_identity_{grpc,ws}, arisrv_guest_password{,_refuses} and arisrv_room_call_program: 7/7 pass.
  • arisrvx's room-call, auth, echo, rcon_admin_role and arigl room-call tests: 14/14 pass.

Not tested end to end: the guests branch of the callback. The local tree has no wasmtime arisrvx, and ServerDocumentTest.EachClientsLimitsCapItsGuests (#1296) covers guest caps at the document level.

…guests (ID4)

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.
@transfix
transfix enabled auto-merge (squash) November 20, 2026 21:08
@transfix
transfix disabled auto-merge November 21, 2026 06:58
@transfix
transfix enabled auto-merge (squash) November 21, 2026 06:58
@transfix
transfix merged commit 978044e into master Nov 21, 2026
29 checks passed
@transfix
transfix deleted the feat/arisrv-wire-client-limits branch November 21, 2026 12:20
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