fix(traces): unify script execution trace status to IN_PROGRESS and restore cancel restrictions
ogcore-debian-package/pipeline/tag There was a failure building this commit Details
ogcore-debian-package/pipeline/head This commit looks good Details
testing/ogcore-api/pipeline/head There was a failure building this commit Details

devel 1.14.2
Juan Manuel Bardallo 2026-10-22 13:56:07 +02:00
parent f6ff7c1e7d
commit e860cf872c
4 changed files with 9 additions and 19 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## [1.14.2] - 2026-10-22
### Fixed
- **Consistencia de Estado en Trazas de Script (`RunScriptAction`, `CancelMultipleTracesAction`)**:
- `RunScriptAction`: Al actualizar trazas existentes desde la cola pendientes (`updateExistingTrace`), se unifica el estado a `IN_PROGRESS` (en lugar de `SENT`), alineándolo con la ejecución directa y con el estándar de scripts del sistema.
- `CancelMultipleTracesAction`: Revertida la cancelación de trazas en `SENT`, manteniendo la regla estricta que solo permite cancelar trazas en estado `pending` o `in-progress`.
## [1.14.1] - 2026-10-22
### Fixed

View File

@ -38,16 +38,6 @@ class CancelMultipleTracesAction extends AbstractController
$trace->setStatus(TraceStatus::CANCELLED);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);
} elseif ($trace->getStatus() === TraceStatus::SENT) {
if ($trace->getJobId()) {
try {
$this->killJobService->kill($trace, (string) $trace->getJobId());
} catch (\Throwable) {
}
}
$trace->setStatus(TraceStatus::CANCELLED);
$trace->setFinishedAt(new \DateTime());
$this->entityManager->persist($trace);
} else {
$failed[] = ['trace' => $trace->getUuid(), 'reason' => 'not cancellable'];
continue;

View File

@ -275,7 +275,7 @@ class RunScriptAction extends AbstractOgAgentController
private function updateExistingTrace(Trace $trace, string $jobId, array $inputData, Client $client): void
{
$status = ($this->isLinuxOrWindows($client) || $this->isLinuxOrWindowsSession($client)) ? TraceStatus::SENT : TraceStatus::IN_PROGRESS;
$status = TraceStatus::IN_PROGRESS;
$trace->setStatus($status);
$trace->setJobId($jobId);
$this->entityManager->persist($trace);

View File

@ -173,14 +173,7 @@ class StatusController extends AbstractController
$clientIp = $data['iph'] ?? $request->getClientIp();
$client = $this->entityManager->getRepository(Client::class)->findOneBy(['ip' => $clientIp]);
if ($client) {
$traces = $this->entityManager->getRepository(Trace::class)
->createQueryBuilder('t')
->where('t.client = :client')
->andWhere('t.status IN (:statuses)')
->setParameter('client', $client)
->setParameter('statuses', [TraceStatus::IN_PROGRESS, TraceStatus::SENT])
->getQuery()
->getResult();
$traces = $this->entityManager->getRepository(Trace::class)->findBy(['client' => $client, 'status' => TraceStatus::IN_PROGRESS]);
foreach ($traces as $trace) {
$trace->setStatus(TraceStatus::SUCCESS);
$trace->setFinishedAt(new \DateTime());