feat(console): named PAKs, zero-config UI auth, and tenant-scoped views (BROKKR-I-0032)#87
Merged
Merged
Conversation
…ws (BROKKR-I-0032) Broker: - Ephemeral read-only UI PAK minted per process; middleware recognizes it as a readonly admin and rejects non-GET requests (403), allowlisting POST /auth/pak and diagnostics creation - Served console HTML gets the token injected as <meta name="brokkr-ui-token"> (Cache-Control: no-store); zero-config console auth - GET /api/v1/paks: slim tenant listing derived from generators (id + name) - ?pak_id= tenant scoping on GET /fleet, /stacks, /agent-events (SQL-side) - Audit log entries enriched with resolved actor_name (batched lookups) Console (brokkr-web): - Boots from the injected token; localStorage brokkr_pak remains the write-capable override - Tenant scope selector in the sidebar (All + named PAKs), persisted in localStorage, reactively refetching fleet/stacks/agent-events - Fix: attach pak_id via gloo-net's query API (hand-built query strings gained a stray trailing '&') Tooling: - Playwright harness: two-tenant fixtures, scope-selector + fleet-scoped scenes, query-aware mock routing - OpenAPI spec + Python/TypeScript SDKs regenerated - Version bump 0.8.3 -> 0.8.4 (lockstep: crates, charts, SDKs) Verified: 120 unit + 484 integration tests green; live demo walkthrough. Claude-Session: https://claude.ai/code/session_0182KcANrkLy1g5sFyJHaYGz
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.
Summary
Implements BROKKR-I-0032: the operator console now works with zero configuration and can scope every data view to a single tenant.
Design decision (approved): tenants ARE generators — no new PAK table. The scope selector lists named generators; filtering rides
stacks.generator_idandagent_generator_registrations(ADR-0009 tenancy).Broker
utils/ui_pak.rs): minted per process, in-memory only. Middleware treats it as a readonly admin; non-GET requests get 403, withPOST /auth/pakand diagnostics creation allowlisted.api/assets.rs): servedindex.htmlcarries<meta name="brokkr-ui-token">(+Cache-Control: no-store) — the console authenticates with no operator setup.GET /api/v1/paks: slim[{id, name}]tenant listing (non-system generators), admin-gated.?pak_id=scoping onGET /fleet,/stacks,/agent-events— SQL-side filtering; unknown id → empty list, malformed → 400. View filter, not an auth boundary (initiative non-goal)./admin/audit-logsentries carry a resolvedactor_name(batched name lookups, no N+1).Console (brokkr-web)
localStorage["brokkr_pak"]stays as the write-capable override.localStorage["brokkr_scope"]; Fleet/Deployments/Telemetry/Overview refetch reactively.&to URLs that already have a query string —pak_idnow attaches via the builder's.query()API.Tooling & release
scope-selectorandfleet-scopedscenes, query-aware mock routing.Verification
angreal tests unit brokkr-broker: 120 passedangreal tests integration brokkr-broker: 484 passed, 0 failed (new: ui_pak ×5, paks ×3, pak_scoping ×3, audit enrichment)angreal openapi check/check-python/check-typescript: no drifttrunk build --releaseclean; 16 Playwright scenes regenerated and visually verified/paks, server-side scoping, 403 on writes with the UI tokenNotes
/api/v1/diagnostics, which has never existed broker-side..metis/initiatives/BROKKR-I-0032/.https://claude.ai/code/session_0182KcANrkLy1g5sFyJHaYGz