Repository navigation
feat(fantasyxi): Add captain injury alerts, live provisional leaderboard, Soroban RPC event daemon, and granular error boundaries (#238, #268, #403, #404) - #409
Merged
Stanley471 merged 4 commits intoOct 24, 2026
Conversation
… soroban RPC event daemon, and granular error boundaries (closes Stanley471#238, Stanley471#268, Stanley471#403, Stanley471#404)
|
@Phenoll is attempting to deploy a commit to the stanleyobimma4gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
…fix ledgerAdapter import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary of Changes
Implemented a comprehensive batch resolution addressing four assigned issues across the backend FPL/Live/Soroban engines and frontend React error boundary architecture:
Solved Issues & Features:
FplSyncService(backend/src/services/fpl/fplSyncService.ts) to snapshot existing player statuses prior to bootstrap sync, detect transitions to injured ('i'), doubtful ('d'), or suspended ('s') prior to the upcoming gameweek deadline, query all active squads where the player is designated withisCaptain: true, emitCAPTAIN_INJURY_ALERTdomain events, and enqueueCaptainInjuryAlertEmailnotifications.CaptainInjuryAlertEmailtemplate builder and gameweek/status rate-limiting (via Redis + in-memory idempotency cache) inbackend/src/services/email/emailService.ts, plus domain event registration inbackend/src/services/events/domainEvents.ts.LiveProvisionalLeaderboardService(backend/src/services/live/liveProvisionalLeaderboardService.ts) using Redis Sorted Sets (ZSET), atomicZINCRBYpipelines, and an in-memory invertedplayerId -> squadsindex for sub-second rank updates across 1,000+ leagues with zero database read queries during live match event streaming.totalPoints DESC,livePoints DESC,joinedAt ASC,squadId ASC), SSE/WebSocket rank and point delta diff broadcasting, and end-of-gameweek database reconciliation (reconcileWithDatabase).liveService.ts,leaderboardService.ts,live.controller.ts, andlive.routes.ts(including SSE streaming endpoint/api/v1/live/gameweek/:gw/leaderboard/:leagueId/stream).decodeSorobanEscrowEventandDepositQueue(backend/src/queues/depositQueue.ts) supporting both nativexdr.ScValand raw base64-encoded Soroban XDR event topics/payloads (deposit,claimed,m_claimed,refund,DepositRefunded,EmergencyRefund,LeagueRefundClaimed,settle,m_settle,created) with Redis + in-memory idempotency deduplication.SorobanEventIndexer(backend/src/workers/eventIndexer.ts),sorobanContractClient.ts, andstellarService.tsto persist pagination cursors (ledger+pagingToken) across restarts in both Redis and PostgreSQL (IndexerCursor), gracefully back off on RPC timeouts without skipping blocks, and dispatch confirmed events throughdepositQueue.ErrorBoundary(frontend/src/components/ErrorBoundary.tsx) with contextualname,fallbackTitle,fallbackMessage,compactinline mode,onReset,onError, andresetKeysauto-recovery props, forwarding caught errors and ReactcomponentStacktraces to client telemetry (trackError/useErrorReporterinfrontend/src/lib/telemetry.ts).frontend/src/app/team/page.tsx(PitchView,GameweekCountdown, player selection sidebar),frontend/src/app/leaderboard/page.tsx(LeaderboardTable),frontend/src/app/fixtures/page.tsx(FixturesList),frontend/src/app/leagues/[id]/page.tsx(LeagueStandingsTable,LeagueChat), andfrontend/src/components/layout/AppShell.tsx.📂 Key Files Modified / Added
backend/src/services/fpl/fplSyncService.ts: Pre-sync player status snapshot, captain injury/suspension/doubtful transition detection, and affected captain squad lookup.backend/src/services/email/emailService.ts:CaptainInjuryAlertEmailHTML/text template generator and per-gameweek duplicate rate-limiter.backend/src/services/events/domainEvents.ts: AddedCAPTAIN_INJURY_ALERTdomain event payload and listener binding.backend/src/services/live/liveProvisionalLeaderboardService.ts: High-throughput RedisZSET+ inverted index live provisional leaderboard engine, SSE/WS diff broadcaster, and gameweek close DB reconciliation.backend/src/services/live/liveService.ts,backend/src/services/leaderboard/leaderboardService.ts,backend/src/controllers/live.controller.ts,backend/src/routes/live.routes.ts: Live event stream ingestion, SSE diff streaming route, and provisional leaderboard integration.backend/src/queues/depositQueue.ts: Soroban XDR contract event decoder and idempotentDepositQueue.backend/src/workers/eventIndexer.ts,backend/src/services/financial/sorobanContractClient.ts,backend/src/services/financial/stellarService.ts,backend/prisma/schema.prisma: Dual Redis/PostgreSQL cursor persistence, XDR event decoding, anddepositQueueintegration.frontend/src/components/ErrorBoundary.tsx&frontend/src/lib/telemetry.ts: Granular ReactErrorBoundarywith contextual retry/reset states and telemetrycomponentStackreporting.frontend/src/app/team/page.tsx,frontend/src/app/leaderboard/page.tsx,frontend/src/app/fixtures/page.tsx,frontend/src/app/leagues/[id]/page.tsx,frontend/src/components/layout/AppShell.tsx: Strategic error boundary placements around isolated widgets.backend/src/tests/emailService.test.ts,backend/src/tests/liveProvisionalLeaderboard.test.ts,backend/src/tests/eventIndexer.test.ts,frontend/src/tests/errorBoundary.test.tsx,frontend/src/tests/telemetry.test.ts: Comprehensive unit and stress tests for all four issues.✅ Verification & Testing
tsx --testacrossemailService.test.ts,liveProvisionalLeaderboard.test.ts,eventIndexer.test.ts,leaderboard.test.ts,liveTimelineService.test.ts— 48/48 passing, including 1,000-league / 1,000-event stress test under 50ms with 0 DB reads).tsx --testacrosserrorBoundary.test.tsxandtelemetry.test.ts— 23/23 passing).🔗 References
closes #238
closes #268
closes #403
closes #404
closes #238, #268, #403, #404