## Summary - harden operation-run lifecycle handling with explicit reconciliation policy, stale-run healing, failed-job bridging, and monitoring visibility - refactor audit log event inspection into a Filament slide-over and remove the stale inline detail/header-action coupling - align panel theme asset resolution and supporting Filament UI updates, including the rounded 2xl theme token regression fix ## Testing - ran focused Pest coverage for the affected audit-log inspection flow and related visibility tests - ran formatting with `vendor/bin/sail bin pint --dirty --format agent` - manually verified the updated audit-log slide-over flow in the integrated browser ## Notes - branch includes the Spec 160 artifacts under `specs/160-operation-lifecycle-guarantees/` - the full test suite was not rerun as part of this final commit/PR step Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #190
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Jobs\Concerns;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Services\OperationRunService;
|
|
use Throwable;
|
|
|
|
trait BridgesFailedOperationRun
|
|
{
|
|
public function failed(Throwable $exception): void
|
|
{
|
|
$operationRun = $this->failedBridgeOperationRun();
|
|
|
|
if (! $operationRun instanceof OperationRun) {
|
|
return;
|
|
}
|
|
|
|
app(OperationRunService::class)->bridgeFailedJobFailure($operationRun, $exception);
|
|
}
|
|
|
|
protected function failedBridgeOperationRun(): ?OperationRun
|
|
{
|
|
if (property_exists($this, 'operationRun') && $this->operationRun instanceof OperationRun) {
|
|
return $this->operationRun;
|
|
}
|
|
|
|
if (property_exists($this, 'run') && $this->run instanceof OperationRun) {
|
|
return $this->run;
|
|
}
|
|
|
|
$candidateIds = [];
|
|
|
|
foreach (['operationRunId', 'bulkRunId', 'runId'] as $property) {
|
|
if (! property_exists($this, $property)) {
|
|
continue;
|
|
}
|
|
|
|
$value = $this->{$property};
|
|
|
|
if (is_numeric($value) && (int) $value > 0) {
|
|
$candidateIds[] = (int) $value;
|
|
}
|
|
}
|
|
|
|
foreach (array_values(array_unique($candidateIds)) as $candidateId) {
|
|
$operationRun = OperationRun::query()->find($candidateId);
|
|
|
|
if ($operationRun instanceof OperationRun) {
|
|
return $operationRun;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|