TenantAtlas/specs/123-operations-auto-refresh/quickstart.md
2026-03-08 11:34:09 +01:00

46 lines
2.4 KiB
Markdown

# Quickstart — Operations Auto-Refresh Pass
## Goal
Implement conditional auto-refresh for the tenantless operation run viewer and the tenant review pack card so active work updates without manual refresh and terminal states remain stable.
## Prerequisites
- Laravel Sail services are running.
- A queue worker is available so active states can advance during manual QA.
- Seed or factory data exists for one active and one terminal example of each surface.
## Implementation Steps
1. Reuse the canonical run-detail polling behavior for `TenantlessOperationRunViewer` rather than introducing a second run-detail polling policy.
2. Add review-pack-card polling that emits a `10s` interval only when the latest tenant review pack is `queued` or `generating`.
3. Keep terminal review-pack states (`ready`, `failed`, `expired`) and empty-state rendering non-polling.
4. Add or update Pest coverage for active-versus-terminal polling behavior on both surfaces.
## Automated Verification
Run the smallest relevant test set through Sail:
- `vendor/bin/sail artisan test --compact tests/Feature/OpsUx/RunDetailPollingStopsOnTerminalTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/Operations/TenantlessOperationRunViewerTest.php`
- `vendor/bin/sail artisan test --compact tests/Feature/ReviewPack/ReviewPackWidgetTest.php`
Then format touched files:
- `vendor/bin/sail bin pint --dirty --format agent`
## Manual QA
### Tenantless operation run viewer
1. Open a queued or running operation at `/admin/operations/{run}`.
2. Keep the page open and confirm the run detail refreshes while the run remains active.
3. Let the run finish and confirm the page settles into a stable terminal state without further refresh behavior.
4. Open an already-completed run and confirm it loads without active polling.
### Tenant review pack card
1. Open the tenant-scoped page that renders `TenantReviewPackCard`.
2. Trigger review-pack generation and confirm the card shows in-progress state without manual refresh.
3. Wait for the pack to finish and confirm the card settles into `Ready` or `Failed` without continuing to poll.
4. Re-open a terminal review pack state and confirm no polling markup is present.
## Rollback
- Remove the new polling condition from the review pack card.
- Revert any tenantless viewer changes so it falls back to the previous non-refreshing behavior.
- Re-run the targeted Pest files to confirm the rollback is clean.