ADR-0094: portalr's commands: its admin's reads, and the tenant and member it makes¶
Status: Accepted Date: 2026-11-01 Deciders: Alex Nodeland Implements: lattice RFC-0014's portalr catalog (phase 1, #916); on lattice ADR-0041
Context¶
RFC-0014 gives each package a static catalog of commands. portr, portalr's client and the parity test read it without a database. RFC-0014 gives portalr's catalog "its reads (telemetry, spend, usage, deployment), invites, tenants", and makes grantr:create_tenant portalr's command rather than grantr's.
portalr's routes ask three actions of its own (portalr.actions):
portalr:read_telemetry, for a tenant's traces, logs, metrics, scores, feedback and adoption;portalr:read_spend, for its spend and usage;portalr:read_deployment, an operator's, for every tenant and the deep links into the stack's tools.
portalr also creates a tenant and invites a member through Supabase Auth, after asking grantr's grantr:create_tenant and grantr:add_member. Its other routes are its UI's own, gated by no action:
- a person's analytics consent and session;
- the names of people;
- the models a turn may use, which
artifactr:use_modelgates in artifactr's catalog.
Decision¶
portalr.commandsimports pydantic, lattice-core'scapabilitiesandcommands,portalr.actionsand the readers' query models. It imports no web framework and no HTTP client, which a test holds it to, andCATALOGreads no tool.- 14 commands,
portalr.<name>, version 1.0.0, all in theadmintoolset, each routed to its page in portalr's admin.- Twelve reads, each
readwithreads_private, gated by the action its route asks. Each read takes its route's query, the readers' own model (TraceQuery,LogQuery,MetricQuery,Window,FeedbackQuery,UsageQuery,AdoptionQuery), so a client asks what the admin asks.- The telemetry reads:
portalr.list_traces,read_trace,read_logs,read_log_line,read_metrics,read_scores,read_feedbackandread_adoption. - The spend reads:
portalr.read_spendandread_usage. - The deployment reads:
portalr.list_deployment_tenantsanddeployment_links. A link made is still recorded, as the route records it.
- The telemetry reads:
portalr.create_tenant, gated bygrantr:create_tenant, andportalr.invite_member, gated bygrantr:add_member. Each iswrite, compensable, andsends_out: each has Supabase email someone outside the tenant. So the taint policy can refuse a run that read untrusted content from inviting an address it was handed.
- Twelve reads, each
- Every one of portalr's actions is a gate, so
LISTEDis empty. A test holds the grantr actions to the strings portalr's routes ask. - Not commands: the UI's own routes above. RFC-0014's
x-lattice-commandon every operation, which the parity test reads, will mark them as the UI's. - Published as
schemas/portalr.commands.json, regenerated byportalr:schemaand checked for drift.
Options considered¶
Option A: A read's arguments are its route's query model (chosen)¶
Pros: one schema for the route and the command, as RFC-0014 asks: "generated from the pydantic models the REST ... surfaces already validate". Cons: the catalog imports the readers' modules, which also hold their HTTP clients, though it calls none.
Option B: Arguments declared again in the catalog¶
Cons: two schemas for one read, which drift.
Option C: The invite and tenant commands in grantr's catalog¶
Cons: RFC-0014 makes creating a tenant portalr's, and both go through Supabase Auth, which only portalr knows.
Consequences¶
- Easier: the parity test, portalr's
CommandNameand portr's tools read portalr's commands with every other catalog's. A client can read a tenant's traces, logs and spend where an operator could. - Harder: a new route of portalr's needs a command, or a reason it is the UI's own.
- Harder: portalr no longer imports at lattice-core-ai 0.2.0, the newest on PyPI, which lacks
capabilitiesandcommands.scripts/lowest_direct.pyexpects that until its floor rises with the next lattice-core release.
Action items¶
-
portalr.commandsand its schema, tested against portalr's actions and routes. -
x-lattice-commandon every operation, and the UI's own routes marked so (the parity test, #916). - The bound provider, with portr (#917).