feat: improve tournament workflows and prune outdated docs
This commit is contained in:
1 parent
da7b502936
commit
38a89b5374
53 files changed
+3308
-3276
No files matched your search
@@ -256,4 +256,3 @@ SINCE 1 day ago
|
||||
- `apps/api/src/modules/global/observability/performance-observer.ts`
|
||||
- `apps/api/src/modules/global/observability/mongoose-performance.plugin.ts`
|
||||
- `apps/api/src/scripts/api-performance-report.ts`
|
||||
- `docs/specs/api-performance-observability.md`
|
||||
@@ -1,203 +0,0 @@
|
||||
# Implementation Plan: Series Result History UI
|
||||
|
||||
## Overview
|
||||
|
||||
Replace the existing completed-Game mini-card grid with a tested chronological
|
||||
Series result history. Keep data derivation pure, render responsive semantic rows,
|
||||
and preserve all current Competition/API contracts.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Derive a local view model from `projection.series` and `projection.games`; no API
|
||||
or persistence change is required.
|
||||
- Anchor a played Series to its earliest accepted Game start. Anchor a game-less
|
||||
completed decision to its decision time only for grouping and sorting.
|
||||
- Keep the original narrowed Series and Game objects in each row so the UI does not
|
||||
duplicate domain state or collapse outcome semantics.
|
||||
- Use a native `details/summary` disclosure for Game history and omit it when a
|
||||
Series has no Games.
|
||||
- Extract the new UI from `CompetitionResults.tsx` so the format selector remains
|
||||
focused.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Result-History Contract
|
||||
|
||||
#### Task 1: Specify aggregation and chronology test-first
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Tests cover Series aggregation, ordinal Game order, KST date boundaries,
|
||||
chronological order, outcome variants, and deterministic fallbacks.
|
||||
- [x] The focused test fails because the model module does not yet exist.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Run the focused Node test and record the expected RED failure.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
|
||||
#### Task 2: Implement the pure history model
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Only recorded in-progress and completed Series are returned.
|
||||
- [x] Date grouping and format helpers are explicitly KST-aware.
|
||||
- [x] Decision outcomes and missing legacy durations remain distinguishable.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused history tests pass.
|
||||
- [x] Existing web tests still pass.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/competition-series-history.ts`
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
|
||||
### Checkpoint: Model
|
||||
|
||||
- [x] Pure tests pass without a React or browser dependency.
|
||||
|
||||
### Phase 2: Responsive Result UI
|
||||
|
||||
#### Task 3: Render date sections and Series rows
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Desktop uses a flat schedule-like row; mobile stacks metadata and matchup
|
||||
without horizontal scrolling.
|
||||
- [x] Status and official winner are communicated with visible text and typography,
|
||||
not color alone.
|
||||
- [x] Game-less decisions do not show fake start times or `0 : 0`.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Changed component files pass ESLint.
|
||||
- [x] Web build succeeds.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
|
||||
#### Task 4: Integrate accessible Game disclosures
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Each Series with Games exposes a native keyboard-operable disclosure.
|
||||
- [x] Games use Series-local ordinal, team-ID winner lookup, and omit unknown
|
||||
zero-duration values.
|
||||
- [x] The old completed-Game mini-card block is removed.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Full web tests, changed-file lint, and build pass. Repository-wide lint remains
|
||||
blocked by pre-existing errors outside this change.
|
||||
- [x] Source review checks heading order, disclosure semantics, and 320px layout.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx`
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] All specification success criteria are met.
|
||||
- [x] Git diff contains only the feature spec, plan, tests, model, and UI integration.
|
||||
- [x] Unrelated working-tree files are unchanged.
|
||||
|
||||
### Phase 3: Game Detail Navigation
|
||||
|
||||
#### Task 5: Specify the canonical Game route test-first
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] A Game whose `ordinal` and `displayNumber` differ links with
|
||||
`displayNumber`.
|
||||
- [x] Non-positive or non-integer legacy display numbers do not produce a broken
|
||||
detail link.
|
||||
- [x] The focused test is observed failing before the route adapter exists.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Run the focused Node test for RED and GREEN states.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/test/competition-series-history.test.ts`
|
||||
- `apps/web/src/components/competition/competition-series-history.ts`
|
||||
|
||||
#### Task 6: Make disclosed Game rows navigable
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] The full Game row is one React Router link with an always-visible detail cue.
|
||||
- [x] The link carries the current Competition location as `backTo` and a Korean
|
||||
return label.
|
||||
- [x] Mobile targets are at least 44px high; keyboard focus is visible; hover and
|
||||
active states use restrained semantic-primary coral accents.
|
||||
- [x] The scoped primary token keeps that coral accent in both themes without a
|
||||
global dark-theme color migration.
|
||||
- [x] Winner, score, and status colors retain their existing domain meaning.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused and full web tests pass.
|
||||
- [x] Changed-file ESLint and the production web build pass.
|
||||
- [x] Independent review checks route identity, interaction semantics, accessibility,
|
||||
and unrelated working-tree preservation.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/components/competition/CompetitionGameHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx`
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx`
|
||||
|
||||
#### Task 7: Refuse incorrect Game-detail fallbacks
|
||||
|
||||
**Acceptance criteria:**
|
||||
|
||||
- [x] Exact requested Game numbers resolve to that Game.
|
||||
- [x] Missing or invalid requested Game numbers return no selection instead of the
|
||||
first Game.
|
||||
- [x] The detail page renders an explicit missing-Game state with the preserved return
|
||||
target.
|
||||
- [x] The policy is covered by an observed RED→GREEN pure regression test.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- [x] Focused selection tests, full web tests, changed-file ESLint, and build pass.
|
||||
|
||||
**Files likely touched:**
|
||||
|
||||
- `apps/web/src/lib/internal-match-game-selection.ts`
|
||||
- `apps/web/src/pages/MatchGameDetailPage.tsx`
|
||||
- `apps/web/test/internal-match-game-selection.test.ts`
|
||||
|
||||
### Checkpoint: Navigable Game History
|
||||
|
||||
- [x] Every valid recorded Game opens its own internal-stat detail view.
|
||||
- [x] Browser back and the detail page return link restore the Competition result
|
||||
page.
|
||||
- [x] Invalid legacy route data degrades to a non-clickable row instead of a wrong
|
||||
destination.
|
||||
- [x] A stale detail payload cannot substitute a different Game for the requested
|
||||
route.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Game sides are mistaken for Series slots | High | Use Series A/B entries and outcome team IDs; test side swaps. |
|
||||
| Completion time is shown as start time | Medium | Track timestamp source and render a blank time for decisions. |
|
||||
| KST day changes by deploy environment | Medium | Use explicit `Intl.DateTimeFormat` timezone and boundary tests. |
|
||||
| Long team names break mobile rows | Medium | Use balanced minmax columns and allow wrapping. |
|
||||
| Existing dirty work is overwritten | High | Restrict patches and verification to named feature files. |
|
||||
| Series-local ordinal opens another Series' Game | High | Generate routes only from tested global `displayNumber`. |
|
||||
| Coral is mistaken for the winning side | Medium | Restrict primary color to interaction edges, focus, and arrows. |
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,84 +0,0 @@
|
||||
# Implementation Plan: Double-Elimination Connector Routing
|
||||
|
||||
## Overview
|
||||
|
||||
Replace per-edge winner rail staggering with deterministic, collision-aware winner
|
||||
bundles while retaining the existing target-corridor `H-V-H` path model and the
|
||||
current loser/reset routing behavior.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Keep routing as a pure layout calculation; the React renderer consumes unchanged
|
||||
`BracketConnectorLayout` paths.
|
||||
- Allocate baseline rails first, then choose one rail for each same-target winner
|
||||
bundle while leaving loser/reset coordinates unchanged.
|
||||
- Score complete candidate paths by parallel-stroke clearance, strict crossings,
|
||||
and distance from the corridor midpoint.
|
||||
- Permit shared `verticalX` only when the participating vertical intervals do not
|
||||
overlap; otherwise search the same corridor for the nearest deterministic pair
|
||||
of separate rails with focused-stroke clearance.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Regression Contract
|
||||
|
||||
- [x] Add tests proving quiet winner bundles use the corridor midpoint and all
|
||||
shareable same-target winner paths remain aligned.
|
||||
- [x] Replace target-column rail uniqueness with interval-aware segment assertions.
|
||||
- [x] Cover reversed A/B input where overlapping vertical spans require the
|
||||
deterministic separate-rail fallback.
|
||||
- [x] Confirm the focused test fails with the current allocator.
|
||||
|
||||
### Checkpoint: RED
|
||||
|
||||
- [x] The new behavioral assertion fails for the expected unequal `verticalX`.
|
||||
- [x] Existing tests remain unchanged except where their invariant is obsolete.
|
||||
|
||||
### Phase 2: Bundle-Aware Allocator
|
||||
|
||||
- [x] Represent connector routing inputs with precomputed source/target anchors.
|
||||
- [x] Retain stable independent rails for loser/reset routes.
|
||||
- [x] Group the two winners entering each target and select the nearest safe shared
|
||||
rail without card penetration, forbidden overlap, or avoidable added crossings.
|
||||
- [x] Fall back to the nearest deterministic, stroke-clear separate rails only
|
||||
when the pair's own vertical intervals overlap and cannot safely share a rail.
|
||||
|
||||
### Checkpoint: GREEN
|
||||
|
||||
- [x] Focused layout tests pass for four-team, eight-team, reset-final, and shuffled
|
||||
input fixtures.
|
||||
- [x] Strict crossing, collinear-overlap, and 5px parallel-clearance safeguards pass.
|
||||
|
||||
### Phase 3: Verification and Review
|
||||
|
||||
- [x] Run the full web suite, lint, and production build; document the unrelated
|
||||
pre-existing full-lint failures while verifying changed files separately.
|
||||
- [x] Inspect the diff for correctness, simplicity, security, performance, and
|
||||
adherence to the approved spec.
|
||||
- [x] Perform an independent review and address all required findings.
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] All success criteria in the spec are verified.
|
||||
- [x] No unrelated files are modified.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Blind midpoint alignment adds crossings in busy upper rounds | High | Score complete candidate paths and move the winner bundle together to the nearest safe rail. |
|
||||
| Shared rails create overlapping vertical segments | High | Check interval overlap before allowing a shared `verticalX`; search deterministic fallback rails with 5px clearance otherwise. |
|
||||
| Visually parallel rails pass exact-coordinate tests but overlap at stroke width | High | Require 5px clearance across overlapping vertical runs and cover it for 4/8-team fixtures. |
|
||||
| Routing changes depend on input array order | Medium | Sort routes and bundles by graph display order and retain shuffled-fixture equality tests. |
|
||||
| A long connector bends through an intermediate card | High | Restrict every candidate to the target corridor and retain card-penetration assertions. |
|
||||
| Reset-final slot carry-over is accidentally treated as a winner pair | Medium | Bundle only connectors whose computed kind is `winner`; keep reset paths independent. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
Regression contract -> bundle-aware rail allocator -> full verification -> review
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,78 +0,0 @@
|
||||
# Implementation Plan: Internal Match Game Analysis P0/P1
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver three independently verifiable slices: P0 existing-data UI, P1-A timeline
|
||||
checkpoints and lane comparison, and P1-B unified notable events. Preserve the
|
||||
existing detail endpoint and use builder/cache versioning to refresh old projections.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: P0 Existing Data
|
||||
|
||||
- [x] Add tested objective normalization, chart markers, an accessible event list,
|
||||
and move game flow above the detail tabs.
|
||||
- [x] Add a complete objective comparison strip with conservative dragon-type
|
||||
fallback behavior.
|
||||
- [x] Label KP and add participant gold/GPM to the combined CS/economy presentation.
|
||||
|
||||
### Checkpoint: P0
|
||||
|
||||
- [x] Web tests, lint, and production build pass.
|
||||
- [x] Desktop and mobile layouts retain all existing scoreboard/build behavior.
|
||||
|
||||
### Phase 2: P1-A Lane Checkpoints
|
||||
|
||||
- [x] Parse the remaining participant event identifier fields and project tested
|
||||
participant checkpoints at 10 and 15 minutes.
|
||||
- [x] Persist and expose optional checkpoint fields, reject stale caches, and bump
|
||||
the match-stats builder/detail-response versions.
|
||||
- [x] Replace final-state lane comparisons with tested role-based 10/15-minute
|
||||
GD/CSD/XPD and K/D/A comparisons.
|
||||
|
||||
### Checkpoint: P1-A
|
||||
|
||||
- [x] Focused API tests and builds pass.
|
||||
- [x] Web tests and production build pass.
|
||||
- [x] Short and missing-timeline games show unavailable states rather than zeros.
|
||||
|
||||
### Phase 3: P1-B Unified Events
|
||||
|
||||
- [x] Project objectives, champion kills, towers, and inhibitors into a deterministic
|
||||
tested event stream.
|
||||
- [x] Expose `timelineEvents` while retaining `objectiveEvents` compatibility and
|
||||
bump persisted/cache versions as required.
|
||||
- [x] Add accessible event filtering and chart selection with objective-only fallback.
|
||||
- [x] Coalesce concurrent hydration and short-cache incomplete results so transient
|
||||
failures retry without rebuilding on every sequential page request.
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] API and web focused suites pass without skipped tests.
|
||||
- [x] API and web production builds pass.
|
||||
- [x] Responsive runtime review passes at 320px, 390px, 768px, 1024px, and 1440px.
|
||||
- [x] P0/P1 edits exclude unrelated Competition/bracket modifications already in
|
||||
the shared worktree.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Missing or delayed Riot frames misrepresent @10/@15 | High | Use only a frame at/before the target within one frame interval and expose its actual timestamp. |
|
||||
| Building events attribute the destroyed team's side as the scorer | High | Prefer killer participant side; otherwise invert the destroyed `teamId`; cover both paths in tests. |
|
||||
| Old cached shapes hide new fields | High | Increment builder and response cache versions and strengthen completeness validation. |
|
||||
| A kill-heavy game makes the page excessively long | Medium | Add event-category filters and a bounded scroll region. |
|
||||
| Mobile chart remains hard to reach | Medium | Move flow directly below the summary before any participant cards. |
|
||||
| Existing dirty work is accidentally included | High | Restrict edits and verification to the named game-analysis files and inspect the final diff by path. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
P0 event normalization -> P0 objective strip
|
||||
P1 checkpoint projector -> response contract -> lane UI
|
||||
P1 checkpoint identifiers -> event projector -> response contract -> event UI
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,62 +0,0 @@
|
||||
# Redis 8.10 correctness and optimization
|
||||
|
||||
## Scope and invariants
|
||||
|
||||
- Fix blocking reads sharing a client, Hash payload cleanup, duplicate action-order entries, and non-atomic scheduled-job promotion.
|
||||
- Preserve high-before-low consumption, the 30-minute pending recovery threshold, business processing locks, replay fingerprints, 500-request limits, and auction lifecycle fencing.
|
||||
- Use XACKDEL ACKED, XREADGROUP CLAIM, conditional string deletion/renewal, and INCREX. Never trim unacknowledged work.
|
||||
- Move community response caches to hashes with independent field TTLs: 300 seconds normally, 86400 for complete details, 60 for incomplete details. Preserve response shapes and in-flight coalescing. Fence cache fills across invalidation.
|
||||
- Do not implement conditional Compact Hash, JSON, Array, or request-retention redesign proposals in this change.
|
||||
|
||||
## Implementation sequence
|
||||
|
||||
1. Add regression coverage and fix the four correctness defects.
|
||||
2. Upgrade stream consumption/acknowledgement and protect pending entries during trimming.
|
||||
3. Replace lock scripts and token-unsafe dedup deletion with Redis conditional commands.
|
||||
4. Replace failure-counter increment/expiry with INCREX.
|
||||
5. Introduce versioned community hash caches and generation-aware fills/invalidation.
|
||||
|
||||
## Validation
|
||||
|
||||
- Run existing API tests before changes and record baseline failures.
|
||||
- Exercise actual Lua and Redis 8.10 commands in an isolated local Redis process, including concurrent promotion, pending recovery, foreign-group retention, stale lock ownership, lifecycle-specific cleanup, and cache invalidation races/field expiry.
|
||||
- Add unit regressions for worker connection lifecycle, command response handling, caller cache scopes, and interrupted operations.
|
||||
- Run the full API suite, API build, changed-file lint, and dependency checks. Distinguish mock-based tests from real Redis integration results.
|
||||
|
||||
## Environment
|
||||
|
||||
The repository's named workflow skills are absent. Work follows the above explicit specification, incremental implementation, regression tests, and final review. Windows has no Docker/WSL; a temporary loopback-only Redis 8.10.3 Windows community build is used for integration validation, without accessing application Redis credentials.
|
||||
|
||||
## Results (2026-11-09)
|
||||
|
||||
| Check | Result |
|
||||
| --- | --- |
|
||||
| API unit/regression suite | 105 suites, 704 tests passed |
|
||||
| Web regression suite | 129 tests passed |
|
||||
| Isolated Redis 8.10.3 integration suite | 2 suites, 31 tests passed |
|
||||
| API, web, and contracts builds | Passed (`pnpm -r --workspace-concurrency=1 build`) |
|
||||
| ESLint on the 20 repaired test files | Passed with zero warnings |
|
||||
| Dependency regression checks | 3 tests passed |
|
||||
| Integration runner syntax and missing-executable failure cleanup | Passed; no leaked temporary directory |
|
||||
| Git whitespace check | Passed |
|
||||
| Full API TypeScript check including test files | Passed; all 90 pre-existing diagnostics repaired |
|
||||
| Contracts and web application TypeScript checks | Passed (web check runs as part of its build) |
|
||||
|
||||
The initial API baseline was 685 passing tests and one failure caused by Windows path separators in the performance report. The report now emits platform-independent paths and its existing test passes. The original Redis change exposed 90 pre-existing test-type diagnostics, confirmed against HEAD sources through an in-memory compiler host. The requested follow-up repairs all 90 across 20 test files. Workspace dependencies were installed from the frozen lockfile without changing package versions.
|
||||
|
||||
The type repairs preserve test assertions and scenarios: public service types are separated from private-method test accessors, partial database mocks are typed at the harness boundary, generic helpers retain their full element types, and Riot/Match fixtures provide required fields. Position fixtures use the domain's `SUP`/`JGL` values, optional lookup assertions still fail when the expected object is missing, and scheduler teardown is awaited. No tests were removed or skipped, no TypeScript settings were relaxed, and no suppression directives were added. The final suite also includes the concurrent tournament polling/retry changes present in the shared workspace.
|
||||
|
||||
Run `pnpm --filter api typecheck` to check API source and tests without emitting files or relying on incremental state. Run `pnpm -r --if-present typecheck`, `pnpm --filter api test -- --runInBand`, `pnpm --filter web test`, `pnpm --filter api test:redis`, `pnpm test:dependency-security`, and `pnpm -r --workspace-concurrency=1 build` to reproduce the workspace checks above. The web build reports a non-failing bundle-size warning.
|
||||
|
||||
Actual Redis coverage includes dedicated blocking reads alongside normal commands, stale pending recovery, acknowledgement retention across consumer groups, safe stream trimming, foreign-owner lock protection, compare-and-delete dedup tokens, concurrent failure-counter increments, scheduled-job failure/retry and concurrent promotion, rescheduling fences, malformed scheduled entries and batch limits, Hash/legacy payload cleanup, action reservation/apply/replay, the 500-request cap and five-minute retention, independent cache field expiry, scope isolation, and stale cache fills across invalidation. The detail-response invalidation race also exercises the real CommunityStatsService and Redis cache with only the underlying dataset loader stubbed.
|
||||
|
||||
MongoDB/NATS/Riot end-to-end execution, Linux production-runtime validation, and production-scale latency/memory benchmarks were not run. No measured production speedup is claimed.
|
||||
|
||||
## Rollout and operating behavior
|
||||
|
||||
- Requires Redis 8.10.x and the existing node-redis 5.12.x client. The integration runner verifies the server version before executing tests.
|
||||
- Switch API instances together: old String-cache invalidation and new Hash-cache invalidation target different namespaces. Rolling with both versions serving traffic can leave the other version's cache stale. Rollback has the same constraint.
|
||||
- Old cache values expire on their existing TTL, at most 24 hours. New hashes populate on cache misses; this can temporarily increase database reads after deployment. A persistent generation token per community fences slow responses across invalidation.
|
||||
- Pending/unread stream entries are retained even past the approximate 10,000-entry target. Monitor stream length and pending entries; an abandoned consumer group can retain entries until that group is deliberately retired.
|
||||
- Existing action-order duplicates are not rewritten during deployment. The fix prevents new duplicates; existing entries age out through the existing five-minute replay retention and count-based cleanup.
|
||||
- `pnpm --filter api test:redis` starts only its own loopback server, uses a random port/password, disables persistence, and cleans up afterward. Set `REDIS_TEST_SERVER` to an installed executable if it is not on PATH.
|
||||
@@ -1,121 +0,0 @@
|
||||
# Implementation Plan: Refresh Riot ID by PUUID
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver the behavior in three backend slices. First add and prove the safe
|
||||
Account-V1-to-user persistence operation. Then invoke it from the existing
|
||||
personal-history refresh worker before completion is broadcast. Finally reuse it
|
||||
from stale-account background refresh with community-aware region resolution and
|
||||
failure isolation. No database or frontend contract change is required.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Identity Refresh Boundary
|
||||
|
||||
- [x] Add failing tests for changed, unchanged, incomplete, mismatched, and failed
|
||||
PUUID identity lookups.
|
||||
- Acceptance: tests describe state outcomes and fail because the focused method
|
||||
is not implemented.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts`
|
||||
- [x] Implement `refreshRiotIdentity` using `RiotAccountService.getByPuuid`.
|
||||
- Acceptance: valid changed values persist together; invalid results preserve
|
||||
existing values; unchanged values avoid a write.
|
||||
- Verify: the Phase 1 focused test passes.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.ts`
|
||||
|
||||
### Checkpoint: Phase 1
|
||||
|
||||
- [x] The enrichment service has a typed three-state result and all focused tests
|
||||
pass.
|
||||
- [x] No schema, endpoint, queue payload, or frontend changes exist.
|
||||
|
||||
### Phase 2: Refresh Worker Integration
|
||||
|
||||
- [x] Add a failing worker test proving that a user-history job requests identity
|
||||
refresh with its user ID, PUUID, and region.
|
||||
- Acceptance: the test fails before worker orchestration is updated.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-job-worker.service.spec.ts`
|
||||
- Files: `apps/api/src/modules/riot-job-queue/riot-job-worker.service.spec.ts`
|
||||
- [x] Invoke best-effort identity refresh before job completion.
|
||||
- Acceptance: the worker logs identity failure without aborting successful match
|
||||
refresh work, and broadcasts completion only after identity refresh returns.
|
||||
- Verify: the Phase 2 focused test passes.
|
||||
- Files: `apps/api/src/modules/riot-job-queue/riot-job-worker.service.ts`
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] Focused API suites pass without skipped tests.
|
||||
- [x] API lint and build pass.
|
||||
- [x] Web lint and production build pass, confirming the existing profile
|
||||
invalidation integration remains compatible.
|
||||
- [x] Final diff contains only the specification, plan, enrichment service, worker,
|
||||
and their tests.
|
||||
|
||||
### Phase 3: Background Refresh Integration
|
||||
|
||||
- [x] Add a failing enrichment-service test proving that an omitted region is
|
||||
resolved from the user's community.
|
||||
- Acceptance: a non-Asia community route reaches Account-V1 without changing the
|
||||
public method signature.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts`
|
||||
- [x] Resolve the community Riot region for region-less identity refresh calls.
|
||||
- Acceptance: explicit caller regions remain unchanged; missing community routes
|
||||
use the existing `asia` fallback.
|
||||
- Verify: the focused enrichment-service test passes.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot/riot-account-enrichment.service.ts`
|
||||
- [x] Add failing background scheduler tests for identity refresh ordering and
|
||||
failure isolation.
|
||||
- Acceptance: stale accounts request identity refresh before statistics
|
||||
enrichment, while identity rejection does not increment failure counters.
|
||||
- Verify:
|
||||
`pnpm --filter api exec jest --runInBand background-refresh.scheduler.spec.ts`
|
||||
- Files:
|
||||
`apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.spec.ts`
|
||||
- [x] Invoke best-effort identity refresh from the stale-account loop.
|
||||
- Acceptance: each processed candidate gets one PUUID identity lookup, statistics
|
||||
enrichment still determines processed/failed/backoff state, and no new Redis or
|
||||
database contract is added.
|
||||
- Verify: the focused background scheduler tests pass.
|
||||
- Files:
|
||||
`apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.ts`
|
||||
|
||||
### Checkpoint: Background Refresh Complete
|
||||
|
||||
- [x] Focused identity, manual worker, and background scheduler suites pass.
|
||||
- [x] API lint, full tests, and build pass.
|
||||
- [x] Final diff remains limited to the existing feature documents, identity
|
||||
service/tests, and background scheduler/tests.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Account-V1 returns an incomplete identity | High | Require matching PUUID and two non-empty Riot ID fields before mutation. |
|
||||
| Riot Account-V1 is temporarily unavailable | Medium | Preserve stored identity, log the failure, and retain existing best-effort job semantics. |
|
||||
| Multiple queue groups repeat identity lookup | Low | The personal page requests one queue group; avoid a new dedup mechanism until a measured need exists. |
|
||||
| Background community uses a non-Asia Riot route | High | Resolve omitted regions from the user's community before falling back to `asia`. |
|
||||
| Identity lookup failure triggers background backoff | Medium | Isolate identity exceptions and let existing statistics enrichment alone control failure counters. |
|
||||
| UI keeps the stale profile cached | High | Identity update completes before the existing completion event invalidates the profile query. |
|
||||
| Historical names are unexpectedly rewritten | Medium | Restrict persistence to the embedded Riot account and leave match snapshots untouched. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
validated Account-V1 lookup
|
||||
-> focused identity persistence method
|
||||
-> manual refresh worker -> existing completion event -> profile invalidation
|
||||
-> background scheduler -> existing statistics enrichment and backoff policy
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the specification and requested implementation.
|
||||
@@ -1,116 +0,0 @@
|
||||
# Implementation Plan: Team Progress Page UX Refresh
|
||||
|
||||
## Overview
|
||||
|
||||
Deliver the redesign in three verifiable slices: tested presentation rules, shared
|
||||
Series semantics, and the integrated page/copy experience. No API or dependency
|
||||
change is required because the team view already exposes `seriesId`, ordinal, round
|
||||
metadata, outcome categories, and code expiry.
|
||||
|
||||
## Architecture Decisions
|
||||
|
||||
- Keep API/query ownership in the page and move deterministic presentation logic
|
||||
into a pure module that the existing Node test runner can exercise.
|
||||
- Compose the active-Series card with code rows instead of maintaining a separate
|
||||
page-wide code grid.
|
||||
- Keep the team page's Series presentation in a page-specific card so shared
|
||||
bracket/history layouts are unaffected; exhaustively test its outcome mapping.
|
||||
- Reuse the bracket's canonical round-label helper so the bracket and team detail
|
||||
cannot drift to different visible match names.
|
||||
- Use one responsive layout and native disclosure/table semantics rather than
|
||||
separate desktop and mobile component trees.
|
||||
|
||||
## Task List
|
||||
|
||||
### Phase 1: Tested View Model
|
||||
|
||||
- [x] Add failing tests for Series/code grouping, stable ordering, Korean round
|
||||
labels, code availability/expiry, unique copy labels, and explicit clipboard
|
||||
results.
|
||||
- Acceptance: the new focused test fails because the behavior is not implemented.
|
||||
- Verify: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
||||
- Files: `apps/web/test/match-team-progress-view.test.ts`
|
||||
- [x] Implement the minimal pure view helpers.
|
||||
- Acceptance: all focused assertions pass without React or DOM mocks.
|
||||
- Verify: rerun the focused command once after implementation.
|
||||
- Files: `apps/web/src/pages/match-team-progress-view.ts`
|
||||
|
||||
### Checkpoint: View Model
|
||||
|
||||
- [x] Focused tests pass and no API/contract file changed.
|
||||
|
||||
### Phase 2: Series Semantics and Code Interaction
|
||||
|
||||
- [x] Add a page-specific Series card that prefers supplied human labels, shows
|
||||
technical codes secondarily, and hides misleading pre-start/adjudicated scores.
|
||||
- Acceptance: ready and adjudicated cards show `—`; result categories remain
|
||||
text-visible; bracket geometry stays unchanged.
|
||||
- Verify: `pnpm --filter web test`
|
||||
- Files: `apps/web/src/components/competition/TeamSeriesCard.tsx`
|
||||
- [x] Add the responsive tournament-code list with accessible clipboard feedback.
|
||||
- Acceptance: code rows show local set number first, full selectable codes,
|
||||
unique 44px copy controls, expiry/state text, and success/failure announcements.
|
||||
- Verify: TypeScript build plus runtime keyboard/copy check.
|
||||
- Files: `apps/web/src/components/competition/TeamTournamentCodes.tsx`
|
||||
|
||||
### Checkpoint: Interaction
|
||||
|
||||
- [x] Full web tests pass and the web build succeeds.
|
||||
|
||||
### Phase 3: Page Hierarchy and Polish
|
||||
|
||||
- [x] Reorder the page and integrate code rows with matching active Series.
|
||||
- Acceptance: order is next match, roster, recent results; every code appears
|
||||
under exactly one matching Series; empty states remain meaningful.
|
||||
- Verify: desktop and mobile runtime screenshots.
|
||||
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
|
||||
|
||||
- [x] Compact and order the roster, and collapse results beyond the newest two.
|
||||
- Acceptance: position labels are Korean and role-ordered, captain is adjacent,
|
||||
and older results remain keyboard-accessible.
|
||||
- Verify: 320/768/1024/1440px reflow and keyboard traversal.
|
||||
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
|
||||
|
||||
### Phase 4: Bracket Naming Alignment
|
||||
|
||||
- [x] Reuse canonical bracket round labels in the team-detail view model.
|
||||
- Acceptance: upper round 1 displays `브래킷 1R`, later upper rounds display
|
||||
`브래킷 상위 nR`, lower rounds display `브래킷 하위 nR`, and multi-match
|
||||
rounds keep the `· n경기` suffix.
|
||||
- Verify: focused view-model test, full web suite, scoped lint, and build.
|
||||
- Files: `apps/web/src/components/competition/double-elimination-bracket-layout.ts`,
|
||||
`apps/web/src/pages/match-team-progress-view.ts`, and
|
||||
`apps/web/test/match-team-progress-view.test.ts`
|
||||
|
||||
### Checkpoint: Complete
|
||||
|
||||
- [x] Focused (9) and full web tests (88) pass without skips.
|
||||
- [x] Scoped lint and the production build pass.
|
||||
- [ ] Full repository lint passes. It is currently blocked by pre-existing errors
|
||||
outside the team-progress scope.
|
||||
- [ ] Runtime review confirms no console errors or horizontal overflow. The
|
||||
required in-app browser was unavailable in this session.
|
||||
- [x] The scoped implementation contains only the spec, plan, focused tests, and
|
||||
team-progress UI; unrelated concurrent worktree changes are excluded.
|
||||
|
||||
## Risks and Mitigations
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| A code appears under the wrong Series | High | Join only on exact `seriesId` and cover opponent/other-Series codes in tests. |
|
||||
| Global and local game numbers are confused | High | Lead with `ordinal` as set number and demote `displayNumber`. |
|
||||
| Adjudication looks like a played 0–0 | High | Reuse tested outcome/score helpers from Competition history. |
|
||||
| Clipboard permissions fail silently | Medium | Return a typed result and render an alert with manual-selection guidance. |
|
||||
| Long codes overflow at mobile widths | Medium | Use `minmax(0,1fr)`, `break-all`, selectable text, and a stacked mobile row. |
|
||||
| Page-specific result semantics drift | Medium | Cover every lifecycle/outcome branch in the pure presentation tests. |
|
||||
|
||||
## Dependencies
|
||||
|
||||
```text
|
||||
View-model tests -> view helpers -> code component -> page composition
|
||||
Exhaustive Series outcome tests -> page-specific score semantics -> recent results
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,80 +0,0 @@
|
||||
# Spec: API Performance Observability And Full Route Report
|
||||
|
||||
## Objective
|
||||
|
||||
Add Phase 1 and Phase 2 support for API performance work:
|
||||
|
||||
- Phase 1 records request latency and Mongoose document-return metrics.
|
||||
- Phase 2 generates a report for every API route, not only the slowest routes.
|
||||
- New Relic Transaction or custom event data is the preferred production source.
|
||||
- Local NDJSON files provide a staging/local fallback with query-level detail.
|
||||
|
||||
Success means an engineer can run representative traffic against the API and produce
|
||||
a route-complete report that includes routes with no samples.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- NestJS API in `apps/api`
|
||||
- Mongoose models created through `ConnectionService`
|
||||
- New Relic Node agent, already configured by `apps/api/newrelic.cjs`
|
||||
- Jest for unit tests
|
||||
- `ts-node` for API maintenance scripts
|
||||
|
||||
## Commands
|
||||
|
||||
- Build: `pnpm --filter api build`
|
||||
- Test: `pnpm --filter api test`
|
||||
- Generate local/New Relic report: `pnpm --filter api perf:report`
|
||||
- Generate route manifest only: `pnpm --filter api perf:routes`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/global/observability/` contains request/query instrumentation.
|
||||
- `apps/api/src/scripts/api-performance-report.ts` generates full API reports.
|
||||
- `docs/specs/api-performance-observability.md` defines this behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Instrumentation must be opt-in and defensive:
|
||||
|
||||
```ts
|
||||
if (!isPerformanceObservabilityEnabled()) return;
|
||||
recordApiPerformanceEvent({
|
||||
type: 'api-request',
|
||||
method,
|
||||
route,
|
||||
durationMs,
|
||||
});
|
||||
```
|
||||
|
||||
Do not record raw request bodies, authorization headers, cookies, raw Mongo filters,
|
||||
or raw query results.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Unit test pure metric aggregation and route discovery logic.
|
||||
- Unit test request context aggregation without a database.
|
||||
- Build the API to catch Nest and TypeScript integration issues.
|
||||
- Production/staging validation uses New Relic Transaction data and optional local
|
||||
NDJSON from representative traffic.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: keep instrumentation disabled unless explicitly enabled.
|
||||
- Always: include all discovered controller routes in the report.
|
||||
- Always: report `no-samples` for routes that did not receive traffic.
|
||||
- Ask first: adding external load-test dependencies or CI performance gates.
|
||||
- Never: log secrets, request bodies, auth headers, cookies, or raw Mongo filters.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- API request events include duration, status, route, query count, Mongoose duration,
|
||||
returned document count, and hydrated document count.
|
||||
- Mongoose query events include model, collection, operation, duration, returned
|
||||
documents, hydrated documents, and lean status.
|
||||
- New Relic receives route-level custom events when instrumentation is enabled.
|
||||
- New Relic Transaction traces can be grouped by route through custom transaction names
|
||||
and attributes.
|
||||
- The report generator can use local NDJSON, New Relic custom events, or New Relic
|
||||
Transaction duration data.
|
||||
- The report lists every API route from controller source files.
|
||||
@@ -1,67 +0,0 @@
|
||||
# Spec: Dakao Upcoming Internal Match List
|
||||
|
||||
## Objective
|
||||
|
||||
When a user sends `!내전 일정`, return only recruiting matches whose scheduled
|
||||
start is not earlier than the command processing time. Matches that have already
|
||||
started must not consume the ten-result query limit or appear in the response.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Capture the command processing time once before querying matches.
|
||||
- Exclude `scheduledAt < now`.
|
||||
- Include `scheduledAt === now` and future matches.
|
||||
- Apply the boundary only to the Dakao `!내전 일정` command.
|
||||
- Preserve the existing recruiting status, result limit, ordering, formatting,
|
||||
short-code generation, and short-link behavior.
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused test:
|
||||
`pnpm --filter api exec jest src/modules/dakao/handlers/match-list.handler.spec.ts --runInBand`
|
||||
- API lint:
|
||||
`pnpm --filter api exec eslint "{src,apps,libs,test}/**/*.ts" --max-warnings=0`
|
||||
- API build: `pnpm --filter api build`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/dakao/handlers/match-list.handler.ts` owns the command
|
||||
query and response formatting.
|
||||
- `apps/api/src/modules/dakao/handlers/match-list.handler.spec.ts` verifies the
|
||||
command boundary and presentation.
|
||||
- `apps/api/src/modules/match/match.service.ts` translates `scheduledFrom` into a
|
||||
MongoDB `$gte` filter.
|
||||
|
||||
## Code Style
|
||||
|
||||
Pass the captured boundary through the existing list contract:
|
||||
|
||||
```ts
|
||||
const scheduledFrom = new Date();
|
||||
await matchService.list({ communityId, scheduledFrom });
|
||||
```
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Freeze the system clock in the handler unit test.
|
||||
- Assert that the exact frozen time is passed as `scheduledFrom`.
|
||||
- Rely on the existing `MatchService` test that verifies `scheduledFrom` becomes
|
||||
`{ scheduledAt: { $gte: scheduledFrom } }`.
|
||||
- Run the focused handler test, full API lint, and API build.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: filter before applying the result limit and use one captured time.
|
||||
- Ask first: change ordering, statuses, limit, or response wording.
|
||||
- Never: hide the requirement with an ESLint exception or filter only after the
|
||||
limited database query.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- A match scheduled before command processing time is not queried.
|
||||
- A match scheduled exactly at command processing time remains eligible.
|
||||
- Existing command formatting and link tests continue to pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None.
|
||||
@@ -1,134 +0,0 @@
|
||||
# Spec: Double-Elimination Connector Routing
|
||||
|
||||
## Objective
|
||||
|
||||
Make winner advancement lines in the desktop double-elimination bracket bend at a
|
||||
consistent horizontal position. Two winner lines entering the same match should
|
||||
read as one visual pair when their vertical spans can share a rail: use the center
|
||||
of the 40px inter-column corridor when it is safe, and move the pair together only
|
||||
when another connector would interfere. If an accepted A/B mapping reverses the
|
||||
source order and makes those spans overlap, preserve separate deterministic,
|
||||
stroke-clear rails instead of creating a collinear overlap.
|
||||
|
||||
The primary user is a participant or organizer tracing advancement through a busy
|
||||
eight-team bracket. Success means the solid coral winner paths are visually
|
||||
aligned without degrading the existing dashed loser paths, card placement, or
|
||||
keyboard-driven connector highlighting.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Treat the two `winner` connectors entering one Series as a semantic bundle.
|
||||
- Prefer `target.x - columnGap / 2` for a winner bundle.
|
||||
- If the preferred rail causes crossings, collinear overlap, or less than 5px of
|
||||
clearance from an overlapping parallel route, move a shareable bundle to the
|
||||
nearest safe rail. Retain separate rails only when the pair's own vertical spans
|
||||
overlap and therefore cannot safely share any rail; move those rails to the
|
||||
nearest deterministic positions needed to preserve the same 5px clearance.
|
||||
- Preserve the current loser/reset rail ordering unless moving one is required to
|
||||
maintain valid geometry.
|
||||
- Keep every connector as a separate `H-V-H` SVG path so focus highlighting and
|
||||
accessible labels remain independent.
|
||||
- Keep long-distance bends inside the corridor immediately before the target
|
||||
column; do not use the midpoint between source and target cards.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19, TypeScript 6, Vite 8, Tailwind CSS 4, and daisyUI under `apps/web`
|
||||
- Node's built-in test runner for the pure bracket layout calculation
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused layout tests: `pnpm --filter web exec node --test --experimental-strip-types test/double-elimination-bracket-layout.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
- Development server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/components/competition/double-elimination-bracket-layout.ts`
|
||||
validates the bracket graph, positions cards, assigns connector rails, and emits
|
||||
SVG path geometry.
|
||||
- `apps/web/src/components/competition/DoubleEliminationBracket.tsx` renders the
|
||||
computed paths and must not need routing-specific changes.
|
||||
- `apps/web/test/double-elimination-bracket-layout.test.ts` contains canonical
|
||||
four-team, eight-team, and reset-final fixtures plus geometry assertions.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep routing deterministic and express geometry through small named helpers:
|
||||
|
||||
```ts
|
||||
const preferredX = target.x - geometry.columnGap / 2;
|
||||
const verticalX = nearestSafeRail(preferredX, bundle, occupiedRoutes);
|
||||
```
|
||||
|
||||
Use existing layout types and semantic connector kinds. Do not add a dependency,
|
||||
DOM measurement, mutable global state, or renderer-specific routing behavior.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Add regression tests before implementation and confirm they fail against the
|
||||
current per-edge rail allocator.
|
||||
- Assert observable geometry: safe winner pairs share a rail, quiet corridors use
|
||||
their exact midpoint, busy corridors keep a pair aligned, and mixed
|
||||
winner/loser entries remain distinguishable.
|
||||
- Cover reversed A/B winner input explicitly: it remains deterministic and uses
|
||||
separate rails without collinear overlap or focused-stroke clearance conflicts
|
||||
because no shared H-V-H rail is safe.
|
||||
- Replace the obsolete "all rails in a target column are unique" assertion with
|
||||
interval-aware overlap and 5px focused-stroke clearance protection.
|
||||
- Preserve deterministic output for shuffled input, finite path coordinates,
|
||||
target-corridor bounds, card avoidance, endpoint alignment, and canonical graph
|
||||
validation.
|
||||
- Verify four-team, eight-team, and reset-final layouts; run the complete web test,
|
||||
lint, and production build commands.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Keep winner, loser, and reset connectors visually distinguishable by the existing
|
||||
solid/dashed patterns and brand tokens.
|
||||
- Keep connector rails strictly inside the target corridor.
|
||||
- Avoid strict segment crossings and collinear overlaps whenever a safe candidate
|
||||
exists.
|
||||
- Keep overlapping parallel winner and loser rails at least 5px apart, matching
|
||||
the widest focused connector underlay.
|
||||
- Produce the same layout regardless of projection input ordering.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add dependencies or change the public projection contract.
|
||||
- Change bracket card dimensions, round columns, or the 40px column gap.
|
||||
- Redesign mobile bracket presentation or connector interaction behavior.
|
||||
|
||||
### Never
|
||||
|
||||
- Route a connector through a match card.
|
||||
- Infer routing from Series codes; use canonical graph identity and topology.
|
||||
- Merge two logical connectors into one SVG path.
|
||||
- Modify unrelated competition or score-card behavior.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- The two winner paths into `LB_R3_M1` bend at the corridor midpoint and share the
|
||||
same `verticalX`.
|
||||
- The winner paths into the grand final share the corridor midpoint when safe.
|
||||
- Every same-target winner pair whose vertical spans do not overlap shares one
|
||||
`verticalX`, using the nearest collision-safe rail when the midpoint is busy.
|
||||
- A reversed A/B pair with overlapping vertical spans retains deterministic
|
||||
separate rails, produces no collinear segment overlap, and remains at least 5px
|
||||
from every overlapping vertical route.
|
||||
- Loser/reset paths retain their baseline rails, and winner bundles remain at least
|
||||
5px away where their vertical runs overlap.
|
||||
- All rails remain inside their target corridors without card penetration or
|
||||
collinear overlap.
|
||||
- Canonical four-team, eight-team, reset-final, and shuffled-input tests pass.
|
||||
- Full web tests and production build pass; changed-file lint passes, and any
|
||||
unrelated full-lint baseline failures are documented.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user reviewed the proposed bundle-aware routing behavior and requested
|
||||
implementation.
|
||||
@@ -1,170 +0,0 @@
|
||||
# Spec: Internal Match Game Analysis P0/P1
|
||||
|
||||
## Objective
|
||||
|
||||
Make an internal-match game result explain both the final numbers and how the game
|
||||
reached them. P0 exposes data already present in the detail response: objective
|
||||
events, complete team objectives, participant gold/GPM, and explicitly labelled
|
||||
kill participation. P1 projects Riot Match-V5 timeline frames into real 10- and
|
||||
15-minute lane checkpoints and a unified event stream for kills and structures.
|
||||
|
||||
The primary user is a tournament participant or organizer reviewing a completed
|
||||
game on desktop or mobile. Success means the user can identify the major objective
|
||||
sequence before reading ten player cards, compare lane state at 10/15 minutes, and
|
||||
trace kills and building events without mistaking unavailable data for zero.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Place game flow immediately after the game summary and before detail tabs.
|
||||
- Render chart events as both visual markers and a keyboard-readable text list.
|
||||
- Keep the existing gold/XP toggle and runes/build experience.
|
||||
- Show tower, dragon, inhibitor, Baron, Rift Herald, Void Grub, and Elder Dragon
|
||||
totals; derive dragon type labels only when objective events are available.
|
||||
- Combine participant CS and economy instead of adding another wide table column.
|
||||
- Label kill participation explicitly as `KP`.
|
||||
- Replace final-state values in the lane tab with 10/15-minute checkpoints; default
|
||||
to 15 minutes and pair players by `teamPosition`, never array position.
|
||||
- Keep `objectiveEvents` for compatibility and add `timelineEvents` for the unified
|
||||
P1 stream.
|
||||
- Treat missing checkpoints and events as unavailable, not zero.
|
||||
- Do not add an opaque MVP/rating or new external data feed in this scope.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19, TypeScript 6, Recharts 3, Tailwind CSS 4, and daisyUI under `apps/web`
|
||||
- NestJS 11, TypeScript 5, Mongoose 9, and Jest under `apps/api`
|
||||
- Riot Match-V5 match and timeline payloads already cached in `RiotMatchModel`
|
||||
- Node's built-in test runner for pure web transformations
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
- Focused API tests: `pnpm --filter api test -- --runInBand riot-match.service.spec.ts match-stats-fragment.builder.spec.ts community-stats.service.spec.ts`
|
||||
- API build: `pnpm --filter api build`
|
||||
- Development web server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/pages/MatchGameDetailPage.tsx` owns the result summary,
|
||||
participant scoreboard, flow chart, and accessible event list.
|
||||
- `apps/web/src/components/InternalGameAnalysisTabs.tsx` owns the lane and build
|
||||
tabs.
|
||||
- `apps/web/src/lib/internal-match-timeline.ts` owns pure event normalization,
|
||||
labels, filtering, and chart projection.
|
||||
- `apps/web/src/lib/internal-game-matchups.ts` owns pure role pairing and checkpoint
|
||||
comparisons.
|
||||
- `apps/web/test/` contains Node unit tests for the pure web transformations.
|
||||
- `apps/api/src/modules/riot/` parses trusted fields from Riot match timelines.
|
||||
- `apps/api/src/modules/community-stats/match-stats-fragment.builder.ts` projects
|
||||
stored Riot payloads into cached internal-match records.
|
||||
- `apps/api/src/modules/community-stats/community-stats.service.ts` maps persisted
|
||||
records into the public detail response and versions response caches.
|
||||
- `apps/api/src/modules/global/database/schema.ts` defines persisted TypeScript
|
||||
shapes; nested `gameDetails` remains a Mongoose Mixed array.
|
||||
|
||||
## Data Contract
|
||||
|
||||
Participant checkpoint data is additive and optional for legacy/fallback games:
|
||||
|
||||
```ts
|
||||
interface MatchStatsCheckpoint {
|
||||
timestamp: number;
|
||||
gold: number;
|
||||
cs: number;
|
||||
xp: number;
|
||||
kills: number;
|
||||
deaths: number;
|
||||
assists: number;
|
||||
}
|
||||
|
||||
interface MatchStatsParticipantCheckpoints {
|
||||
at10?: MatchStatsCheckpoint;
|
||||
at15?: MatchStatsCheckpoint;
|
||||
}
|
||||
```
|
||||
|
||||
Each detailed participant gains optional `participantId` and `checkpoints`. Each
|
||||
game gains optional `timelineEvents`, whose `type` is an existing objective type or
|
||||
`championKill`, `tower`, or `inhibitor`. Actor IDs, assists, monster subtype, and
|
||||
tower subtype are optional fields appropriate to the event type.
|
||||
|
||||
For a 10/15-minute target, use the latest frame at or before the target only when it
|
||||
is less than one `frameInterval` old. Persist the actual selected timestamp. CS is
|
||||
`minionsKilled + jungleMinionsKilled`; checkpoint K/D/A includes champion-kill
|
||||
events through the selected timestamp. A game ending before a target has no value
|
||||
for that checkpoint.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep timeline calculations independent from React and use discriminated event
|
||||
types with conservative fallbacks:
|
||||
|
||||
```ts
|
||||
const events = game.timelineEvents?.length
|
||||
? game.timelineEvents
|
||||
: game.objectiveEvents;
|
||||
|
||||
const checkpoint = participant.checkpoints?.at15;
|
||||
if (!checkpoint) return { kind: "unavailable" };
|
||||
```
|
||||
|
||||
Use existing semantic color tokens and square bordered panels. Dynamic chart
|
||||
coordinates may use numeric props; spacing, colors, and typography remain in the
|
||||
existing Tailwind/daisyUI system.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Develop pure event normalization, checkpoint selection, role pairing, and metric
|
||||
comparison test-first.
|
||||
- Builder tests cover exact and missing checkpoints, jungle CS, cumulative K/D/A,
|
||||
executes, objective fallback, building ownership, and deterministic event order.
|
||||
- Service tests reject stale cached response shapes and verify additive mapping.
|
||||
- Browser verification covers 320px, 390px, 768px, 1024px, and 1440px; the event
|
||||
text list is the accessible equivalent of decorative chart markers.
|
||||
- Verify the supplied production-like game as well as a short game and a game with
|
||||
no timeline.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Preserve existing `objectiveEvents`, runes/builds, and match-detail routes.
|
||||
- Derive participant checkpoint values from stored Riot timeline frames.
|
||||
- Pair lanes by normalized `teamPosition` and show unavailable states explicitly.
|
||||
- Communicate team/event meaning with text as well as color.
|
||||
- Increment the match-stats builder and detail-response cache versions whenever a
|
||||
persisted or cached response shape changes.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add a frontend or backend dependency.
|
||||
- Change the public route or remove compatibility fields.
|
||||
- Add a database migration or make a bulk external Riot API fetch.
|
||||
- Deploy, push, or alter CI configuration.
|
||||
|
||||
### Never
|
||||
|
||||
- Infer absent checkpoint data as zero.
|
||||
- Pair opponents by array order.
|
||||
- Claim that a nearby objective caused a gold swing.
|
||||
- Expose unparsed arbitrary Riot event fields.
|
||||
- Modify unrelated Competition/bracket work already present in the worktree.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Game flow appears before player details and includes objective markers plus an
|
||||
equivalent textual sequence on desktop and mobile.
|
||||
- Summary shows all currently projected objective totals and available dragon types.
|
||||
- Every participant shows labelled KP, gold, GPM, CS, and CS/min without breaking
|
||||
the responsive scoreboard.
|
||||
- The lane tab defaults to 15 minutes, can switch to 10 minutes, and presents
|
||||
GD/CSD/XPD and checkpoint K/D/A for correctly paired roles.
|
||||
- The unified timeline can filter and display objectives, champion kills, towers,
|
||||
and inhibitors, while falling back to objective-only data during rolling updates.
|
||||
- Focused API/web tests, lint, and production builds pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user reviewed the P0/P1 task plan and requested implementation.
|
||||
@@ -1,93 +0,0 @@
|
||||
# Spec: 카카오톡 방 이동 후 사용자 데이터 이관
|
||||
|
||||
## Objective
|
||||
|
||||
`!내전 데이터이관 <예전 kakaoTalkNickname>` 명령으로 기존 user의
|
||||
`kakaoTalkId`를 명령 발신자의 현재 ID로 변경한다. 기존 user의 `_id`,
|
||||
`riotAccounts`, 참가 기록, 권한과 기타 데이터는 유지한다.
|
||||
|
||||
## Proposed Success Criteria
|
||||
|
||||
- 현재 명령이 연결된 community 안에서만 조회한다.
|
||||
- 인자 전체를 예전 닉네임으로 취급하여 공백이 포함된 닉네임을 지원한다.
|
||||
- 닉네임은 앞뒤 인자 공백을 제거한 후 정확히 일치하는 값으로 조회한다.
|
||||
- `riotAccounts`가 있는 기존 user를 이관 대상으로 삼는다.
|
||||
- 대상 없음, 중복 닉네임, 다른 user의 현재 카카오 ID 점유는 변경 없이 안내한다.
|
||||
- 성공 시 기존 user의 `kakaoTalkId`만 변경하고 발신자에게 완료를 안내한다.
|
||||
- 동일 ID로 재시도하면 이미 연결된 상태로 안내한다.
|
||||
- 동시 변경과 DB 중복 키 오류를 처리하며 새 user를 생성하거나 병합하지 않는다.
|
||||
|
||||
## Tech Stack / Project Structure
|
||||
|
||||
NestJS 11, TypeScript, Mongoose 9, Jest 30, pnpm workspace.
|
||||
`apps/api/src/modules/dakao/`의 parser, handler, service, module 및 명령 라우팅을 사용한다.
|
||||
테스트는 구현 옆 `*.spec.ts`, 명세는 `docs/specs/`에 둔다.
|
||||
|
||||
## Commands
|
||||
|
||||
- 관련 테스트: `pnpm --filter api test --runInBand dakao`
|
||||
- 전체 API 테스트: `pnpm --filter api test --runInBand`
|
||||
- 빌드: `pnpm --filter api build`
|
||||
- 변경 파일 lint: `pnpm --filter api exec eslint <changed-files>`
|
||||
- 개발 실행: `pnpm --filter api start:debug`
|
||||
|
||||
## Code Style
|
||||
|
||||
기존 Injectable handler/service와 discriminated command union 패턴을 따른다.
|
||||
|
||||
```typescript
|
||||
return { kind: 'data-transfer', previousNickname: args };
|
||||
```
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
구현 전 실패 테스트를 작성한다. 파싱, 커뮤니티 범위, 성공 후 기존 데이터 보존,
|
||||
대상 없음/중복, ID 충돌, 재시도, 동시 갱신 실패 및 라우팅/응답을 검증한다.
|
||||
관련 테스트 후 전체 API 테스트와 빌드를 수행한다.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Always: 커뮤니티 범위 제한, 입력 검증, 기존 user 식별자 및 연결 데이터 보존.
|
||||
- Ask first: 스키마 변경, 의존성 추가, 기존 user 병합/삭제.
|
||||
- Never: 운영 DB 직접 수정, 비밀값 커밋, 실패 테스트 제거.
|
||||
|
||||
## Confirmed Policy
|
||||
|
||||
사용자 확인: `riotAccounts`가 등록된 user를 뜻한다. Riot 계정 검증 및 소유권
|
||||
확인은 하지 않으며 운영으로 통제한다. 예전 닉네임으로 조회하여 ID만 변경한다.
|
||||
|
||||
## Implementation Plan and Tasks
|
||||
|
||||
1. 이관 서비스: `dakao-user.service.ts` 및 전용 테스트 파일.
|
||||
- 수락 조건: 기존 데이터 보존, 대상/충돌/재시도/동시 변경 처리.
|
||||
- 검증: 실패 테스트 확인 후 서비스 테스트 통과.
|
||||
2. 명령 parser 및 handler: 구현과 각각의 테스트 4개 파일.
|
||||
- 수락 조건: 공백 포함 닉네임 파싱, 빈 입력 사용법, 결과별 한국어 응답.
|
||||
- 검증: parser/handler 테스트 통과. 작업 1에 의존.
|
||||
3. subscriber 및 module 연결: 구현 2개와 subscriber 테스트.
|
||||
- 수락 조건: 현재 커뮤니티/발신자 ID 전달, 도움말 노출.
|
||||
- 검증: Dakao 테스트, 전체 API 테스트, 빌드, 변경 파일 lint. 작업 2에 의존.
|
||||
|
||||
위험: 동시에 이관되는 user는 기존 ID를 조건으로 갱신하여 덮어쓰기를 막고,
|
||||
새 ID 동시 점유는 기존 unique 인덱스 오류를 충돌 응답으로 변환한다.
|
||||
각 단계에서 테스트를 확인하고 다음 단계로 진행한다.
|
||||
|
||||
## Verification Results
|
||||
|
||||
- 서비스, parser/handler, subscriber 테스트는 기능 미구현 상태의 실패를 확인한 후 통과.
|
||||
- Dakao: 16 suites / 92 tests 통과.
|
||||
- API 전체: 99 suites / 634 tests 통과, 기존 테스트 2개 실패.
|
||||
- `api-performance-report.spec.ts`: Windows `path.relative`의 역슬래시와 기대값 불일치.
|
||||
- `secret.service.spec.ts`: 환경변수에 의존해 누락된 bootstrap secret의 기대 키 불일치.
|
||||
- 두 테스트는 변경하지 않은 파일이며 별도 실행에서도 같은 실패 재현.
|
||||
- API 빌드, 변경 TypeScript 파일 ESLint, `git diff --check` 통과.
|
||||
- 로컬 실행 환경 Node 24.15.0; 저장소 엔진 요구사항은 Node 26.
|
||||
- 실제 카카오톡 메시지 전송 및 운영 DB 이관은 실행하지 않음.
|
||||
- 코드 검토: 커뮤니티 제한, 정확한 닉네임 조회, 등록 계정 필터,
|
||||
ID만 갱신하는 조건부 업데이트, 충돌 응답, DI 및 명령 라우팅 확인.
|
||||
|
||||
## Usage
|
||||
|
||||
새 방에서 `!내전 데이터이관 예전 닉네임`을 실행한다. 따옴표 없이 공백을 포함한
|
||||
닉네임 전체를 입력할 수 있다. 새 ID로 이미 user가 생성되어 있으면 자동 병합하지
|
||||
않고 운영자 문의를 안내한다. 소유권 확인은 운영 정책으로 통제한다.
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
세트의 기본 헤더에는 `2:0`도, 세트 승패를 숫자로 바꾼 `1:0`도 넣지 않는다. 필요하면 별도 `시리즈 최종 2:0` 또는 `시리즈 현재 1:0`을 함께 표시한다. `현재/최종`은 공식 시리즈 상태가 결정한다. 동일 두 팀이 승자조와 결승에서 다시 만나면 별개의 `seriesId`와 세트 목록을 가진다.
|
||||
|
||||
표의 라운드 이름은 설명용 예시다. 화면에서는 기존 공식 대진의 라운드 이름을 공용 함수로 재사용하고 내전 상세, 전적, 팀 진행 사이에서 같은 이름을 쓴다. [기존 팀 진행 명세](team-progress-page-ux-refresh.md)
|
||||
표의 라운드 이름은 설명용 예시다. 화면에서는 기존 공식 대진의 라운드 이름을 공용 함수로 재사용하고 내전 상세, 전적, 팀 진행 사이에서 같은 이름을 쓴다. [라운드 이름 공용 함수](../../apps/web/src/components/competition/double-elimination-bracket-layout.ts#L202)
|
||||
|
||||
| 시리즈/슬롯 상태 | 화면 문구와 점수 |
|
||||
| --- | --- |
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
# Spec: Refresh Riot ID by PUUID
|
||||
|
||||
## Objective
|
||||
|
||||
Whenever an account is refreshed manually from the personal match-history page
|
||||
or automatically by the stale-account background scheduler, resolve its current
|
||||
Riot ID through Riot Account-V1 using the stored PUUID. If the player changed
|
||||
either their game name or tag line, persist the latest values on the same embedded
|
||||
Riot account so the profile displays the new Riot ID.
|
||||
|
||||
The existing refresh job remains the single user-facing operation. It continues
|
||||
to refresh matches and ranked data, and additionally refreshes identity before
|
||||
emitting its completion event.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Use the stored PUUID as the stable identity key; never look up the account by
|
||||
the possibly stale game name and tag line.
|
||||
- Query Riot Account-V1 on every manually queued user-history refresh job and
|
||||
every selected stale-account background refresh rather than applying a name TTL.
|
||||
- Update `gameName` and `tagLine` together only when Riot returns a matching PUUID
|
||||
and both values are non-empty.
|
||||
- Preserve the previous Riot ID if the Account-V1 lookup fails or returns an
|
||||
incomplete or mismatched response.
|
||||
- Treat identity refresh as best effort, matching the existing ranked-data refresh
|
||||
policy: log a failure but allow successful match refresh work to complete.
|
||||
- When a caller does not already know the Riot regional route, resolve it from the
|
||||
user's community and fall back to `asia` only when the community has no route.
|
||||
- Do not increment the background failure counter or enter backoff solely because
|
||||
the identity lookup failed; background statistics enrichment retains its
|
||||
existing success and failure semantics.
|
||||
- Reuse the existing refresh completion event and profile-query invalidation; do
|
||||
not add a new endpoint, response field, socket event, or frontend state path.
|
||||
- Update only the embedded Riot account used by the personal profile. Historical
|
||||
match snapshots retain the names recorded by Riot for those games.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- NestJS 11, TypeScript 5, Mongoose 9, and Jest under `apps/api`
|
||||
- Riot Account-V1 through the existing `RiotAccountService`
|
||||
- Redis stream jobs through the existing `RiotJobWorkerService`
|
||||
- Scheduled stale-account refresh through `BackgroundRefreshScheduler`
|
||||
- React Query profile invalidation already present in `UserHistoryPage`
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused tests:
|
||||
`pnpm --filter api exec jest --runInBand riot-account-enrichment.service.spec.ts riot-job-worker.service.spec.ts background-refresh.scheduler.spec.ts`
|
||||
- API lint: `pnpm --filter api lint`
|
||||
- API build: `pnpm --filter api build`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web production build: `pnpm --filter web build:prod`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/api/src/modules/riot/riot-account.service.ts` owns the validated
|
||||
Account-V1 PUUID lookup.
|
||||
- `apps/api/src/modules/riot/riot-account-enrichment.service.ts` owns the
|
||||
persistence boundary for the embedded Riot account.
|
||||
- `apps/api/src/modules/riot/riot-account-enrichment.service.spec.ts` verifies
|
||||
update, no-op, and failure behavior.
|
||||
- `apps/api/src/modules/riot-job-queue/riot-job-worker.service.ts` orchestrates
|
||||
identity, match, and ranked refresh work before completion.
|
||||
- `apps/api/src/modules/riot-job-queue/riot-job-worker.service.spec.ts` verifies
|
||||
that a personal-history refresh job requests the PUUID-based identity refresh.
|
||||
- `apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.ts`
|
||||
orchestrates best-effort identity refresh for stale accounts before statistics
|
||||
enrichment.
|
||||
- `apps/api/src/modules/riot-background-refresh/background-refresh.scheduler.spec.ts`
|
||||
verifies background invocation, ordering, and failure isolation.
|
||||
- `apps/web/src/pages/UserHistoryPage.tsx` already invalidates the profile query
|
||||
when the refresh socket reports completion and is not modified in this scope.
|
||||
|
||||
## Internal Contract
|
||||
|
||||
Add one focused method to `RiotAccountEnrichmentService`:
|
||||
|
||||
```ts
|
||||
type RefreshRiotIdentityResult = "updated" | "unchanged" | "failed";
|
||||
|
||||
refreshRiotIdentity(params: {
|
||||
userId: mongoose.Types.ObjectId;
|
||||
puuid: string;
|
||||
region?: RiotRegionalRoute;
|
||||
}): Promise<RefreshRiotIdentityResult>;
|
||||
```
|
||||
|
||||
`updated` means both persisted Riot ID fields now match Account-V1. `unchanged`
|
||||
means the validated response matched the stored values and no database write was
|
||||
needed. `failed` means no stored account could be resolved or the external lookup
|
||||
could not safely provide a complete identity; stored values remain unchanged. If
|
||||
`region` is omitted, the service resolves the user's community and uses its
|
||||
configured `riotRegion`, falling back to `asia` only when unavailable.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep the external validation and persistence decision explicit:
|
||||
|
||||
```ts
|
||||
const identity = await this.accountService.getByPuuid(puuid, { region });
|
||||
if (identity.puuid !== puuid || !identity.gameName || !identity.tagLine) {
|
||||
return "failed";
|
||||
}
|
||||
```
|
||||
|
||||
Use existing single quotes, NestJS logging, Mongoose document mutation, and
|
||||
Prettier formatting. Do not add a generic identity abstraction or new dependency.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Write the enrichment-service tests first and confirm they fail before adding
|
||||
the new method.
|
||||
- Verify a changed game name and tag line are persisted together.
|
||||
- Verify identical values return `unchanged` without saving.
|
||||
- Verify missing values, PUUID mismatch, and Riot lookup errors return `failed`
|
||||
without overwriting or saving the stored identity.
|
||||
- Write the worker orchestration expectation before calling the new method.
|
||||
- Verify a region-less identity refresh uses the user's configured community
|
||||
region.
|
||||
- Write background scheduler expectations before adding identity refresh to the
|
||||
stale-account loop.
|
||||
- Verify identity refresh happens before statistics enrichment and that a rejected
|
||||
identity lookup does not increment background failure counters.
|
||||
- Run focused API tests after each slice, then API lint/build and web lint/build
|
||||
to verify the existing client integration remains valid.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Use the stored PUUID for Account-V1 lookup and verify the returned PUUID.
|
||||
- Validate both Riot ID fields before mutating the database.
|
||||
- Preserve the current Riot ID on any unsafe or failed response.
|
||||
- Keep the existing refresh route, enqueue response, and socket event compatible.
|
||||
- Keep background identity failures independent from enrichment failure counters.
|
||||
- Run focused tests before broader lint and build verification.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Add a database field or migration.
|
||||
- Change refresh failure semantics so an identity lookup failure fails the whole
|
||||
user-history job.
|
||||
- Update historical match snapshots or active match participant display names.
|
||||
- Add a new API response field, endpoint, dependency, or Redis job type.
|
||||
- Commit, push, deploy, or alter CI configuration.
|
||||
|
||||
### Never
|
||||
|
||||
- Resolve identity from the stale stored Riot ID.
|
||||
- Partially update only the game name or only the tag line.
|
||||
- Replace a valid stored identity with empty or mismatched Account-V1 data.
|
||||
- Expose Riot API errors or credentials to the browser.
|
||||
- Mix the change with the separate past-history result-column PR.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Clicking `정보 갱신` causes the queued worker to call Account-V1 by the stored
|
||||
PUUID.
|
||||
- Selecting a stale account for background refresh also calls Account-V1 by the
|
||||
stored PUUID before statistics enrichment.
|
||||
- A changed Riot game name or tag line is persisted on the matching embedded
|
||||
account before the completion event is broadcast.
|
||||
- The completion event triggers the existing profile-query invalidation, so the
|
||||
personal history header displays the latest `gameName#tagLine`.
|
||||
- Failed, incomplete, or mismatched Riot identity responses do not overwrite the
|
||||
existing Riot ID and do not prevent otherwise successful match refresh work.
|
||||
- Background identity lookup failures do not increment the account failure counter
|
||||
or prevent otherwise successful background enrichment.
|
||||
- Focused tests, API lint/build, and web lint/production build pass.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved this specification and requested implementation. The
|
||||
existing queue and UI invalidation paths support the behavior without a public
|
||||
contract change.
|
||||
@@ -1,162 +0,0 @@
|
||||
# Spec: Series Result History UI
|
||||
|
||||
## Objective
|
||||
|
||||
Replace the compact `Game N - winner` cards below Competition brackets with a
|
||||
chronological, Series-centric result history. Users should be able to scan when a
|
||||
Series was played, its round, participants, official result, and current score,
|
||||
then expand the row to inspect the accepted Games that produced that record.
|
||||
|
||||
This first version is a truthful activity/result history, not a future schedule.
|
||||
It uses only recorded Competition projection data and does not invent scheduled
|
||||
times, venues, replay links, or team logos.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Keep the bracket first as the topology view and place the chronological history
|
||||
below it.
|
||||
- Render one primary row per Series, never one primary row per Game.
|
||||
- Include a started `in-progress` Series when it has at least one accepted Game, so
|
||||
completed Games do not disappear while a best-of Series is still running.
|
||||
- Include every completed Series, including draw, walkover, forfeit, and
|
||||
administrative outcomes with no accepted Game.
|
||||
- Exclude inactive, waiting, ready, and game-less in-progress Series because they do
|
||||
not have a truthful result timestamp.
|
||||
- Use the earliest accepted Game `startedAt` as the Series activity time. For a
|
||||
game-less decision, group by `outcome.completedAt` but display no fake start time.
|
||||
- Group and format dates explicitly in `Asia/Seoul`.
|
||||
- Keep individual Games in a native, keyboard-accessible disclosure below the Series
|
||||
row.
|
||||
- Make each disclosed Game row a real link to its internal-stat Game detail. Keep the
|
||||
visible Series-local `ordinal`, but build the route from the globally unique
|
||||
`displayNumber`.
|
||||
- Preserve the current Competition page path in router state so the detail page can
|
||||
return users to the same result view.
|
||||
- Use the coral semantic primary token as an interaction cue on Game links (leading
|
||||
edge, focus ring, subtle state background, and arrow), not as a winner or score
|
||||
color.
|
||||
- Scope that primary override to the result-history section so the exact coral remains
|
||||
consistent in light and dark themes without changing unrelated dark-theme actions.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19 and TypeScript 6 under `apps/web`
|
||||
- Tailwind CSS 4 and daisyUI semantic tokens
|
||||
- Shared Competition contracts from `@lolympus/contracts`
|
||||
- Node's built-in test runner with TypeScript type stripping for pure model tests
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused RED/GREEN test:
|
||||
`pnpm --filter web exec node --test --experimental-strip-types test/competition-series-history.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web build: `pnpm --filter web build`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/components/competition/competition-series-history.ts` derives the
|
||||
stable, timezone-aware history view model without React.
|
||||
- `apps/web/src/components/competition/CompetitionSeriesHistory.tsx` renders the
|
||||
semantic date sections and responsive Series rows.
|
||||
- `apps/web/src/components/competition/CompetitionGameHistory.tsx` renders the
|
||||
disclosed, navigable Game rows and their responsive interaction states.
|
||||
- `apps/web/src/components/competition/CompetitionResults.tsx` replaces the existing
|
||||
completed-Game card grid with the new component and supplies the route context.
|
||||
- `apps/web/src/lib/internal-match-game-selection.ts` keeps explicit Game-detail
|
||||
routes from silently falling back to a different recorded Game.
|
||||
- `apps/web/test/competition-series-history.test.ts` specifies aggregation, ordering,
|
||||
outcome, and formatting behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Use contract discriminators and team IDs as the source of truth:
|
||||
|
||||
```ts
|
||||
const shouldInclude =
|
||||
(series.status === "in-progress" && games.length > 0) ||
|
||||
series.status === "completed";
|
||||
|
||||
const winnerTeamId =
|
||||
series.status === "completed" && series.outcome.type !== "draw"
|
||||
? series.outcome.winnerTeamId
|
||||
: undefined;
|
||||
```
|
||||
|
||||
The UI uses flat, full-width rows and existing semantic tokens. It does not reuse
|
||||
the bordered bracket card layout or introduce new dependencies.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
Develop the pure model test-first. Cover:
|
||||
|
||||
- Games aggregated by `seriesId` and ordered by Series-local `ordinal`;
|
||||
- Series score preserved from A/B entries even when blue/red sides change;
|
||||
- chronological ordering independent of projection graph order;
|
||||
- `Asia/Seoul` grouping across the UTC day boundary;
|
||||
- started in-progress Series and game-less completed decisions;
|
||||
- exclusion of unstarted and orphan data;
|
||||
- played, draw, walkover, forfeit, and administrative status semantics;
|
||||
- deterministic tie-breaking and legacy zero-duration formatting.
|
||||
- Game-detail route generation from `displayNumber`, including rejection of invalid
|
||||
legacy display numbers.
|
||||
- Exact internal Game selection, including a missing-result case when the requested
|
||||
display number is absent from a stale or legacy detail payload.
|
||||
|
||||
After unit tests, run full web tests, changed-file lint, and the TypeScript/Vite build.
|
||||
Review the markup for native keyboard interaction, heading order, visible status text,
|
||||
and mobile layouts down to 320px.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Use `series.entries` for A/B score and `outcome.winnerTeamId` for the official
|
||||
winner; never infer identity from score, array position, or blue/red side.
|
||||
- Keep game-less adjudications visible without presenting `0 : 0` as a played score.
|
||||
- Omit `durationSeconds === 0` because it represents missing legacy data.
|
||||
- Use `displayNumber`, never Series-local `ordinal`, for the internal Game URL.
|
||||
- Keep each Game row as one semantic anchor with no nested interactive control.
|
||||
- Keep link text readable in both themes; coral may indicate interaction but must not
|
||||
be the only visible cue.
|
||||
- Never substitute another Game when the Game number explicitly requested by the URL
|
||||
is not present in the internal-stat payload.
|
||||
- Preserve all unrelated working-tree changes.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Change the public Competition contract, database schema, or projector.
|
||||
- Add Series scheduling or external replay/venue data.
|
||||
- Add a frontend dependency or test framework.
|
||||
|
||||
### Never
|
||||
|
||||
- Present `completedAt` as a scheduled or actual start time.
|
||||
- Reuse free-text `match.schedule` as official Series scheduling data.
|
||||
- Parse `series.code` for identity, winner, or ordering.
|
||||
- Make status or winner understandable only through color.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- A completed `2 : 1` Series appears as one chronological row with both teams, the
|
||||
official score, round label, status, and an expandable three-Game history.
|
||||
- In-progress Series retain already accepted Games and display `진행 중`.
|
||||
- No-game decisions appear with the correct decision label and no misleading score
|
||||
or start time.
|
||||
- Date grouping and time display are stable in `Asia/Seoul` regardless of runtime
|
||||
timezone.
|
||||
- The layout is readable without horizontal scrolling at 320px and uses the wider
|
||||
double-elimination page naturally on desktop.
|
||||
- Each recorded Game can be opened by pointer or keyboard, lands on its matching
|
||||
internal-stat Game, and provides a return link to the Competition result page.
|
||||
- A temporarily stale or inconsistent detail payload shows an explicit missing-Game
|
||||
state rather than silently rendering the first Game.
|
||||
- Game rows expose an always-visible detail cue and coral hover, active, and focus
|
||||
affordances without changing winner semantics.
|
||||
- Focused/full tests, changed-file lint, and web build pass without modifying
|
||||
unrelated work.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the Series-centric, result-history-first direction and
|
||||
requested implementation.
|
||||
@@ -1,150 +0,0 @@
|
||||
# Spec: Team Progress Page UX Refresh
|
||||
|
||||
## Objective
|
||||
|
||||
Reorganize the team progress page around the participant's primary task: identify
|
||||
the next opponent, understand the Series state, and copy the correct tournament
|
||||
code without cross-referencing separate sections. Keep the existing Competition
|
||||
API and visual language while making status, adjudicated results, copy feedback,
|
||||
the roster, and past results clearer on desktop and mobile.
|
||||
|
||||
The primary user is a team participant preparing to join an official internal-match
|
||||
game. Success means every active Series and its codes form one understandable work
|
||||
area, human-facing Korean labels lead internal identifiers, and the copy flow is
|
||||
accessible and explicit.
|
||||
|
||||
## Approved Product Decisions
|
||||
|
||||
- Group tournament codes under their matching active Series using `seriesId`.
|
||||
- Label a Series-local game as `1세트`, `2세트`, and so on; retain global
|
||||
`Game 19`-style numbers only as secondary metadata.
|
||||
- Use the bracket's canonical visible round names from Competition round metadata:
|
||||
upper round 1 is `브래킷 1R`, later upper rounds are `브래킷 상위 nR`, and
|
||||
lower rounds are `브래킷 하위 nR`. Retain raw Series codes such as `WB_FINAL`
|
||||
as secondary diagnostic text.
|
||||
- Show pre-start and adjudicated Series without misleading `0–0` scores.
|
||||
- Distinguish `부전승`, `기권승`, `판정승`, and `무승부` using the existing
|
||||
outcome discriminator. Do not invent a free-form reason that is not public data.
|
||||
- Make copy targets at least 44 CSS pixels high, uniquely label each button, keep
|
||||
the complete code visible/selectable, and announce copy success or failure.
|
||||
- Order the page as header, next matches with codes, compact roster, then recent
|
||||
results. Show two recent results and collapse older entries.
|
||||
- Preserve existing loading, selection, empty, error, revision-consistency, and
|
||||
authorization behavior.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- React 19 and TypeScript 6 under `apps/web`
|
||||
- Tailwind CSS 4 and daisyUI 5 using the repository's square bordered surfaces
|
||||
- Node's built-in test runner for pure view-model behavior
|
||||
- Existing `lucide-react` icon set; no new dependency
|
||||
|
||||
## Commands
|
||||
|
||||
- Focused tests: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
||||
- Full web tests: `pnpm --filter web test`
|
||||
- Web lint: `pnpm --filter web lint`
|
||||
- Web build: `pnpm --filter web build`
|
||||
- Development server: `pnpm --filter web start:dev`
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `apps/web/src/pages/MatchTeamProgressPage.tsx` owns queries, snapshot guards,
|
||||
page ordering, and top-level team navigation.
|
||||
- `apps/web/src/pages/match-team-progress-view.ts` owns pure grouping, ordering,
|
||||
labels, code state, and copy-result behavior.
|
||||
- `apps/web/src/components/competition/double-elimination-bracket-layout.ts`
|
||||
remains the canonical source for visible bracket round names.
|
||||
- `apps/web/src/components/competition/TeamTournamentCodes.tsx` owns code rows and
|
||||
clipboard feedback.
|
||||
- `apps/web/src/components/competition/TeamSeriesCard.tsx` owns the page-specific
|
||||
Series summary, leaving bracket/history card geometry and behavior unchanged.
|
||||
- `apps/web/test/match-team-progress-view.test.ts` specifies the new pure behavior.
|
||||
|
||||
## Code Style
|
||||
|
||||
Keep data transformation outside React and render semantic native controls:
|
||||
|
||||
```ts
|
||||
const seriesCodes = tournamentCodesForSeries(
|
||||
teamView.tournamentCodes,
|
||||
series.seriesId,
|
||||
);
|
||||
|
||||
<button aria-label={`${setLabel} 토너먼트 코드 복사`}>
|
||||
복사
|
||||
</button>
|
||||
```
|
||||
|
||||
Use `text-content-subtle` and `text-content-muted` for secondary text. Semantic
|
||||
colors may provide a border or background accent, while normal-size text remains a
|
||||
high-contrast base-content color.
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
- Test code-to-Series association by exact `seriesId` and deterministic ordinal
|
||||
ordering before adding the UI.
|
||||
- Test bracket-aligned round labels, code availability/expiry state, unique copy
|
||||
labels, and explicit clipboard success/failure results as pure functions.
|
||||
- Test every page-specific Series lifecycle/outcome branch, including played and
|
||||
administrative draws, so the local summary cannot drift silently.
|
||||
- Run the complete web suite, lint, and build after the focused tests pass.
|
||||
- When the in-app browser is available, runtime verification covers 320px, 768px,
|
||||
1024px, and 1440px; keyboard focus, copy announcements, long-code reflow, and
|
||||
console output are checked manually.
|
||||
|
||||
## Boundaries
|
||||
|
||||
### Always
|
||||
|
||||
- Join assignments to active Series only by the contract's `seriesId`.
|
||||
- Keep the full tournament code selectable and copy the unmodified string.
|
||||
- Preserve native link, button, list, table, heading, and disclosure semantics.
|
||||
- Use the existing design tokens and icon dependency.
|
||||
|
||||
### Ask First
|
||||
|
||||
- Change the API or public contract.
|
||||
- Add a dependency or browser-test framework.
|
||||
- Change tournament-code authorization or visibility policy.
|
||||
- Deploy, push, or alter CI.
|
||||
|
||||
### Never
|
||||
|
||||
- Infer a Series association from global game numbers.
|
||||
- Display an adjudicated `0–0` as if it were a played result.
|
||||
- Expose private facts or fabricate an adjudication reason.
|
||||
- Hide copy failure or rely on color alone for state.
|
||||
- Modify unrelated Competition, bracket, or theme behavior.
|
||||
|
||||
## Success Criteria
|
||||
|
||||
- Each active Series appears as a full-width next-match panel containing only its
|
||||
own ordered code rows.
|
||||
- Bracket-aligned labels lead raw Series codes, and Series-local set numbers lead
|
||||
global game numbers.
|
||||
- Ready Series show a pending score, while adjudicated results show their result
|
||||
category instead of a numeric score.
|
||||
- Copy buttons have unique accessible names, 44px targets, visible/live feedback,
|
||||
and an explicit failure path.
|
||||
- The roster uses Korean position labels in canonical role order, with the captain
|
||||
marker close to the player name.
|
||||
- At most two recent results are expanded by default; older results are available
|
||||
through a keyboard-accessible disclosure.
|
||||
- Focused and full tests, scoped lint, and build pass. Responsive runtime review is
|
||||
recorded separately when the in-app browser is available.
|
||||
|
||||
## Verification Record
|
||||
|
||||
- Focused view-model tests: 9 passed.
|
||||
- Full web suite: 88 passed without skips.
|
||||
- Scoped ESLint for all team-progress files: passed.
|
||||
- Production TypeScript/Vite build: passed; only the existing large-chunk warning
|
||||
remains.
|
||||
- Full repository lint remains blocked by pre-existing errors in unrelated files.
|
||||
- Runtime screenshot/keyboard verification was not claimed because the required
|
||||
in-app browser was unavailable in this session.
|
||||
|
||||
## Open Questions
|
||||
|
||||
None. The user approved the audit recommendations and requested implementation.
|
||||
Reference in new issue
Block a user