Add configurable beta test plans and staged rollout

This commit is contained in:
2026-09-17 21:35:28 -04:00
parent 5b5266da3a
commit a50eae9d21
26 changed files with 1518 additions and 44 deletions
+9
View File
@@ -8,6 +8,8 @@ import {
} from '$lib/server/fleet/beta.js';
import { getScript, getVersion } from '$lib/server/fleet/scripts.js';
import { kick } from '$lib/server/pipeline/worker.js';
import { parseBetaPlan, type BetaPlan } from '$lib/beta-plan.js';
import { storedPlan } from '$lib/server/fleet/beta-tests.js';
export async function GET({ url }: { url: URL }) {
const stateFilter = url.searchParams.get('state') as
@@ -32,6 +34,7 @@ export async function GET({ url }: { url: URL }) {
});
return {
...b,
testOutcome: storedPlan(b.id)?.outcome ?? null,
scripts,
servers: listBetaServers(b.id)
};
@@ -51,7 +54,9 @@ export async function POST({ request }: { request: Request }) {
waitForHealth?: boolean;
waitForMatch?: boolean;
notes?: string;
testPlan?: BetaPlan;
};
if (!body || typeof body !== 'object' || Array.isArray(body)) return json({ ok: false, error: 'Expected a JSON object' }, { status: 400 });
// Normalize into the openBeta shape. Both fields feed the same list.
const rawEntries: Array<{ scriptId?: number; scriptVersionId?: number }> = [];
@@ -82,7 +87,11 @@ export async function POST({ request }: { request: Request }) {
}
try {
let testPlan: BetaPlan | undefined;
try { if (body.testPlan !== undefined) testPlan = parseBetaPlan(body.testPlan); }
catch (error) { return json({ ok: false, error: (error as Error).message }, { status: 400 }); }
const result = await openBeta({
testPlan,
scripts: normalized,
servers: body.servers,
waitForHealth: body.waitForHealth ?? true,