컴퓨터 방 자동 정리 + 게스트 계정 삭제(로그아웃·하루 미접속) + 테스트 10분→1분
- 방 화면을 벗어나면(홈·규칙) detach: 자리·접속 상태는 유지, 방 접속 수에서 빠짐 - 컴퓨터가 있는 방: 사람이 모두 [방 나가기]하면 바로 닫고, 아무도 안 보면 대기실·끝난 방 1분, 게임 중 30분 뒤 정리 - 게스트 로그아웃 = 계정 삭제(자리·전적·세션·소켓), 사이트를 닫고 24시간 지난 게스트도 1분 주기로 삭제 - users.last_seen_at을 요청·소켓 종료 때 갱신(이전엔 갱신 안 됨), 003 마이그레이션에서 기존 게스트 시계 초기화 - 테스트: 무작위 대국 시드를 playoutSeeds()로 평소 1/10, test:full은 전부. bun test --parallel=4, 테스트 서버 종료 대기 1s→50ms Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import { SeededRng, randomPlayout, seedN, type GameEvent } from '@bg/engine';
|
||||
import { SeededRng, playoutSeeds, randomPlayout, seedN, type GameEvent } from '@bg/engine';
|
||||
import {
|
||||
allTileIds,
|
||||
autoAction,
|
||||
@@ -521,7 +521,8 @@ describe('시간 초과·연결 끊김 (§8.5)', () => {
|
||||
|
||||
describe('정보 유출 (§8.3)', () => {
|
||||
test('관전자·상대 view와 이벤트에 남의 숨은 숫자·ID·이번 턴 타일 숫자가 없음', () => {
|
||||
for (let seed = 1; seed <= 300; seed++) {
|
||||
const seeds = playoutSeeds(300);
|
||||
for (let seed = 1; seed <= seeds; seed++) {
|
||||
const n = 2 + (seed % 3);
|
||||
const players = Array.from({ length: n }, (_, i) => `P${i}`);
|
||||
const options = davinci.optionsSchema.parse({ jokers: seed % 2 === 0, chooseColors: seed % 3 !== 0, deductionHelper: seed % 4 === 0 });
|
||||
@@ -615,7 +616,9 @@ describe('random playouts (docs/09 §7)', () => {
|
||||
}
|
||||
};
|
||||
|
||||
for (const [from, to] of [[1, 250], [251, 500], [501, 750], [751, 1000]] as const) {
|
||||
const total = playoutSeeds(1000);
|
||||
for (let from = 1; from <= total; from += 250) {
|
||||
const to = Math.min(from + 249, total);
|
||||
test(`seeds ${from}–${to}: finish, conserve tiles, sorted rows, no leaks, onTimeout legal`, () => {
|
||||
for (let i = from; i <= to; i++) {
|
||||
const { players, options } = cfg(i);
|
||||
|
||||
Reference in New Issue
Block a user