Removes the Findings lifecycle backfill from the Operational Controls UI and OperationalControlCatalog. This patch is a safe, controls-only change; runbooks, jobs and other runtime artifacts are NOT removed yet. Follow-up work will delete the runbook service/scope, jobs, commands, and update tests. Files changed: - apps/platform/app/Filament/System/Pages/Ops/Controls.php - apps/platform/app/Support/OperationalControls/OperationalControlCatalog.php - apps/platform/tests/Feature/System/OpsControls/OperationalControlManagementTest.php - apps/platform/tests/Unit/Support/OperationalControls/OperationalControlCatalogTest.php - apps/platform/tests/Unit/Support/OperationalControls/OperationalControlScopeResolutionTest.php Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #280
6.1 KiB
Data Model — Operational Controls
Spec: spec.md
The first operational-controls slice adds one persisted runtime-safety record and two derived runtime concepts. It reuses existing execution and audit truth.
Existing Canonical Entities Reused
Workspace (workspaces)
Purpose: Existing workspace boundary for targeted operational-control scope.
Key fields (existing):
idname
Feature use:
- Identifies the workspace targeted by a workspace-scoped control activation.
- Continues to anchor workspace isolation and audit scope.
Tenant (tenants)
Purpose: Existing tenant boundary for the affected execution surfaces.
Key fields (existing):
idworkspace_idnameexternal_id
Feature use:
- Supplies workspace context for findings and restore execution checks.
- Does not own control records in this slice.
PlatformUser (platform_users or equivalent platform-authenticated user model)
Purpose: Existing platform-plane actor for control management.
Feature use:
- Owns pause/resume actions in the system plane.
- Supplies actor identity for audit and attribution on control changes.
OperationRun (operation_runs)
Purpose: Existing canonical execution truth for in-scope starts when execution is allowed.
Key fields (existing):
idworkspace_idtenant_idtypestatusoutcomecontext
Feature use:
- Remains the only execution truth for allowed starts.
- Must not be created when an in-scope start is blocked by an active control.
- Existing queued or historical
OperationRunrecords remain unchanged when a later control activation blocks only new starts.
RestoreRun (restore_runs)
Purpose: Existing restore execution truth for queued restore work.
Feature use:
- No new queued execution
RestoreRunis created by a blockedrestore.executestart path. - Continues to link to
OperationRunonly when execution is allowed.
AuditLog (audit_logs)
Purpose: Existing audit truth for control changes and blocked execution evidence.
Feature use:
- Records pause, update, resume, and blocked-execution events with stable action IDs.
- Avoids introducing a second historical record model for the first slice.
New Persisted Entity
OperationalControlActivation (operational_control_activations)
Purpose: The active runtime-safety record that pauses one bounded control key for either all workspaces or one specific workspace.
Key fields:
idcontrol_key— bounded to the first-slice catalog keysfindings.lifecycle.backfillandrestore.executescope_type—globalorworkspaceworkspace_id— nullable; required whenscope_type = workspacereason_textexpires_at— nullablecreated_by_platform_user_idupdated_by_platform_user_id— nullablecreated_atupdated_at
Display rule:
owneron the controls surface resolves toupdated_by_platform_user_idwhen present, otherwisecreated_by_platform_user_id.
Constraints:
- At most one active row per
control_key + scope_type + workspace_idcombination. workspace_idmust be null forglobalscope and present forworkspacescope.- Expired rows are ignored by the evaluator.
- PostgreSQL uniqueness is enforced with partial unique indexes: one active global row per
control_keywherescope_type = global, and one active workspace row percontrol_key + workspace_idwherescope_type = workspace. - Writes must delete expired conflicting rows before inserting a new activation so ignored expired rows do not block a new active pause.
Lifecycle:
- Created when a control is paused.
- Updated when reason or expiry changes.
- Expired rows are deleted by the write path before a replacement activation for the same control/scope is inserted.
- Removed when the control is resumed.
- No explicit
enabledrows are stored; enabled is derived from no active matching row.
Relationships:
- Optionally
belongsTo Workspace createdBy/updatedByplatform-user relations if the existing platform-user model supports them
Derived Runtime Entities
OperationalControlDefinition (derived, not persisted)
Purpose: Catalog metadata for one controllable risky action.
Proposed runtime fields:
keylabelsupported_scopesoperation_typesaffected_surfacesdefault_state(derivedenabled)
Feature use:
- Drives the controls page and evaluator without turning the catalog into a user-managed taxonomy.
OperationalControlDecision (derived, not persisted)
Purpose: The evaluated result returned to an affected surface or service start seam.
Proposed runtime fields:
control_keyeffective_state—enabledorpausedmatched_scope_type—global,workspace, ornoneworkspace_id— nullablereason_text— nullable when enabledexpires_at— nullablesource_activation_id— nullable
Feature use:
- Tells a surface whether execution may proceed.
- Supplies one shared reason for blocked-state messaging and audit context.
Evaluation Rules
- The evaluator resolves workspace context before checking control scope.
- A matching global activation wins over a workspace activation in v1. Workspace-scoped activations only take effect when no active global activation exists for the same control.
- Expired activations do not block execution.
- Missing entitlement or missing capability is resolved before control-state disclosure on tenant/admin surfaces.
Data Ownership Notes
- No tenant-owned control records are introduced in the first slice.
- Control activations are platform-operated runtime-safety truth.
- Global control changes audit as platform-plane events with null workspace/tenant ownership.
- Workspace-targeted changes and blocked execution events with concrete workspace/tenant context retain truthful workspace/tenant audit scope.
- Blocked system-plane all-tenant attempts audit as platform-plane events with null workspace/tenant ownership plus requested-scope metadata.
- Tenant/admin surfaces consume only the derived decision, never direct activation editing.