feat: 토너먼트 페이지군 자동 갱신을 분리한다
토너먼트 전용 SSE scope와 slice invalidation을 추가하고 같은 계정의 visible 탭이 조회를 공유하게 한다. 서버 증명 snapshot 조회는 접속 점수를 더하지 않되 기존 hard limit은 유지한다.
This commit is contained in:
@@ -4,6 +4,7 @@ import { createEmptyRealtimeReadModelChanges, type RealtimeEvent } from '@sammo-
|
||||
import { MESSAGE_MAILBOX_NATIONAL_BASE } from '@sammo-ts/logic';
|
||||
|
||||
import {
|
||||
shouldForwardRealtimeEvent,
|
||||
shouldReloadRealtimeViewerIdentity,
|
||||
toPublicRealtimeEvent as convertPublicRealtimeEvent,
|
||||
} from '../src/realtime/publicEvent.js';
|
||||
@@ -145,6 +146,44 @@ describe('public realtime event privacy boundary', () => {
|
||||
expect(shouldReloadRealtimeViewerIdentity({ type: 'tournamentChanged' }, viewer)).toBe(false);
|
||||
});
|
||||
|
||||
it('exposes tournament page refresh selection without projection identity or revision', () => {
|
||||
const invalidation = { snapshot: true, betting: false, rankings: false, generalId: 7 };
|
||||
const publicEvent = toPublicRealtimeEvent(
|
||||
{
|
||||
type: 'tournamentProjectionChanged',
|
||||
invalidation,
|
||||
},
|
||||
[viewer]
|
||||
);
|
||||
|
||||
expect(publicEvent).toEqual({
|
||||
type: 'tournamentViewInvalidated',
|
||||
refreshGrant,
|
||||
invalidation: { snapshot: true, betting: false, rankings: false },
|
||||
});
|
||||
expect(JSON.stringify(publicEvent)).not.toMatch(/revision|source|channel|time|generalId|matchId/u);
|
||||
expect(
|
||||
shouldReloadRealtimeViewerIdentity(
|
||||
{
|
||||
type: 'tournamentProjectionChanged',
|
||||
invalidation: { snapshot: false, betting: true, rankings: false },
|
||||
},
|
||||
viewer
|
||||
)
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it('routes tournament projection traffic only to the dedicated page-family subscription', () => {
|
||||
const projectionEvent: RealtimeEvent = {
|
||||
type: 'tournamentProjectionChanged',
|
||||
invalidation: { snapshot: true, betting: false, rankings: false },
|
||||
};
|
||||
expect(shouldForwardRealtimeEvent(projectionEvent, 'dashboard')).toBe(false);
|
||||
expect(shouldForwardRealtimeEvent(projectionEvent, 'tournament')).toBe(true);
|
||||
expect(shouldForwardRealtimeEvent({ type: 'tournamentChanged' }, 'dashboard')).toBe(true);
|
||||
expect(shouldForwardRealtimeEvent({ type: 'tournamentChanged' }, 'tournament')).toBe(false);
|
||||
});
|
||||
|
||||
it('filters message events per viewer and removes mailbox, sender, message, and time fields', () => {
|
||||
const event: RealtimeEvent = {
|
||||
type: 'messageCreated',
|
||||
|
||||
Reference in New Issue
Block a user