Fix keyed telemetry match attribution (Refs #144)
CI / checks (push) Successful in 5m26s

This commit is contained in:
2026-10-12 00:58:05 -04:00
parent 4ea291d305
commit 785cc4616b
24 changed files with 1115 additions and 112 deletions
+11 -4
View File
@@ -255,15 +255,19 @@ it('prunes metrics and diagnostics while leaving unlimited histories intact', as
expect(a.db.prepare('SELECT count(*) AS n FROM metric_samples').get()).toEqual({ n: 0 });
});
it('prunes closed matches and audit events without deleting active matches or protected audit records', async () => {
it('prunes closed matches and their receipts without deleting active matches or protected audit records', async () => {
const a = await api();
for (const status of ['active', 'completed', 'interrupted'])
a.db
for (const status of ['active', 'completed', 'interrupted', 'end-report-missing']) {
const match = a.db
.prepare(
`INSERT INTO leaderboard_matches(server,game,map,map_key,map_name,started_at,last_received_at,status,last_event,last_fingerprint)
VALUES('s','t5','kino','kino','Kino',?,?,?,'game_end','test')`
)
.run(old, old, status);
a.db
.prepare('INSERT INTO leaderboard_match_reports(match_id,seq,applied) VALUES(?,1,1)')
.run(match.lastInsertRowid);
}
// Preview initializes the optional authentication schema.
a.retentionPreview();
a.db
@@ -274,11 +278,14 @@ it('prunes closed matches and audit events without deleting active matches or pr
.run(Date.parse(old));
a.setRetentionControl({ category: 'audit', id: '1', protected: true });
a.saveFleetSettings({ ...a.fleetSettings(), matchKeepDays: 1, auditKeepDays: 1 });
expect(a.pruneHistory('match')).toBe(2);
expect(a.pruneHistory('match')).toBe(3);
expect(a.pruneHistory('audit')).toBe(1);
expect(a.db.prepare('SELECT status FROM leaderboard_matches').all()).toEqual([
{ status: 'active' }
]);
expect(a.db.prepare('SELECT match_id,seq FROM leaderboard_match_reports').all()).toEqual([
{ match_id: 1, seq: 1 }
]);
expect(a.db.pragma('foreign_key_check')).toEqual([]);
});
it('keeps active beta evidence while expiring closed snapshots and then closed history', async () => {