Defer promotion snapshots to campaign activation

This commit is contained in:
2026-10-06 00:16:43 -04:00
parent d6ff59b129
commit 9fd448339d
15 changed files with 179 additions and 56 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ export async function GET({ params }: { params: { id: string } }) {
// it opens the diff viewer.
const files = db()
.prepare(
`SELECT id, server, verb, rel_path, sha256_before, sha256_after,
`SELECT id, server, verb, rel_path, sha256_before, sha256_after, snapshot_pending,
LENGTH(content_before) AS size_before,
LENGTH(content_after) AS size_after,
COALESCE((SELECT state FROM staged_file_changes WHERE deployment_file_id = deployment_files.id), 'applied') AS apply_state
@@ -10,7 +10,7 @@ export async function GET({ params }: { params: { id: string; fileId: string } }
}
const row = db()
.prepare(
`SELECT verb, rel_path, sha256_before, sha256_after, content_before, content_after
`SELECT verb, rel_path, sha256_before, sha256_after, content_before, content_after, snapshot_pending
FROM deployment_files
WHERE deployment_id = ? AND id = ?`
)
@@ -22,9 +22,11 @@ export async function GET({ params }: { params: { id: string; fileId: string } }
sha256_after: string | null;
content_before: Buffer | null;
content_after: Buffer | null;
snapshot_pending: number;
}
| undefined;
if (!row) throw error(404, 'file not found');
if (row.snapshot_pending) return json({ error: 'The rollback snapshot is not available yet. It is captured immediately before file activation.' }, { status: 409 });
return json({
verb: row.verb,