Simplify telemetry to three game events

This commit is contained in:
2026-09-18 15:35:21 -04:00
parent 6d903adb31
commit 5bb49a776e
29 changed files with 658 additions and 1314 deletions
+10
View File
@@ -33,6 +33,16 @@ export async function POST({ params, request }: { params: { id: string }; reques
betaState(id, false);
} else if (body.action === 'resume') {
if (stored.outcome !== 'paused') throw new Error('Only paused plans can resume; failed or expired plans need a fresh attempt');
const runs = db().prepare('SELECT * FROM beta_test_runs WHERE beta_id = ? AND retired_at IS NULL').all(id) as Parameters<typeof readMetrics>[0][];
for (const run of runs) {
const metrics = readMetrics(run);
delete metrics.match;
delete metrics.lastSample;
delete metrics.wasHealthy;
metrics.streaks = {};
for (const r of plan.requirements) if (r.kind === 'healthy-minutes') metrics.values[r.id] = 0;
saveMetrics(run, metrics);
}
setOutcome(id, 'active', null);
} else if (body.action === 'retry') {
// Fresh attempts keep their predecessors as audit history. Preserve the original deadline: