multi script beta
This commit is contained in:
@@ -70,18 +70,15 @@ function reconcileBetaState(betaId: number): void {
|
||||
.prepare(`UPDATE betas SET state = 'ready-promote' WHERE id = ? AND state = 'running'`)
|
||||
.run(betaId);
|
||||
if (upd.changes > 0) {
|
||||
// The version that just cleared its beta gate is now considered
|
||||
// tested. This survives promote (tested → promoted is derived from
|
||||
// Every version bundled into this beta just cleared its gate.
|
||||
// 'tested' survives promote (tested → promoted is derived from
|
||||
// scripts.current_version_id, not stored) and reject (rollbackBeta
|
||||
// demotes back to test-failed).
|
||||
const beta = db()
|
||||
.prepare(`SELECT script_version_id FROM betas WHERE id = ?`)
|
||||
.get(betaId) as { script_version_id: number } | undefined;
|
||||
if (beta) {
|
||||
db()
|
||||
.prepare(`UPDATE script_versions SET state = 'tested' WHERE id = ?`)
|
||||
.run(beta.script_version_id);
|
||||
}
|
||||
// demotes back to test-failed per-version).
|
||||
const versionRows = db()
|
||||
.prepare(`SELECT script_version_id FROM beta_scripts WHERE beta_id = ?`)
|
||||
.all(betaId) as Array<{ script_version_id: number }>;
|
||||
const markTested = db().prepare(`UPDATE script_versions SET state = 'tested' WHERE id = ?`);
|
||||
for (const v of versionRows) markTested.run(v.script_version_id);
|
||||
}
|
||||
emit({ type: 'beta-state', betaId, state: 'ready-promote' });
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export type PipelineEvent =
|
||||
}
|
||||
| { type: 'sweep-tick'; frozen: boolean; reason?: string }
|
||||
| { type: 'server-status'; entries: ServerStatusEntry[] }
|
||||
| { type: 'beta-opened'; betaId: number; scriptId: number; servers: string[] }
|
||||
| { type: 'beta-opened'; betaId: number; scriptIds: number[]; servers: string[] }
|
||||
| {
|
||||
type: 'beta-server-stage';
|
||||
betaId: number;
|
||||
|
||||
Reference in New Issue
Block a user