Defer server file changes until guarded restart activation
Persist beta, promotion, drift, and rollback payloads until occupancy and restart-capacity checks pass. Preserve rollback snapshots and campaign ordering, and allow held rollback campaigns to resume safely. Fixes #28 Validation: 805 tests passed, Svelte checks clean, production build passed.
This commit is contained in:
@@ -8,7 +8,7 @@ interface BetaServer {
|
||||
|
||||
export function betaFlow(beta: { state: string; wait_for_health: number; wait_for_match: number; testPlan?: boolean }, servers: BetaServer[]): OperationStep[] {
|
||||
const stages = ['deploying', 'awaiting-empty', 'restarting'];
|
||||
const labels = ['Deploy artifacts', 'Wait for empty servers', 'Restart servers'];
|
||||
const labels = ['Stage file changes', 'Wait for empty servers', 'Apply files and restart'];
|
||||
if (beta.wait_for_health) { stages.push('awaiting-health'); labels.push('Verify health'); }
|
||||
if (beta.wait_for_match) { stages.push('awaiting-match'); labels.push('Observe a completed match'); }
|
||||
if (beta.testPlan) { stages.push('observing'); labels.push('Evaluate test requirements'); }
|
||||
@@ -30,13 +30,13 @@ export function betaFlow(beta: { state: string; wait_for_health: number; wait_fo
|
||||
}
|
||||
|
||||
export function campaignFlow(servers: { restart_state: string; restarted_at: string | null; files_changed: number }[], finished: boolean): OperationStep[] {
|
||||
const positions = servers.map(s => s.restart_state === 'done' ? 4
|
||||
: s.restart_state === 'failed' && !s.files_changed ? 0
|
||||
: s.restarted_at ? 3 : 1);
|
||||
const active = servers.filter(s => !['skipped', 'cancelled'].includes(s.restart_state));
|
||||
const positions = active.map(s => s.restart_state === 'done' ? 4
|
||||
: s.restarted_at ? 3 : 0);
|
||||
const current = positions.length ? Math.min(...positions) : finished ? 4 : 0;
|
||||
return ['Apply file changes', 'Wait for empty servers', 'Restart servers', 'Verify health'].map((label, i) => ({
|
||||
return ['Wait for empty servers and restart capacity', 'Apply file changes', 'Restart servers', 'Verify health'].map((label, i) => ({
|
||||
label, state: i < current ? 'done' : i !== current ? 'pending'
|
||||
: servers.some((s, j) => s.restart_state === 'failed' && positions[j] === i) ? 'failed'
|
||||
: servers.some(s => ['manual', 'held'].includes(s.restart_state)) ? 'pending' : 'current'
|
||||
: active.some((s, j) => s.restart_state === 'failed' && positions[j] === i) ? 'failed'
|
||||
: active.some(s => ['manual', 'held'].includes(s.restart_state)) ? 'pending' : 'current'
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user