TenantAtlas/specs/113-platform-ops-runbooks/contracts/system-ops-runbooks.openapi.yaml
ahmido 200498fa8e feat(113): Platform Ops Runbooks — UX Polish (Filament-native, system theme, live scope) (#137)
## Summary

Implements and polishes the Platform Ops Runbooks feature (Spec 113) — the operator control plane for safe backfills and data repair from `/system`.

## Changes

### UX Polish (Phase 7 — US4)
- **Filament-native components**: Rewrote `runbooks.blade.php` and `view-run.blade.php` using `<x-filament::section>` instead of raw Tailwind div cards. Cards now render correctly with Filament's built-in borders, shadows and dark mode.
- **System panel theme**: Created `resources/css/filament/system/theme.css` and registered `->viteTheme()` on `SystemPanelProvider`. The system panel previously had no theme CSS registered — Tailwind utility classes weren't compiled for its views, causing the warning icon SVG to expand to full container size.
- **Live scope selector**: Added `->live()` to the scope `Radio` field so "Single tenant" immediately reveals the tenant search dropdown without requiring a Submit first.

### Core Feature (Phases 1–6, previously shipped)
- `/system/ops/runbooks` — runbook catalog, preflight, run with typed confirmation + reason
- `/system/ops/runs` — run history table with status/outcome badges
- `/system/ops/runs/{id}` — run detail view with summary counts, failures, collapsible context
- `FindingsLifecycleBackfillRunbookService` — preflight + execution logic
- AllowedTenantUniverse — scopes tenant picker to non-platform tenants only
- RBAC: `platform.ops.view`, `platform.runbooks.view`, `platform.runbooks.run`, `platform.runbooks.findings.lifecycle_backfill`
- Rate-limited `/system/login` (10/min per IP+username)
- Distinct session cookie for `/system` isolation

## Test Coverage
- 16 tests / 141 assertions — all passing
- Covers: page access, RBAC, preflight, run dispatch, scope selector, run detail, run list

## Checklist
- [x] Filament v5 / Livewire v4 compliant
- [x] Provider registered in `bootstrap/providers.php`
- [x] Destructive actions require confirmation (`->requiresConfirmation()`)
- [x] System panel theme registered (`viteTheme`)
- [x] Pint clean
- [x] Tests pass

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #137
2026-02-27 01:11:25 +00:00

169 lines
4.2 KiB
YAML

openapi: 3.0.3
info:
title: System Ops Runbooks (Spec 113)
version: 0.1.0
description: |
Conceptual contract for the operator control plane under /system.
Note: The implementation is a Filament (Livewire) UI. These endpoints
represent the stable user-facing routes + the logical actions (preflight/run)
and their request/response shapes.
servers:
- url: /
paths:
/system/ops/runbooks:
get:
summary: Runbook catalog page
responses:
'200':
description: HTML page
content:
text/html:
schema:
type: string
/system/ops/runbooks/findings-lifecycle-backfill/preflight:
post:
summary: Preflight findings lifecycle backfill
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RunbookPreflightRequest'
responses:
'200':
description: Preflight result
content:
application/json:
schema:
$ref: '#/components/schemas/RunbookPreflightResponse'
'403':
description: Platform user lacks capability
'404':
description: Wrong plane / not platform-authenticated
/system/ops/runbooks/findings-lifecycle-backfill/runs:
post:
summary: Start findings lifecycle backfill
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RunbookStartRequest'
responses:
'201':
description: Run accepted/queued
content:
application/json:
schema:
$ref: '#/components/schemas/RunbookStartResponse'
'409':
description: Already queued / lock busy
'422':
description: Validation error (missing reason, missing typed confirmation, etc.)
/system/ops/runs:
get:
summary: Operation runs list page
responses:
'200':
description: HTML page
content:
text/html:
schema:
type: string
/system/ops/runs/{runId}:
get:
summary: Operation run detail page
parameters:
- in: path
name: runId
required: true
schema:
type: integer
responses:
'200':
description: HTML page
content:
text/html:
schema:
type: string
'404':
description: Not found
components:
schemas:
RunbookScope:
type: object
required: [mode]
properties:
mode:
type: string
enum: [all_tenants, single_tenant]
tenant_id:
type: integer
nullable: true
RunbookPreflightRequest:
type: object
required: [scope]
properties:
scope:
$ref: '#/components/schemas/RunbookScope'
RunbookPreflightResponse:
type: object
required: [affected_count, total_count]
properties:
affected_count:
type: integer
minimum: 0
total_count:
type: integer
minimum: 0
RunbookReason:
type: object
required: [reason_code, reason_text]
properties:
reason_code:
type: string
enum: [DATA_REPAIR, INCIDENT, SUPPORT, SECURITY]
reason_text:
type: string
maxLength: 500
RunbookStartRequest:
type: object
required: [scope, preflight]
properties:
scope:
$ref: '#/components/schemas/RunbookScope'
preflight:
type: object
required: [affected_count]
properties:
affected_count:
type: integer
minimum: 0
typed_confirmation:
type: string
nullable: true
description: Required for all_tenants (must equal BACKFILL)
reason:
$ref: '#/components/schemas/RunbookReason'
RunbookStartResponse:
type: object
required: [operation_run_id, view_run_url]
properties:
operation_run_id:
type: integer
view_run_url:
type: string