## Summary - add conditional polling support for the tenantless operation run viewer and tenant review pack card - add focused Pest coverage for active vs terminal polling behavior and related review pack access regressions - add the full Spec Kit artifacts for Spec 123, including spec, plan, research, data model, contracts, quickstart, tasks, and checklist ## Testing - `vendor/bin/sail artisan test --compact tests/Feature/OpsUx/RunDetailPollingStopsOnTerminalTest.php tests/Feature/Operations/TenantlessOperationRunViewerTest.php tests/Feature/ReviewPack/ReviewPackWidgetTest.php tests/Feature/ReviewPack/ReviewPackGenerationTest.php tests/Feature/ReviewPack/ReviewPackRbacTest.php` - `vendor/bin/sail bin pint --dirty --format agent` ## Notes - Manual QA task `T014` in the Spec Kit checklist remains to be completed outside this automated flow. - Livewire v4.0+ compliance is unchanged. - No panel provider changes were made; provider registration remains in `bootstrap/providers.php`. - No global-search behavior was changed. - No destructive actions were added or modified. - No new Filament assets were introduced; existing deployment expectations for `php artisan filament:assets` remain unchanged. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #149
37 lines
815 B
PHP
37 lines
815 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\OpsUx;
|
|
|
|
use App\Models\OperationRun;
|
|
|
|
final class RunDetailPolling
|
|
{
|
|
/**
|
|
* Returns a Livewire polling interval string (e.g. "1s") while the run is active.
|
|
* Returns null once the run is terminal.
|
|
*/
|
|
public static function interval(OperationRun $run): ?string
|
|
{
|
|
$uxStatus = OperationStatusNormalizer::toUxStatus($run->status, $run->outcome);
|
|
|
|
if (! in_array($uxStatus, ['queued', 'running'], true)) {
|
|
return null;
|
|
}
|
|
|
|
$ageSeconds = $run->created_at?->diffInSeconds(now()) ?? 0;
|
|
$ageSeconds = abs((int) $ageSeconds);
|
|
|
|
if ($ageSeconds < 10) {
|
|
return '1s';
|
|
}
|
|
|
|
if ($ageSeconds < 60) {
|
|
return '5s';
|
|
}
|
|
|
|
return '10s';
|
|
}
|
|
}
|