Records Feature record

FDR-021

Admin Dashboard & System Monitoring

Active Last reviewed 2026-11-01 Source file

Overview

The server-management section gives owners and admins visibility into the server's operational state: user counts, room counts, storage resource usage, projection health, and audit/event-log diagnostics. It lives within a broader management area that also gives delegated managers direct access to the rooms and room groups they are authorised to configure. Operational views deliberately expose metadata — never message content, never per-user activity logs, never per-room conversation summaries.

Behavior

  • Room General settings have four independent forms: name and description, visibility, Slow Mode, and Threading Mode. Each form has Save changes and Discard changes. Editing a control does not save it. Save sends only that form's changed fields; Discard restores its latest saved values. A failed save keeps the draft. Remote updates preserve edited fields and update untouched fields. Navigating away with unsaved changes opens an in-app confirmation dialog. Closing or reloading the tab uses the browser's native warning; drafts do not survive a reload. Loss of permission removes the editor.
  • Management UI lives under /chat/[serverId]/manage/. Server-wide pages live below /manage/server/; individual room and room-group settings use sibling resource routes.
  • Legacy /chat/[serverId]/server-admin/... deep links permanently redirect to their equivalent management routes so bookmarks and shared links continue to work.
  • Every member can open Settings from the primary server navigation. The server sidebar then shows a unified Settings sidebar with three collapsible groups: App preferences, Your account, and Server configuration. It also shows a Back to Server action. App preferences apply to all servers. Your account and Server configuration apply to the server named in the Settings header. Server configuration links to the pages the viewer can use. While Shield Mode is off, it also shows buttons for pages the server says the viewer can unlock. These buttons open the role picker. The gear and Settings entry open Overview. This page lists the available destinations as a grid, in the same groups and order as the sidebar. On narrow screens, cards form one column, with artwork on the left and text on the right. If Shield Mode is available but inactive and the grid has no shield-marked pages, a notice directs the user to the shield button beside their name. The grid updates when effective permissions change.
  • With no authenticated server, the Application Header gear opens Settings Overview with the same sidebar and cards. Only the collapsible App preferences group is available. It contains Appearance, Language, Composer, and Updates when the desktop app provides it. Pages that need a server session are not shown. The sidebar remembers whether the group is collapsed.
  • Delegated managers enter a specific room or room group through its contextual settings action. Resource pages use effective scoped permissions and do not imply access to unrelated server-management pages.
  • Users page — paginated list of all server members with login, primary verified email, roles, and verification status. The API identifies the primary email explicitly instead of relying on address order. Admins can edit profiles, assign roles, suspend, or delete users when they hold the relevant permission.
  • Jobs page — users with server.manage can inspect background jobs and retry eligible failures. See FDR-056.
  • System Info page — owner-only page showing backing message-broker connection status, storage account limits and current usage, stream/consumer health, known durable-worker queue health, projection health (lag, entry counts, and rough memory estimates), and AdminDiagnosticsService.GetSystemInfo stats (user count, channel room count, DM room count).
  • The System Info page has five tabs, each with its own route: Overview, Streams, Projections, Workers, and LiveKit. The LiveKit tab is hidden when the server does not report LiveKit status. All tabs use one diagnostics snapshot. A refresh action in the page header reads a new snapshot.
  • The Overview tab starts with a health summary: one overall status and one row for each check (broker connection, projections, background workers, backlog, account limits, and calls when LiveKit is configured). Below it are the user, room, event, and stored-data counts, account usage against each limit, and the broker connection. A check whose details are on a different tab links to that tab. A tab shows a status dot when one of its checks reports a warning or a problem, so a problem stays visible from every tab.
  • Audit log page — chronological diagnostic event-log view for forensic review, grouped by event creation date. The list view uses AdminEventLogService.ListEvents; the detail view uses AdminEventLogService.GetEvent to show sanitized payload JSON for human inspection. Password verifiers are omitted.
  • The audit log UI can be filtered by exact event type and exact actor ID. Event type suggestions come from the admin event-log API; the actor field reuses the server member lookup but still accepts synthetic actor IDs such as system:bootstrap. The API also supports inclusive created-at bounds for callers, but the server-management page does not expose time-range controls.
  • The audit/event-log API returns totalCount as a 64-bit value because it reflects retained stream message counts, which can exceed 32-bit integer range on long-running servers.
  • Filtered audit-log browsing is a bounded diagnostic scan over retained EVT rows, not an indexed analytics query. The connection reports scannedCount, scanLimit, and scanLimited so the UI can tell operators when older matches may exist beyond the inspected window.

Design Decisions

1. Capability-based Server Configuration navigation

Decision: There is no separate admin.access permission. Settings is available to every member because it contains App preferences and the member's account settings. The Server configuration group is a capability index. It shows only destinations that have a concrete capability. Child routes and API methods apply their narrower gates, such as server.manage, admin.view-users, admin.view-audit, role.manage, and owner-only diagnostics. Why: All members need a stable location for app-wide and server-scoped choices. Some operators need a read-only admin role. Other operators need access to users but not to system information. One permission-filtered Settings surface supports these roles without a parallel role system. Tradeoff: There is no separate permission to see the admin dashboard. The Settings entry is always visible. The UI must clearly separate app-wide choices, personal server choices, and permission-gated Server configuration.

2. Operational metadata, not conversation content

Decision: The System Info page can expose operational metadata such as stream/consumer state and projection diagnostics, but not message bodies, file contents, per-user activity trails, or per-room conversation summaries. Why: Operators need enough detail to diagnose lag, storage pressure, and projection growth. Those are system-health questions, not moderation questions. Keeping content and behavioral surveillance out of the admin dashboard preserves the privacy boundary while still making the server operable. Tradeoff: Some identifiers and subject filters are visible to admins with system access. That is acceptable for the operator persona, but any future content-level moderation surface should be a separate, explicit feature.

3. Privacy boundary: admins see metadata, not content

Decision: Admins can see who exists, what rooms exist, who's a member, who has which roles. They cannot see message content, private messages, file contents, or user passwords. Why: "Operate the system" and "read user conversations" are different jobs. Conflating them would mean every operator needs the trust level of a moderator with access to every conversation. Keeping the boundary explicit lets owners hire operators without granting message visibility. Tradeoff: Moderation tools that need to read content (rare cases) would need a separate, auditable feature with explicit consent. None exists today.

4. Live data, not cached

Decision: System Info fetches fresh data from NATS and projection diagnostics on every page load. No caching layer. Why: The data is fundamentally point-in-time ("how much storage are we using right now?"). Caching would mean stale numbers shown to operators making capacity decisions. The fetch cost is low because NATS already has the data internally. Tradeoff: Refreshing the page hits NATS every time. Not a concern at admin-usage volume.

5. Diagnostic values are operator tooling, not product contracts

Decision: Raw storage subjects, stream/consumer names, sanitized payload JSON, projection metric names, and memory estimates are documented as diagnostic values. The admin diagnostics APIs are intentional operator APIs, but clients should not parse those values as stable product-domain data. Payload JSON omits password verifiers. Why: Operators need visibility into what the runtime is doing, especially during the 0.1 stabilization lane. At the same time, these values reflect storage and projection implementation details that may evolve as the event-sourcing model settles. Tradeoff: Third-party admin clients can display diagnostics but should treat raw strings and JSON as best-effort inspection data. If a future integration needs a stable audit export format, it should get a dedicated schema instead of depending on diagnostic payloads.

Known durable workers use stable diagnostic keys and stream-scoped, broker-derived state. A waiting pull demonstrates availability; unacknowledged work with an available worker is working. Ack-pending work without a waiting pull is explicitly unconfirmed because broker state cannot distinguish a busy handler from a crashed handler awaiting redelivery. A declared consumer with neither is stalled. Currently unacknowledged redeliveries remain informational and do not by themselves make current health look failed. Core-owned consumers are required; asset processing is inactive whenever video uploads are disabled, even if its durable consumer remains retained.

6. Event-log filters are bounded diagnostic scans

Decision: AdminEventLogService.ListEvents supports exact event-type and actor-ID matching plus inclusive created-at bounds, but filtered reads scan at most 5,000 retained EVT rows per request. The server-management UI currently exposes event-type and actor filters and groups the newest-first table by creation date. Why: EVT is the source of truth, not an indexed analytics store. The filters make the admin page useful for common investigations without adding a second durable index or allowing one request to walk an unbounded stream. Tradeoff: A sparse filter on a large server may report scanLimited: true before finding every historical match. Operators can narrow the time range or inspect older windows explicitly; a future export/analytics feature should get a dedicated read model.

7. Admin APIs use service-level grouping with field-specific capability gates

Decision: Admin operations are grouped under dedicated ConnectRPC services, while sensitive methods check their own capabilities (server.manage, admin.view-users, admin.view-audit, role.manage, scoped room.manage, owner-only diagnostics) before returning data. Why: Dedicated service grouping gives the API obvious admin-tooling namespaces, and method-level checks let operators delegate user, system, audit, and RBAC-editor visibility independently. Tradeoff: A user may be able to enter the admin area but see permission denials or empty panels for specific sections. The UI has to reflect that capability split clearly.

8. One management namespace, scoped by resource

Decision: Server, room, and room-group configuration share the /manage namespace. Server-only operations live under /manage/server, while rooms and room groups are addressed as resources alongside it. Why: Room and room-group permissions can be delegated without granting server-wide administration. A resource-oriented management area gives those managers a direct destination without creating a separate top-level settings section for every manageable resource. Tradeoff: The unified Settings shell cannot assume that each viewer has the same Server configuration navigation. It must get navigation and access from the selected resource and the viewer's effective capabilities. It must also keep App preferences and account settings available.

9. The health summary flags lasting conditions only

Decision: The System Info health summary raises a check above OK only for a lasting condition:

  • The broker connection is lost.
  • A projection failed.
  • A required durable worker is stalled or missing.
  • JetStream account usage is at or above 75% of a limit (warning) or 90% (critical).

Projection lag, consumer backlog, and unconfirmed workers appear as details of an OK check. When the server does not report the data for a check, the check shows as unknown. Unknown checks do not change the overall status. If JetStream consumer state is not available, the workers check is unknown.

Account storage usage counts a copy on each stream replica. When a file stream has more than one replica, the page also shows the data size of the file streams.

Why: A snapshot often catches normal, short backlog or lag. If those raised warnings, operators would learn to ignore the summary. Lasting conditions need action, so they are the only ones that change the status. Tradeoff: Lag that continues for a long time does not raise a warning by itself. Operators must compare snapshots or use metrics to see it. The broker and projection checks describe only the replica that handled the request (see the open question below).

10. Explicit submission for room settings

Decision: Each form on the room General page requires explicit submission, including forms with a single setting. Saving one form does not save or reset another. Other administrative forms will migrate separately; membership, permission, and archive/delete actions are outside this change. Why: Managers can inspect and revise a selection before it changes room behaviour. A clear action scope prevents a save from committing unrelated edits. Tradeoff: A change needs an extra action. Unsaved drafts require a warning when the manager leaves the page.

Permissions

  • admin.view-users — gates user-management views, admin-only affordances, and user-sensitive fields such as other users' verified email addresses and login cooldowns. The underlying server.members directory query remains authenticated-user visible; see FDR-025.
  • System diagnostics are owner-only; admin.view-system is exposed only as a viewer capability key, not as a grantable RBAC permission.
  • admin.view-audit — gates admin event log, event type, and event detail reads.
  • role.manage — configures roles and role permission decisions, including scoped room and room-group matrices without granting general room-management authority.
  • role.assign — gates user role assignment and revocation; non-owner assignments remain bounded by the actor's own scoped authority.
  • room.manage — gates general room and room-group settings at the effective resource scope; server-scope grants also gate global room-group creation and ordering.
  • user.manage-accounts — gates user creation, cross-user identity edits of humans, password resets, verified-email attachment, and login-cooldown resets.

A protected role grants these permissions when selected in Shield Mode. Owner-only diagnostics require the selected owner role. The server configuration entry remains discoverable from entitlement while protected pages and actions use effective permissions.

  • ADRs: ADR-001 (NATS JetStream as primary data store), ADR-033 (event-sourced state with projections), ADR-034 (single event stream), ADR-036 (runtime state in RUNTIME_STATE), ADR-069 (explicit durable consumer lifecycle)
  • FDRs: FDR-001 (Roles & Permissions), FDR-018 (Account Lifecycle), FDR-020 (Server Branding & Configuration), FDR-022 (User Profile), FDR-024 (Permission Inspection Tool), FDR-025 (User Search & Member Directory), FDR-045 (Privileged Mode)

Open Questions

  • A more sensitive operator-only surface for raw storage inspection or content moderation would need its own permission and audit model. Not currently planned.
  • The broker connection and projection diagnostics come from the replica that handled the request. With more than one replica, the page cannot show the state of the others. Issue #2857 proposes per-replica health records in a KV bucket.

Records that name this record

Esc