`# Graph Report - docs/data-patterns (2026-05-29) ## Corpus Check - Corpus is ~13,070 words - fits in a single context window. You may not need a graph. ## Summary - 173 nodes · 177 edges · 28 communities (12 shown, 16 thin omitted) - Extraction: 97% EXTRACTED · 3% INFERRED · 0% AMBIGUOUS · INFERRED: 5 edges (avg confidence: 0.91) - Token cost: 154,966 input · 0 output ## Community Hubs (Navigation) - [[_COMMUNITY_ReadWrite Optimization Fixes|Read/Write Optimization Fixes]] - [[_COMMUNITY_Archive & Stats Pipeline|Archive & Stats Pipeline]] - [[_COMMUNITY_Scoreboard & User Write Fixes|Scoreboard & User Write Fixes]] - [[_COMMUNITY_Client User Auth & Profile|Client User Auth & Profile]] - [[_COMMUNITY_Server Cron & Game Sync|Server Cron & Game Sync]] - [[_COMMUNITY_Client KBO Data (RankPlayer)|Client KBO Data (Rank/Player)]] - [[_COMMUNITY_Client KBO Schedule & GameDetail|Client KBO Schedule & GameDetail]] - [[_COMMUNITY_Prediction Vote Flow|Prediction Vote Flow]] - [[_COMMUNITY_Server Vote & RTDB Layer|Server Vote & RTDB Layer]] - [[_COMMUNITY_Game Trigger & Stats Invalidation|Game Trigger & Stats Invalidation]] - [[_COMMUNITY_Attendance & Notification|Attendance & Notification]] - [[_COMMUNITY_Attendance Service (Server)|Attendance Service (Server)]] - [[_COMMUNITY_kboCache & Lock|kboCache & Lock]] - [[_COMMUNITY_User Profile Service|User Profile Service]] - [[_COMMUNITY_Scoreboard Cache|Scoreboard Cache]] - [[_COMMUNITY_Nickname Reservation|Nickname Reservation]] - [[_COMMUNITY_voteHistory Subcollection|voteHistory Subcollection]] - [[_COMMUNITY_pointLedger Subcollection|pointLedger Subcollection]] - [[_COMMUNITY_Firebase Auth (Client)|Firebase Auth (Client)]] - [[_COMMUNITY_Remote Config (Client)|Remote Config (Client)]] - [[_COMMUNITY_Firestore Trigger|Firestore Trigger]] - [[_COMMUNITY_rankSnapshot Service|rankSnapshot Service]] - [[_COMMUNITY_KBO External API|KBO External API]] - [[_COMMUNITY_MemCache (In-Memory)|MemCache (In-Memory)]] - [[_COMMUNITY_RTDB userVotes Path|RTDB userVotes Path]] - [[_COMMUNITY_RTDB scoreboardCache|RTDB scoreboardCache]] - [[_COMMUNITY_Client Prediction Provider|Client Prediction Provider]] - [[_COMMUNITY_Stats Cache (RTDB)|Stats Cache (RTDB)]] ## God Nodes (most connected - your core abstractions) 1. `userService (Server)` - 7 edges 2. `dailyArchive Cron (03:00 KST)` - 7 edges 3. `UserRepository (keepAlive)` - 7 edges 4. `kboRepository (Server)` - 6 edges 5. `dailyArchive.ts (setDay + judgeDay)` - 6 edges 6. `Firestore users Collection` - 5 edges 7. `Firestore games Collection` - 5 edges 8. `RTDB /cache/stats/{uid} Path` - 5 edges 9. `scoreboardService (Server)` - 5 edges 10. `gameSyncService (Server)` - 5 edges ## Surprising Connections (you probably didn't know these) - `RTDB: votes/{gameId}/counts (public read)` --semantically_similar_to--> `RTDB: voteAggregates/{gameId} (public read)` [INFERRED] [semantically similar] graphify-out/tmp-corpus/backend_optimization-plan.md → graphify-out/tmp-corpus/client_improvements-client.md - `dailyArchive Cron (03:00 KST)` --writes_to--> `Firestore users Collection` [EXTRACTED] graphify-out/tmp-corpus/backend_backend-writes.md → graphify-out/tmp-corpus/backend_backend-reads.md - `Client FCM / users.fcmTokens Direct Write` --writes_to--> `Firestore users Collection` [EXTRACTED] graphify-out/tmp-corpus/backend_data-lifecycle.md → graphify-out/tmp-corpus/backend_backend-reads.md - `POST /admin/game/end Endpoint (markGameEnded)` --writes_to--> `Firestore games Collection` [EXTRACTED] graphify-out/tmp-corpus/backend_backend-writes.md → graphify-out/tmp-corpus/backend_backend-reads.md - `gameResultService (Server)` --reads_from--> `RTDB /votes/{gameId} Path` [EXTRACTED] graphify-out/tmp-corpus/backend_backend-writes.md → graphify-out/tmp-corpus/backend_backend-reads.md ## Hyperedges (group relationships) - **KBO External Fetch to Cache to Client Endpoint Pipeline** — backend_reads_external_kbo, backend_reads_firestore_kbocache, backend_reads_repo_kbocacherepo, backend_reads_firestore_kbolocks, backend_lifecycle_concept_distributedlock [EXTRACTED 1.00] - **dailyArchive Cron Write Pipeline** — backend_writes_cron_dailyarchive, backend_reads_svc_judgmentservice, backend_reads_firestore_votehistory, backend_reads_firestore_users, backend_reads_svc_ranksnapshotservice, backend_reads_rtdb_scoreboardcache, backend_reads_rtdb_cachestats [EXTRACTED 1.00] - **onGameCompleted Fan-out Write Pattern** — backend_writes_trigger_ongamecompleted, backend_writes_svc_gameresultservice, backend_reads_rtdb_uservotes, backend_reads_rtdb_cachestats, backend_lifecycle_concept_fanout [EXTRACTED 1.00] - **Backend Read Optimization Set R1 R4 R5 R7** — backend_improvements_reads_r1_gamedaycache, backend_improvements_reads_r4_backoff, backend_improvements_reads_r5_fieldmask, backend_improvements_reads_r7_parallelrank [EXTRACTED 1.00] - **Backend Write Optimization Set W1 through W6** — backend_improvements_writes_w1_diff, backend_improvements_writes_w2_votehistory, backend_improvements_writes_w3_statsdedup, backend_improvements_writes_w4_ranksnapshot, backend_improvements_writes_w5r6_photourl, backend_improvements_writes_w6_gamedetailttl [EXTRACTED 1.00] - **User Prediction Vote Flow** — backend_writes_endpoint_post_prediction, backend_writes_endpoint_put_prediction, backend_reads_repo_voterepo, backend_reads_rtdb_votes, backend_reads_rtdb_uservotes [EXTRACTED 1.00] - **Tier 1 High-Impact Low-Risk Optimizations** — opt_W1, opt_W2, opt_R1, opt_C1 [EXTRACTED 1.00] - **Tier 2 Medium-Impact Optimizations** — opt_R2, opt_W3, opt_R3, opt_R4, opt_C2, opt_C3 [EXTRACTED 1.00] - **Tier 3 Small / Housekeeping Optimizations** — opt_W4, opt_W5, opt_W6, opt_R5, opt_R6, opt_R7, opt_C4 [EXTRACTED 1.00] - **Applied Client Optimizations (opt/client-rw branch)** — opt_C1, opt_C2, opt_C3, opt_C4, client_vote_repo_after, client_standings_provider_after, client_h2h_provider_after, client_ace_pitcher_after, client_current_user_after [EXTRACTED 1.00] - **SWR Cache Adapters (4 domains)** — client_schedule_cache, client_game_detail_cache, client_day_record_cache, client_game_record_dates_cache [EXTRACTED 1.00] - **All Client Repositories (keepAlive)** — client_game_repo, client_user_repo, client_prediction_repo, client_team_record_repo, client_player_repo, client_game_detail_repo, client_scoreboard_repo, client_attendance_repo [EXTRACTED 1.00] - **Duplicate CF Call Pattern (C2+C3)** — client_provider_h2h, client_provider_rank, client_ep_rank, client_provider_ace_pitcher, client_provider_pitchers, client_ep_player [EXTRACTED 1.00] ## Communities (28 total, 16 thin omitted) ### Community 0 - "Read/Write Optimization Fixes" Cohesion: 0.10 Nodes (22): R4: Cache Stampede Exponential Backoff Fix, R7: Multi-Year Rank Parallel Fetch Fix, W1: games syncGamesForMonth getAll+diff Fix, W6: game_detail Cache Bulk Invalidation Stopped, Client SWR Cache (swr_cache.dart), Distributed Lock (kboLocks TTL 30s), GET /kbo/gameDetail Endpoint, GET /kbo/player Endpoint (+14 more) ### Community 1 - "Archive & Stats Pipeline" Cohesion: 0.15 Nodes (18): R1: GameDayCache Memoization Fix, W2: voteHistory Double-Write Consolidation Fix, W3: Archive Stats Invalidation Fan-out Dedup Fix, Fan-out Write Pattern (stats invalidation), GET /prediction/games Endpoint, GET /stats Endpoint, Firestore games Collection, Firestore voteHistory Subcollection (+10 more) ### Community 2 - "Scoreboard & User Write Fixes" Cohesion: 0.13 Nodes (16): R5: Scoreboard Self-User FieldMask Fix, W4: Rank Snapshot Merged Into Judgment Tx Fix, W5+R6: getMe photoUrl Hot-Write Suppression Fix, Client FCM / users.fcmTokens Direct Write, Precompute Scoreboard Cache Concept, GET /prediction/scoreboard Endpoint, Firestore users Collection, RTDB /nicknames Path (+8 more) ### Community 3 - "Client User Auth & Profile" Cohesion: 0.14 Nodes (16): currentUser Provider After C4 (keepAlive), CF Endpoint: GET /user/check-nickname, CF Endpoint: DELETE /user, CF Endpoint: GET /user, CF Endpoint: PATCH /user (profile update), CF Endpoint: POST /user (onboarding), CF Endpoint: GET /prediction/scoreboard, CF Endpoint: GET /stats (+8 more) ### Community 4 - "Server Cron & Game Sync" Cohesion: 0.16 Nodes (15): Cron Job: 02:00 daily (syncGamesForMonth + kboCache invalidation), dailyArchive.ts (setDay + judgeDay), debugHandlers.ts (Unauthenticated forceSync/dailyArchive), syncGamesForMonth (gameSyncService.ts:63), Firestore: dailyArchive collection, Firestore: games collection, Firestore/Cache: kboCache (game_detail__ TTL), R1: dailyArchive listByDate Sharing (+7 more) ### Community 5 - "Client KBO Data (Rank/Player)" Cohesion: 0.16 Nodes (14): acePitcher Provider After C3 (derived from pitchers), CF Endpoint: GET /kbo/player, CF Endpoint: GET /kbo/rank, headToHead Provider After C2 (watches standings), Client Improvements Summary (C1-C4 Applied), PlayerRepository (keepAlive), acePitcher Provider (autoDispose, duplicate player call), h2h Provider (autoDispose, no cache, duplicates rank call) (+6 more) ### Community 6 - "Client KBO Schedule & GameDetail" Cohesion: 0.15 Nodes (13): DayRecordCache (day_prediction_record, skip if settled), CF Endpoint: GET /kbo/gameDetail, CF Endpoint: GET /kbo/schedule, GameDetailCache (game_detail namespace), GameDetailRepository (keepAlive), GameRecordDatesCache (game_record_dates namespace), GameRepository (keepAlive), DayPredictionRecord Provider (autoDispose + SWR skip if settled) (+5 more) ### Community 7 - "Prediction Vote Flow" Cohesion: 0.22 Nodes (11): CF Endpoint: GET /prediction (by date), CF Endpoint: POST /prediction, CF Endpoint: PUT /prediction, CF Endpoint: GET /prediction/summary (10s polling), PredictionRepository (keepAlive), PredictionAction Notifier (keepAlive), voteSummary Provider (StreamProvider 10s poll), VoteRepository After C1 (RTDB onValue subscription) (+3 more) ### Community 8 - "Server Vote & RTDB Layer" Cohesion: 0.20 Nodes (10): GET /kbo/games Endpoint, GET /prediction Endpoint, GET /prediction/summary Endpoint, In-Memory MemCache (Server-side), voteRepository (Server), RTDB /votes/{gameId} Path, gameListService (Server), predictionService (Server) (+2 more) ### Community 9 - "Game Trigger & Stats Invalidation" Cohesion: 0.22 Nodes (10): gameResultService.ts:42 (stats fan-out on game complete), CF: /stats (getStats Cloud Function), invalidateStats (/cache/stats/{uid} delete), judgeDay (judgmentService.ts:94), onGameCompleted.ts:59 (Firestore trigger), Firestore/Cache: /cache/stats/{uid}, Firestore: voteHistory collection, R2: getStats Incremental Aggregation (+2 more) ### Community 10 - "Attendance & Notification" Cohesion: 0.40 Nodes (5): AttendanceRepository (keepAlive), CF Endpoint: GET /attendance/month, CF Endpoint: POST /attendance/check-in, CF Endpoint: PATCH /users/me/notifications, CheckInController Notifier (autoDispose) ### Community 11 - "Attendance Service (Server)" Cohesion: 0.50 Nodes (4): Firestore attendance Subcollection, Firestore pointLedger Subcollection, attendanceService (Server), POST /attendance/check-in Endpoint ## Knowledge Gaps - **78 isolated node(s):** `Firestore attendance Subcollection`, `Firestore pointLedger Subcollection`, `RTDB /nicknames Path`, `RTDB /userNicknames Path`, `scoreboardCacheRepository (Server)` (+73 more) These have ≤1 connection - possible missing edges or undocumented components. - **16 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes. ## Suggested Questions _Questions this graph is uniquely positioned to answer:_ - **Why does `C1: voteSummary Polling to RTDB Subscription` connect `Prediction Vote Flow` to `Server Cron & Game Sync`, `Client KBO Data (Rank/Player)`?** _High betweenness centrality (0.090) - this node is a cross-community bridge._ - **Why does `Client Improvements Summary (C1-C4 Applied)` connect `Client KBO Data (Rank/Player)` to `Client User Auth & Profile`, `Prediction Vote Flow`?** _High betweenness centrality (0.088) - this node is a cross-community bridge._ - **Why does `Cost Summary: Top Write/Read/Client Costs` connect `Server Cron & Game Sync` to `Prediction Vote Flow`?** _High betweenness centrality (0.070) - this node is a cross-community bridge._ - **What connects `Firestore attendance Subcollection`, `Firestore pointLedger Subcollection`, `RTDB /nicknames Path` to the rest of the system?** _78 weakly-connected nodes found - possible documentation gaps or missing edges._ - **Should `Read/Write Optimization Fixes` be split into smaller, more focused modules?** _Cohesion score 0.1038961038961039 - nodes in this community are weakly interconnected._ - **Should `Scoreboard & User Write Fixes` be split into smaller, more focused modules?** _Cohesion score 0.13333333333333333 - nodes in this community are weakly interconnected._ - **Should `Client User Auth & Profile` be split into smaller, more focused modules?** _Cohesion score 0.14166666666666666 - nodes in this community are weakly interconnected._