3.8 KiB
3.8 KiB
Tasks: Unified Operations Runs Suitewide
Feature: 054-unify-runs-suitewide
Spec: specs/054-unify-runs-suitewide/spec.md
Phase 1: Foundation (DB & Service)
- Migration: Create
operation_runstable with partial unique index on(tenant_id, run_identity_hash)where status inqueued, running. - Model: Create
OperationRunmodel with casts (JSONB for summaries/context), relationship toTenantandUser. - Service: Implement
OperationRunService::ensureRun()(idempotent creation) andupdateRun()methods. - Test: Feature test for
ensureRunverifying idempotency (same hash = same run) and concurrency safety (simulated). - Test: Feature test for
updateRunverifying status transitions and history logging (if any). - Job Middleware: Create
TrackOperationRunmiddleware to automatically handle job success/failure updates for jobs using this system. - Retention: Create a daily scheduled job to prune
operation_runsolder than 90 days.
Phase 2: Monitoring UI (Read-Only)
- Page: Create Filament Page
Monitoring/Operations(List) strictly scoped to current tenant. - Table: Implement
OperationRuntable with columns: Status (Badge), Operation Type, Initiator, Started At, Duration, Outcome. - Filters: Add table filters for
Type,Outcome,Date Range,Initiator. - Detail View: Create "View Run" modal or separate page showing:
- Summary counts (Success/Fail/Total)
- Failure list (Sanitized codes/messages)
- Context JSON (Debug info)
- Timeline (Created/Started/Finished)
- Test: Livewire test verifying
Readonlyusers can see table but no actions. - Test: Verify cross-tenant access is blocked.
Phase 3: Producer Migration (Parallel Write)
Inventory Sync (inventory.sync)
- Refactor: Update
RunInventorySyncJobdispatch logic to callOperationRunService::ensureRun()first. - Refactor: Update Job to use
TrackOperationRunmiddleware (or manual updates) to sync status tooperation_runs. - Verify: Ensure legacy
inventory_sync_runsis still written to (if legacy UI depends on it) OR confirm legacy UI is replaced. Decision: Parallel write as per spec.
Policy Sync (policy.sync)
- Refactor: Update Policy Sync start logic to use
OperationRunService. - Refactor: Instrument Policy Sync job to update
operation_runs.
Directory Groups Sync (directory_groups.sync)
- Refactor: Update Group Sync start logic to use
OperationRunService. - Refactor: Instrument Group Sync job to update
operation_runs.
Drift Generation (drift.generate)
- Refactor: Update Drift Generation start logic to use
OperationRunService. - Refactor: Instrument Drift job to update
operation_runs.
Backup Set (backup_set.add_policies)
- Refactor: Update "Add Policies" action to use
OperationRunService.
Phase 4: Restore Adapter
- Listener: Create
SyncRestoreRunToOperationlistener observingRestoreRunevents (created,updated). - Logic: Map
RestoreRunstatus/outcomes toOperationRunschema.RestoreRuncreated ->OperationRuncreated (queued/running).RestoreRunupdated ->OperationRunupdated.
- Context: Store
{"restore_run_id": <id>}inOperationRun.context. - Test: Verify creating a
RestoreRunautomatically spawns a shadowOperationRun.
Phase 5: Notifications & Polish
- Notifications: Implement Database Notifications for "Run Started" (with link) and "Run Completed" (with outcome).
- Frontend: Ensure "View Run" link in Toast notifications correctly opens the Monitoring Detail view.
- Final Verify: Run through the
requirements.mdchecklist manually.