feat: connect tournament views to APIs and recover archived stats

Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration.

Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive.

Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
This commit is contained in:
dahyeon committed 2026-11-11 02:00:35 +09:00
1 parent 20e1e6ec04
commit 0d7617e2d2
70 files changed
+3739 -1793

No files matched your search

@@ -78,6 +78,6 @@ test('uses neutral titles and distinguishes registration states on the next matc
assert.equal(getNextMatchBanner({ ...match, maxParticipants: 0 }).status, '모집 마감');
assert.deepEqual(
getNextMatchBanner({ ...fullMatch, title: '토요일 시즌 결승 내전', status: 'team-built' }),
{ title: '토요일 시즌 결승 내전', status: '팀 편성', capacity: '1/1명', canApply: false },
{ title: '토요일 시즌 결승 내전', status: '팀빌딩 상태 확인 필요', capacity: '1/1명', canApply: false },
);
});
@@ -0,0 +1,40 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import type { CompetitionGameView } from '@lolympus/contracts';
import { riotMatchIdForDisplay } from '../src/lib/internal-game-evidence.ts';
test('keeps a real Riot ID visible even when analysis is missing', () => {
const game = {
gameId: 'game-1',
riotMatchId: 'KR_123',
analysisAvailability: 'missing',
};
const official = {
evidence: { type: 'riot', riotMatchId: 'KR_123' },
} as CompetitionGameView;
assert.equal(riotMatchIdForDisplay(game, official), 'KR_123');
});
test('does not label a legacy evidence reference as a Riot ID', () => {
const official = {
evidence: { type: 'legacy', legacyReference: 'KR_123' },
} as CompetitionGameView;
assert.equal(
riotMatchIdForDisplay({ riotMatchId: 'KR_123' }, official),
null,
);
assert.equal(
riotMatchIdForDisplay({ riotMatchId: 'match:legacy:123' }),
null,
);
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_TEMP_123' }), null);
});
test('shows a real Riot ID on unmigrated records and hides unresolved official references', () => {
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_123' }), 'KR_123');
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'NA1_123' }), 'NA1_123');
assert.equal(
riotMatchIdForDisplay({ riotMatchId: 'KR_123', gameId: 'unresolved' }),
null,
);
});
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {
getInternalMatchOutcome,
formatOfficialMatchResult,
getMainLane,
parseLeaderboardSort,
rankLeaderboardByLane,
@@ -74,32 +74,23 @@ test('picks the most played lane', () => {
assert.equal(getMainLane({}), undefined);
});
test('shows a score for a single two-team series and a winner otherwise', () => {
const team = (teamIndex: number) => ({
teamIndex,
name: `${teamIndex + 1}팀`,
members: [],
});
const pair = getInternalMatchOutcome({
winnerTeamIndex: 1,
teams: [team(0), team(1)],
seriesResults: [
{ teamAIndex: 0, teamBIndex: 1, teamAWins: 1, teamBWins: 2 },
],
});
assert.equal(pair?.type, 'score');
assert.equal(pair?.type === 'score' && pair.rightWins, 2);
assert.equal(pair?.winner?.name, '2팀');
const tournament = getInternalMatchOutcome({
winnerTeamIndex: 2,
teams: [team(0), team(1), team(2), team(3)],
seriesResults: [],
});
assert.deepEqual(tournament, { type: 'winner', winner: team(2) });
assert.equal(
getInternalMatchOutcome({ teams: [team(0), team(1)], seriesResults: [] }),
undefined,
);
test('displays official tournament winners by ID and keeps older records neutral', () => {
const champion = 'winner' as import('@lolympus/contracts').TeamId;
assert.equal(formatOfficialMatchResult({
type: 'official',
competitionId: 'tournament' as import('@lolympus/contracts').CompetitionId,
sourceRevision: 10,
phase: 'completed',
formatType: 'double-elimination',
completedSeriesCount: 2,
teams: [{ teamId: champion, name: '별무리' }],
outcome: {
type: 'double-elimination',
championTeamId: champion,
placements: [{ rank: 1, teamId: champion }],
completedAt: '2026-11-10T00:00:00Z',
},
}), '우승 · 별무리');
assert.equal(formatOfficialMatchResult({ type: 'legacy' }), '과거 기록');
assert.equal(formatOfficialMatchResult(undefined), '공식 결과 확인 불가');
});