Fix failed provisioning progress states (Refs #80)

This commit is contained in:
2026-10-09 10:21:02 -04:00
parent dbbe3749e2
commit 29c2e3ba00
3 changed files with 69 additions and 7 deletions
+7 -4
View File
@@ -45,6 +45,7 @@ export function provisioningGroups(detail: ProvisioningDetail): ProgressGroup[]
const phases = groups.flatMap(group => group.phases);
const current = progress.phase ? phases.indexOf(progress.phase) : -1;
const active = activeProvisioningStates.includes(detail.deployment.state);
const failure = ['failed', 'interrupted'].includes(detail.deployment.state);
return groups.map(group => {
const steps = group.phases.map((key): ProgressStep => {
const checkpoint = progress.checkpoints.find(item => item.key === key);
@@ -53,12 +54,14 @@ export function provisioningGroups(detail: ProvisioningDetail): ProgressGroup[]
const check = checkKey ? progress.checks.find(item => item.key === checkKey) : null;
const index = phases.indexOf(key);
const isCurrent = key === progress.phase;
const state: ProgressState = check ? ({ pass: 'done', fail: 'failed', waiting: 'waiting', unknown: 'unknown' } as const)[check.result]
let state: ProgressState = check ? ({ pass: 'done', fail: 'failed', waiting: 'waiting', unknown: 'unknown' } as const)[check.result]
: checkpoint ? 'done'
: isCurrent && ['failed', 'interrupted'].includes(detail.deployment.state) ? 'failed'
: isCurrent && failure ? 'failed'
: isCurrent && active ? progress.blocker || ['waiting', 'queued'].includes(detail.deployment.state) ? 'waiting' : 'current'
: current >= 0 && index >= current && detail.deployment.state === 'cancelled' ? 'cancelled'
: current >= 0 && index >= current && (failure || detail.deployment.state === 'cancelled') ? 'cancelled'
: active && current >= 0 && index > current ? 'pending' : 'unknown';
// Preserve completed evidence, but outstanding work cannot keep waiting after failure.
if (failure && (state === 'waiting' || (isCurrent && state === 'unknown'))) state = 'failed';
const label = key === 'startup-queue' ? 'Admit to startup capacity'
: key === 'prepare' ? 'Prepare launch payload'
: key === 'container-action' ? `${actionLabels[detail.deployment.action]} instance through host agent`
@@ -73,7 +76,7 @@ export function provisioningGroups(detail: ProvisioningDetail): ProgressGroup[]
}
export const progressStateLabels: Record<ProgressState, string> = {
done: 'Completed', current: 'In progress', waiting: 'Waiting', failed: 'Needs attention', pending: 'Not started', cancelled: 'Not run', unknown: 'Not recorded'
done: 'Completed', current: 'In progress', waiting: 'Waiting', failed: 'Stopped here', pending: 'Not started', cancelled: 'Not run', unknown: 'Not recorded'
};
export const progressIcons: Record<ProgressState, string> = { done: '✓', current: '•', waiting: '◷', failed: '!', pending: '○', cancelled: '–', unknown: '?' };