Simplify telemetry to three game events
This commit is contained in:
+9
-12
@@ -1,5 +1,5 @@
|
||||
export const requirementKinds = ['round', 'matches', 'populated-minutes', 'player-hours', 'population',
|
||||
'sustained-population', 'healthy-minutes', 'failure-budget', 'restart-budget', 'clean-logs', 'recovery', 'feature', 'manual'] as const;
|
||||
'sustained-population', 'healthy-minutes', 'failure-budget', 'recovery', 'manual'] as const;
|
||||
export type RequirementKind = typeof requirementKinds[number];
|
||||
export interface BetaRequirement {
|
||||
id: string;
|
||||
@@ -9,7 +9,6 @@ export interface BetaRequirement {
|
||||
minRound: number;
|
||||
minPlayers: number;
|
||||
minMinutes: number;
|
||||
event: string;
|
||||
}
|
||||
export interface BetaPlan {
|
||||
version: 1;
|
||||
@@ -25,12 +24,11 @@ export const requirementLabels: Record<RequirementKind, string> = {
|
||||
round: 'Reach round', matches: 'Complete qualifying matches', 'populated-minutes': 'Populated minutes',
|
||||
'player-hours': 'Player-hours', population: 'Reach player count', 'sustained-population': 'Sustained population (minutes)',
|
||||
'healthy-minutes': 'Continuous healthy minutes', 'failure-budget': 'Maximum health outages',
|
||||
'restart-budget': 'Maximum unexpected restarts',
|
||||
'clean-logs': 'Maximum script errors', recovery: 'Successful recovery cycles', feature: 'Feature event count', manual: 'Tester checklist'
|
||||
recovery: 'Successful recovery cycles', manual: 'Tester checklist'
|
||||
};
|
||||
export function requirement(kind: RequirementKind, id: string): BetaRequirement {
|
||||
return { id, kind, label: requirementLabels[kind], target: kind === 'round' ? 25 : ['failure-budget', 'restart-budget', 'clean-logs'].includes(kind) ? 0 : 1,
|
||||
minRound: 0, minPlayers: 1, minMinutes: 0, event: '' };
|
||||
return { id, kind, label: requirementLabels[kind], target: kind === 'round' ? 25 : kind === 'failure-budget' ? 0 : 1,
|
||||
minRound: 0, minPlayers: 1, minMinutes: 0 };
|
||||
}
|
||||
export function defaultPlan(): BetaPlan {
|
||||
return { version: 1, requirements: [requirement('healthy-minutes', 'health')], scope: 'all', quorum: 1,
|
||||
@@ -44,7 +42,7 @@ export const builtInPlans: Array<{ name: string; plan: BetaPlan }> = [
|
||||
] } },
|
||||
{ name: 'Long soak', plan: { ...defaultPlan(), timeoutHours: 72, requirements: [
|
||||
{ ...requirement('healthy-minutes', 'health'), target: 360 },
|
||||
{ ...requirement('player-hours', 'participation'), target: 10 }, requirement('clean-logs', 'logs')
|
||||
{ ...requirement('player-hours', 'participation'), target: 10 }, requirement('failure-budget', 'outages')
|
||||
] } }
|
||||
];
|
||||
|
||||
@@ -68,13 +66,12 @@ export function parseBetaPlan(value: unknown): BetaPlan {
|
||||
for (const key of ['target', 'minRound', 'minPlayers', 'minMinutes'] as const) {
|
||||
if (typeof r[key] !== 'number' || !Number.isFinite(r[key]) || r[key] < 0 || r[key] > 1_000_000) throw new Error(`Invalid requirement ${key}`);
|
||||
}
|
||||
if (!['failure-budget', 'restart-budget', 'clean-logs'].includes(r.kind) && r.target <= 0) throw new Error('Requirement target must be positive');
|
||||
if (['round', 'matches', 'population', 'failure-budget', 'restart-budget', 'clean-logs', 'recovery', 'feature', 'manual'].includes(r.kind) && !Number.isInteger(r.target)) throw new Error('Count targets must be integers');
|
||||
if (r.kind !== 'failure-budget' && r.target <= 0) throw new Error('Requirement target must be positive');
|
||||
if (['round', 'matches', 'population', 'failure-budget', 'recovery', 'manual'].includes(r.kind) && !Number.isInteger(r.target)) throw new Error('Count targets must be integers');
|
||||
if (!Number.isInteger(r.minRound) || !Number.isInteger(r.minPlayers)) throw new Error('Round and player qualifiers must be integers');
|
||||
if (r.kind === 'manual' && r.target !== 1) throw new Error('Add a separate requirement for each checklist item');
|
||||
if (typeof r.event !== 'string' || r.event.length > 120 || (r.kind === 'feature' && !/^[a-zA-Z0-9_.:-]+$/.test(r.event))) throw new Error('Feature requirements need an event name');
|
||||
return { id: r.id, kind: r.kind, label: r.label.trim(), target: r.target, minRound: r.minRound,
|
||||
minPlayers: r.minPlayers, minMinutes: r.minMinutes, event: r.event };
|
||||
minPlayers: r.minPlayers, minMinutes: r.minMinutes };
|
||||
});
|
||||
return { version: 1, requirements, scope: p.scope, quorum: p.quorum, timeoutHours: p.timeoutHours,
|
||||
failureAction: p.failureAction, rollbackRestart: p.rollbackRestart, waveSize: p.waveSize };
|
||||
@@ -85,6 +82,6 @@ export interface BetaTestView {
|
||||
plan: BetaPlan;
|
||||
outcome: string;
|
||||
reason: string | null;
|
||||
servers: Array<{ server: string; runId: string; phase: number; passed: boolean; progress: RequirementProgress[] }>;
|
||||
servers: Array<{ server: string; phase: number; passed: boolean; progress: RequirementProgress[] }>;
|
||||
evidence: Array<{ id: number; server: string; received_at: string; kind: string; payload: string }>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user