Implements platform feature branch `358-operationrun-queue-truth-foundation`. Target branch: `platform-dev`. Follow-up integration path after merge: `platform-dev` -> `dev`. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #429
15 KiB
Tasks: OperationRun Queue Truth Foundation
Input: specs/358-operationrun-queue-truth-foundation/spec.md, plan.md, and checklists/requirements.md
Prerequisites: spec.md and plan.md
Tests: REQUIRED (Pest). Keep proof bounded to one unit family plus focused monitoring/detail feature tests.
Operations: No new OperationRun type, no new queue family, no new notification path, no new reconciliation command, and no new persisted lifecycle state.
RBAC: Reuse current workspace and managed-environment authorization rules; presentation must never reveal unauthorized runs.
Shared Pattern Reuse: Reuse OperationRunProgressContract, RunDurationInsights, OperationUxPresenter, OperationRunFreshnessState, and existing monitoring renderers. Do not introduce a new adapter registry or queue-health framework.
Filament / Panel Guardrails: Filament remains v5 on Livewire v4. Provider registration stays in apps/platform/bootstrap/providers.php. No new panel, route family, or asset strategy is allowed.
Organization: Tasks are grouped by user story so the generic derivation, surface retrofit, and follow-up guardrails remain independently reviewable.
Test Governance Checklist
- Lane assignment is named and is the narrowest sufficient proof for the changed behavior.
- New or changed tests stay in the smallest honest family, and no hidden browser or heavy-governance proof is introduced.
- Shared helpers, fixtures, and context defaults stay cheap by default.
- Planned validation commands cover the change without widening into unrelated lanes.
- The declared monitoring/detail surface test profile is explicit.
- Any material budget, baseline, or escalation note is recorded in the active feature close-out.
Phase 1: Setup (Shared Truth Inventory)
Purpose: confirm the current contradiction and the exact shared helper boundaries before runtime edits begin.
- T001 Review
specs/358-operationrun-queue-truth-foundation/spec.md,plan.md,checklists/requirements.md,.specify/memory/constitution.md,docs/ai-coding-rules.md,specs/149-queued-execution-reauthorization/spec.md,specs/160-operation-lifecycle-guarantees/spec.md,specs/233-stale-run-visibility/spec.md,specs/268-operationrun-activity-feedback/spec.md,specs/270-operationrun-progress-contract/spec.md, andspecs/272-operationrun-phase-composite-progress/spec.mdtogether so the implementation stays on current repo truth. - T002 [P] Confirm the current generic derivation seams in
apps/platform/app/Support/OpsUx/OperationRunProgressContract.php,apps/platform/app/Support/OpsUx/RunDurationInsights.php,apps/platform/app/Support/OpsUx/OperationUxPresenter.php, andapps/platform/app/Support/Operations/OperationRunFreshnessState.php. - T003 [P] Confirm the current render seams in
apps/platform/resources/views/livewire/bulk-operation-progress.blade.php,apps/platform/app/Filament/Pages/Monitoring/Operations.php,apps/platform/resources/views/filament/pages/monitoring/operations.blade.php,apps/platform/app/Filament/Resources/OperationRunResource.phpas the shared table/detail seam, andapps/platform/app/Filament/Pages/Operations/TenantlessOperationRunViewer.php. - T004 [P] Confirm the focused proof owners in
apps/platform/tests/Unit/Support/OpsUx/OperationRunProgressContractTest.php,apps/platform/tests/Feature/OpsUx/ActivityFeedbackSurfaceTest.php,apps/platform/tests/Feature/OpsUx/BulkOperationProgressDbOnlyTest.php,apps/platform/tests/Feature/MonitoringOperationsTest.php,apps/platform/tests/Feature/Monitoring/OperationLifecycleFreshnessPresentationTest.php,apps/platform/tests/Feature/Monitoring/MonitoringOperationsTest.php,apps/platform/tests/Feature/Filament/OperationRunEnterpriseDetailPageTest.php, andapps/platform/tests/Feature/Operations/TenantlessOperationRunViewerTest.php.
Phase 2: Foundational (Blocking Queue-Truth Contract)
Purpose: settle one generic queue-truth contract before any individual surface is updated.
Critical: No user-story runtime work should begin until this phase is complete.
- T005 [P] Add or extend failing unit coverage in
apps/platform/tests/Unit/Support/OpsUx/OperationRunProgressContractTest.phpfor fresh queued, stale queued, fresh running, stale running, determinate-progress stale running, unsupported lifecycle, and reconciled-terminal cases. - T006 [P] Add or extend focused feature coverage in
apps/platform/tests/Feature/OpsUx/ActivityFeedbackSurfaceTest.php,apps/platform/tests/Feature/OpsUx/BulkOperationProgressDbOnlyTest.php, andapps/platform/tests/Feature/Monitoring/OperationLifecycleFreshnessPresentationTest.phpproving that stale-active runs do not mix stale attention with ordinary queue/progress reassurance. - T007 Freeze the canonical derivation boundary in
apps/platform/app/Support/OpsUx/OperationRunProgressContract.php,apps/platform/app/Support/OpsUx/RunDurationInsights.php,apps/platform/app/Support/OpsUx/OperationUxPresenter.php, andapps/platform/app/Support/Operations/OperationRunFreshnessState.phpwithout introducing new persisted state or a new registry.
Checkpoint: Generic queue truth is derived from one aligned helper path before shell/list/detail surfaces are edited.
Phase 3: User Story 1 - See honest queued and stale truth on active monitoring surfaces (Priority: P1)
Goal: shell and list surfaces no longer mix stale-active attention with calm queue or progress reassurance.
Independent Test: seed fresh and stale queued/running runs, render the shell hint and operations list, and verify that only fresh active work keeps calm queue/progress copy.
Tests for User Story 1
- T008 [P] [US1] Extend
apps/platform/tests/Feature/OpsUx/ActivityFeedbackSurfaceTest.phpandapps/platform/tests/Feature/OpsUx/BulkOperationProgressDbOnlyTest.phpfor stale queued, stale running, and determinate-progress stale-running shell cases. - T009 [P] [US1] Extend
apps/platform/tests/Feature/Monitoring/MonitoringOperationsTest.phpandapps/platform/tests/Feature/Monitoring/OperationLifecycleFreshnessPresentationTest.phpfor operations-list row truth and lifecycle-attention alignment.
Implementation for User Story 1
- T010 [US1] Align generic progress and queue guidance in
apps/platform/app/Support/OpsUx/OperationRunProgressContract.php,apps/platform/app/Support/OpsUx/RunDurationInsights.php, andapps/platform/app/Support/OpsUx/OperationUxPresenter.phpso stale-active work no longer presents ordinary queue/progress reassurance. - T011 [US1] Update
apps/platform/resources/views/livewire/bulk-operation-progress.blade.phpso the shell activity hint consumes the aligned generic queue truth without local contradictory fallback copy. - T012 [US1] Update
apps/platform/app/Filament/Pages/Monitoring/Operations.phpandapps/platform/app/Filament/Resources/OperationRunResource.phponly as needed so the route-backed operations hub plus the shared table/detail summaries expose the same generic queue truth.
Checkpoint: User Story 1 is independently functional when stale-active work reads honestly on shell and list surfaces.
Phase 4: User Story 2 - Keep canonical run detail aligned with generic queue truth (Priority: P1)
Goal: canonical run detail confirms the same lifecycle meaning before deeper diagnostics render.
Independent Test: open canonical detail for fresh, stale, and reconciled runs and verify that top-level lifecycle guidance matches shell/list semantics.
Tests for User Story 2
- T013 [P] [US2] Extend
apps/platform/tests/Feature/Filament/OperationRunEnterpriseDetailPageTest.phpandapps/platform/tests/Feature/Operations/TenantlessOperationRunViewerTest.phpfor fresh, stale, and reconciled-terminal top-summary behavior. - T014 [P] [US2] Extend
apps/platform/tests/Feature/Monitoring/MonitoringOperationsTest.phpfor compact-to-detail continuity where the same run is opened from the list after stale-active presentation.
Implementation for User Story 2
- T015 [US2] Update
apps/platform/app/Filament/Pages/Operations/TenantlessOperationRunViewer.phpso lifecycle banners and detail guidance reflect the aligned generic queue truth before raw diagnostics. - T016 [US2] Update
apps/platform/app/Support/OpsUx/OperationUxPresenter.phpand any touchedOperationRunResourcesummary helpers so canonical detail and resource detail stay aligned.
Checkpoint: User Story 2 is independently functional when canonical detail confirms, rather than contradicts, generic queue truth.
Phase 5: User Story 3 - Keep proof-backed reconciliation separate from generic queue truth (Priority: P2)
Goal: generic stale wording stays cautious, while existing scheduled/adapter reconciliation remains authoritative for terminal truth.
Independent Test: compare stale active runs and already-reconciled terminal runs to verify that cautious generic wording and existing reconciled semantics both survive.
Tests for User Story 3
- T017 [P] [US3] Extend unit or feature coverage, including
apps/platform/tests/Feature/MonitoringOperationsTest.phpwhere the operations aggregate wording is already asserted, so stale active runs without strong legitimacy evidence do not claim orphaned or domain-complete truth while existing scheduled/adapter-reconciled terminal runs keep their terminal semantics. - T018 [P] [US3] Extend
apps/platform/tests/Feature/Operations/TenantlessOperationRunViewerTest.phpor the nearest focused monitoring suite for reconciled-terminal detail language regression protection.
Implementation for User Story 3
- T019 [US3] Tighten cautious stale-active wording in
apps/platform/app/Support/OpsUx/RunDurationInsights.phpandapps/platform/app/Support/OpsUx/OperationUxPresenter.phpso the generic path says only what current lifecycle truth can prove. - T020 [US3] Confirm
apps/platform/app/Console/Commands/TenantpilotReconcileOperationRuns.phpandapps/platform/app/Console/Commands/OpsReconcileAdapterRuns.phpneed no runtime change and document that no command-layer change was required.
Checkpoint: User Story 3 is independently functional when generic stale wording stays cautious and existing terminal reconciliation remains intact.
Phase 6: Polish & Cross-Cutting Validation
Purpose: validate the bounded slice, stop drift, and hand off a clean implementation path.
- T021 [P] Refresh
specs/358-operationrun-queue-truth-foundation/spec.md,plan.md, andchecklists/requirements.mdonly if implementation proves a thinner or broader touched-file boundary. - T022 [P] Run
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Support/OpsUx/OperationRunProgressContractTest.php. - T023 [P] Run
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/OpsUx/ActivityFeedbackSurfaceTest.php tests/Feature/OpsUx/BulkOperationProgressDbOnlyTest.php tests/Feature/MonitoringOperationsTest.php tests/Feature/Monitoring/OperationLifecycleFreshnessPresentationTest.php tests/Feature/Monitoring/MonitoringOperationsTest.php tests/Feature/Filament/OperationRunEnterpriseDetailPageTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.php. - T024 [P] Run
cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agentfor touched platform files. - T025 [P] Run
git diff --check. - T026 [P] Record the final queue-truth wording, proof boundaries, and any retained cautious-language decisions in the active feature close-out entry
Guardrail / Smoke Coverage.
Dependencies & Execution Order
Phase Dependencies
- Setup (Phase 1): no dependencies
- Foundational (Phase 2): depends on Setup and blocks all story work
- US1 (Phase 3): depends on Foundational completion
- US2 (Phase 4): depends on Foundational completion and is easiest after US1 settles the shared wording
- US3 (Phase 5): depends on US1 and US2 because it confirms the final generic truth boundary
- Polish (Phase 6): depends on all desired user stories
Parallel Opportunities
T002,T003, andT004can run in parallel.T005andT006can run in parallel after the current contradiction is confirmed.T008andT009can run in parallel.T013andT014can run in parallel.T022,T023,T024, andT025can run in parallel after implementation is stable.
Implementation Strategy
- Freeze the shared queue-truth derivation first.
- Ship US1 to remove the stale-vs-queue contradiction on shell/list surfaces.
- Ship US2 so canonical detail confirms the same truth.
- Ship US3 to protect the narrow boundary against overclaiming or framework creep.
- Finish with the focused validation commands and close-out notes.
Guardrail / Smoke Coverage
- Final queue-truth wording keeps stale-active guidance at
Past the lifecycle window. Review worker health and logs before retrying.and removes competing calm queue/progress copy from shell, list, and top-level detail surfaces. - Proof boundary remains shared-first:
OperationRunProgressContractowns stale-active progress truth,OperationUxPresenterowns aligned lifecycle/detail guidance, and the shell/list/detail surfaces consume those shared seams instead of local fallback wording. - Browser smoke path used the real local route
GET /admin/local/smoke-loginand verified/admin/workspaces/38/operationsfollowed by the primaryOpen operationdrilldown to/admin/workspaces/38/operations/82. - Browser smoke confirmed stale wording is visible on both hub and detail, while
Waiting for worker.,Progress details pending., and4 / 10 processed (40%)do not appear as primary stale-active guidance. - No runtime change was required in
apps/platform/app/Filament/Pages/Monitoring/Operations.php,apps/platform/app/Filament/Resources/OperationRunResource.php,apps/platform/app/Filament/Pages/Operations/TenantlessOperationRunViewer.php,apps/platform/app/Console/Commands/TenantpilotReconcileOperationRuns.php, orapps/platform/app/Console/Commands/OpsReconcileAdapterRuns.php; the existing shared seams consumed the contract/presenter updates directly. - Validation evidence:
cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Support/OpsUx/OperationRunProgressContractTest.phpcd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/OpsUx/BulkOperationProgressDbOnlyTest.php tests/Feature/OpsUx/ActivityFeedbackSurfaceTest.phpcd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/MonitoringOperationsTest.php tests/Feature/Monitoring/OperationLifecycleFreshnessPresentationTest.php tests/Feature/Monitoring/MonitoringOperationsTest.phpcd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/OperationRunEnterpriseDetailPageTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.phpcd apps/platform && ./vendor/bin/sail bin pint --dirty --format agentgit diff --check