Build Guard activity console view
Epic 5896 · child C4b (console UI) of the Architectural Guard. Full design: architecture (Task 5898 `architecture`) §8, §4.3; PRD Task 5897 `prd`.
## Epic requirement (verbatim)
> Build a solution for this (an advanced feature of Compliance - Advanced Compliance Plan activated):
> In large enterprises, improvisation breaks design systems. Jaah can win by offering **absolute, unyielding architectural enforcement**.
> - **The Mechanism:** Instead of just checking if code passes a test, Jaah enforces rigid code blueprints, strict linting arrays, and structural enterprise design standards across thousands of repositories simultaneously.
> - **The Breakthrough Feature:** A real-time "Architectural Guard." If an agent tries to write a functioning feature but uses an unapproved API pattern or deviates from the corporate Monorepo style guide, Jaah's harness blocks the agent mid-execution, rewrites its context, and forces compliance before a single line is even committed to a branch.
## This child's requirements (PRD verbatim)
- R6.2: The Compliance console shows the records as a **Guard activity** view filterable by project, rule and decision. The rule page and the repo page show the block counts for the last 7 and 30 days.
- R4.3 (settings leg): N org-configurable in Compliance settings, default 5.
- R1.2: when unavailable, the console hides all guard UI.
## Approach
- New tab `/compliance/guard`, linked from the Compliance nav row as "Guard activity", shown only when `admin.guard_enabled` (S1). Uses `GET /api/compliance/guard/activity` (S4, C4a), cursor pagination via `next`.
- Filters: project, rule, decision. Rows: time, project, rule name (in words), decision badge, `path:line`, runtime, task link when present.
- Empty state: "No guard blocks yet. Rules at gate or lock will log here when they stop a change."
- At 448 px the table becomes stacked cards; rule names and paths wrap (`overflow-wrap: anywhere`), never ellipsized; no horizontal scroll.
- `RulePage` and `RepoPage`: "Guard blocks: 7 d / 30 d" row from `guard_counts`, linking to the activity view pre-filtered; absent when the key is absent.
- `SettingsPage`: "Ask the operator after N consecutive blocks" (1–50) bound to `guard_stuck_limit`.
- Follow `docs/standards/ui-copy-standards.md`.
## Acceptance criteria (verbatim)
- AC-16: **Guard activity view** lists denials, errors, waivers and escalations with the R6.1 fields, filterable, with counts on the rule and repo pages. An empty state reads clearly when none exist. Legible at 448 px (stacked, no horizontal scroll, rule names and file paths readable, not truncated to fragments). (Seeded leg here: seed all four decision types through `POST /api/agent/guard/decisions` on the dev test org; C6 re-checks with real decisions.)
- AC-1 (UI part owned here): only on+on shows the guard UI; the other three combinations show no guard UI.
Credentials & reach:
- AC-16 (org editor on `/compliance`) | `jaah/debug/main/operator-login` / dev | verified.
- AC-1 (Org › Plan as superadmin) | same credential / operator superadmin / dev CP `app.dev.jaah.ai` | verified.
- Test org with both switches on | same credential / dev; org-b | verified.
- Browser host | — | `https://app.dev.jaah.ai`.
(Seeding decisions needs a node-authenticated call; if seeding through the agent route is not reachable from your runner, seed via an API test fixture on dev's data path you are permitted, or record real decisions once C5b exists — say which in your report.)
Out of scope: Do NOT show any guard UI for orgs where either switch is off. Do NOT add a second rule-authoring surface (D-12). No backend route changes beyond what C4a pinned (if you find a contract gap, fix it minimally and name it). No waiver UI change (C6). No prune/retention UI.
Done means:
- AC-16 — on dev after Jaah Deploy succeeds: open Compliance › Guard activity for org-b with seeded denied/error/waived/escalated rows; observe the R6.1 fields, each filter narrowing the list, counts on the rule and repo pages linking pre-filtered; the empty state text with no rows; resize to 448 px — stacked cards, no horizontal scroll, full rule names and paths readable; screenshot attached to your report.
- AC-1 UI — for each of the 4 switch combinations on org-b, open `/compliance` as an org editor and observe the Guard activity link, counts and the stuck-limit setting present only for on+on (restore on+on after).
- Settings — set N=2, reload, observe it persisted; 0 and 51 refused with a readable message.
- Web tests for the view, empty state and hidden-when-disabled; `./dc check full` green.
Outcome
Guard activity view, 7/30-day block counts and stuck-limit setting shipped (PR #5185 + dev-fix #5188, both deployed). AC-1 and settings verified on dev; seeded rows verified locally only (dev seeding not reachable). Gate green bar load-flaky smoke specs.
Artifacts
Activity
- Draft
- Ready
- Runner started
- Runner ended (done)