Clean up abandoned matches and fix analytics validation

This commit is contained in:
2026-10-19 15:23:16 +09:00
parent 65c3941e29
commit 6f44ec0d15
14 changed files with 232 additions and 10 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import { PRESENCE_AUTH_REFRESH_MS } from '../constants/presence.js';
test('presence counts authenticated players once across tabs and removes disconnected players', async () => {
const http = createServer(), io = new Server(http);
registerPresence(io, { async get(auth: { token: string; gameSessionId: string }) {
registerPresence(io, { async touchPresence(auth: { token: string; gameSessionId: string }) {
if (auth.token !== 'valid') throw new ApiError(401, 'INVALID_SESSION');
return { playerId: auth.gameSessionId.startsWith('a') ? 'a' : 'b' };
} } as unknown as GameSessionStore);
@@ -45,7 +45,7 @@ test('temporary revalidation errors allow reconnect, invalid sessions remain dis
}) as typeof setInterval);
let failure: 'temporary' | 'invalid' | undefined;
const http = createServer(), io = new Server(http);
registerPresence(io, { async get() {
registerPresence(io, { async touchPresence() {
if (failure === 'invalid') throw new ApiError(401, 'INVALID_SESSION');
if (failure === 'temporary') { failure = undefined; throw new Error('DB_UNAVAILABLE'); }
return { playerId: 'one' };