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:
2026-09-27 23:06:16 -04:00
parent eb2a852fdc
commit fb48f64de1
36 changed files with 1634 additions and 421 deletions
+10
View File
@@ -0,0 +1,10 @@
/** File/history unit tests simulate the activation leaf. Provisioning tests cover
* the occupancy, capacity, source, and restart gates before reaching this leaf. */
export async function activateFiles(kind: 'beta' | 'campaign', id: number | string): Promise<void> {
const { stagedFileChanges, applyStagedFilesForOperation } = await import('../../src/lib/server/fleet/staged-files.js');
const { requestRestart } = await import('../../src/lib/server/provisioning/index.js');
for (const server of new Set(stagedFileChanges(kind, String(id)).filter(row => row.state === 'pending').map(row => row.server))) {
const operation = requestRestart(server, { kind, id: String(id) });
applyStagedFilesForOperation(operation.id, server);
}
}