(snapshot)
| 459 | }; |
| 460 | } |
| 461 | |
| 462 | function annotateOperatorArtifacts(snapshot) { |
| 463 | const artifacts = snapshot.operatorArtifacts || {}; |
| 464 | const currentCommand = snapshot.nextAction?.command || ''; |
| 465 | const hasRepairs = (snapshot.repairs || []).length > 0; |
| 466 | |
| 467 | if (artifacts.nextActionReport) { |
| 468 | const staleReasons = []; |
| 469 | if (artifacts.nextActionReport.outcome === 'idle' && hasRepairs) { |
| 470 | staleReasons.push('latest report says idle but dashboard has a queued action'); |
| 471 | } |
| 472 | if (artifacts.nextActionReport.finalCommand && artifacts.nextActionReport.finalCommand !== currentCommand) { |
| 473 | staleReasons.push(`latest report final command is ${artifacts.nextActionReport.finalCommand}, current command is ${currentCommand}`); |
| 474 | } |
| 475 | Object.assign(artifacts.nextActionReport, freshness('current', staleReasons)); |
| 476 | } |
| 477 | |
| 478 | if (artifacts.approvalCapsule) { |
| 479 | const staleReasons = []; |
| 480 | if (!hasRepairs) { |
| 481 | staleReasons.push('no current repair or approval boundary is queued'); |
| 482 | } else if (artifacts.approvalCapsule.command && artifacts.approvalCapsule.command !== currentCommand) { |
| 483 | staleReasons.push(`capsule command is ${artifacts.approvalCapsule.command}, current command is ${currentCommand}`); |
| 484 | } |
| 485 | Object.assign(artifacts.approvalCapsule, freshness('current', staleReasons)); |
| 486 | } |
| 487 | |
| 488 | return artifacts; |
| 489 | } |
| 490 | |
| 491 | function describeTelemetry(entry) { |
no test coverage detected