Conversation
The consumables table was defined in the Drizzle schema but had no corresponding SQL migration, causing "relation does not exist" errors on deployment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The migration file was added but not registered in the meta/_journal.json, so drizzle's migration runner was skipping it on startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 3a0910e.
The /leaderboard endpoint aggregates SUM(amount) GROUP BY owner across the entire rewards_earned table. The existing owner-only index forces a sequential scan to fetch amount from the heap (163k seq scans observed). A composite (owner, amount) index enables an index-only scan for this query, eliminating the full table scan on every leaderboard request. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The index was already applied to the live DB, causing the migration to fail on indexer restart with "relation already exists". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apibara v2 no longer auto-reconnects on error — when the DB connection drops (e.g. during a DB restart), the indexer exits cleanly with code 0. With the default ON_FAILURE policy, Railway considers this a successful completion and does not restart. Setting ALWAYS ensures the indexer auto-recovers from transient DB outages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the summit-pr-130 environment in Summit stack
🚅 Deployed to the summit-pr-130 environment in summit-custom-branch
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughIntroduces observability and performance features: in-memory API response cache with background refresh and include_total opt-out, structured logging, periodic resource metrics (API and indexer), WebSocket hub metrics, DB indexes and migrations (consumables), stress test tooling, and deployment/config scripts; plus client-side address null-safety changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant ApiResponseCache
participant Database
Client->>API: GET /beasts/all?include_total=true
API->>ApiResponseCache: getOrLoad(key, policy, loader)
alt HIT (fresh)
ApiResponseCache-->>API: {status: "HIT", value}
API-->>Client: 200 + X-Cache: HIT
else STALE
ApiResponseCache-->>API: {status: "STALE", value}
API-->>Client: 200 + X-Cache: STALE
par background refresh
ApiResponseCache->>Database: loader() (async)
Database-->>ApiResponseCache: fresh data
ApiResponseCache->>ApiResponseCache: update entry
end
else MISS
ApiResponseCache->>Database: loader()
Database-->>ApiResponseCache: data
ApiResponseCache->>ApiResponseCache: store entry
ApiResponseCache-->>API: {status: "MISS", value}
API-->>Client: 200 + X-Cache: MISS
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @loothero's task —— View job Claude Review - General Engineering Reviewrun=22829740444 attempt=1 sha=c38d4a74695c11eec5295b2ffc91f5aecd567706 scope=general Todo List
Review AnalysisI analyzed the changes to files outside the core app packages, focusing on general repository infrastructure, documentation, and tooling. Files Reviewed:
FindingsNo issues found. The changes represent solid engineering practices:
The new script follows defensive patterns:
No behavioral changes that could break CI, deployment flow, or developer tooling were detected. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 0 LOW, 0 INFO |
Codex Review - Indexer/API Review[HIGH] indexer/migrations/0004_api_perf_indexes.sql:1 - New indexes are created without [MEDIUM] api/src/ws/subscriptions.ts:306 - Asynchronous Assumption check: pending-finality safeguards are present in scoped code ( Summary: 1 CRITICAL, 1 HIGH, 1 MEDIUM, 0 LOW, 0 INFO |
…ul shutdown The signal listeners replaced Node's default termination path but never called process.exit(), causing the indexer to ignore shutdown signals on Railway. The beforeExit handler is sufficient since metric timers are unref'd and won't keep the process alive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @loothero's task —— View job Claude Review - General Engineering Reviewrun=22883142280 attempt=1 sha=0651feb379ad72fdd6c088d252eed57da013ee2a scope=general Todo List
Review AnalysisI analyzed the changes to files outside the core app packages, focusing on general repository infrastructure, documentation, and tooling. Files Reviewed:
FindingsNo issues found. The changes represent solid engineering practices:
The new script follows defensive patterns:
No behavioral changes that could break CI, deployment flow, or developer tooling were detected. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 0 LOW, 0 INFO |
Codex Review - General Engineering ReviewNo issues found. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 0 LOW, 0 INFO |
|
Claude finished @loothero's task —— View job Claude Review - React/Frontend Reviewrun=22883142280 attempt=1 sha=0651feb379ad72fdd6c088d252eed57da013ee2a scope=client Todo List
Analysis SummaryI've reviewed the client-side changes in this PR, which focus on improving null-safety for address handling across React components. The changes introduce a new shared address utility module and update existing components to handle nullable address values more safely. Changes OverviewThe PR modifies 8 client files:
Findings[LOW] client/src/components/Leaderboard.jsx:151 - Redundant key prop on inner element [LOW] client/src/utils/addressUtils.ts:18 - Potential edge case in address normalization [INFO] client/src/components/Leaderboard.jsx:88-92 - Mixed normalization approaches [INFO] client/src/components/dialogs/LeaderboardModal.tsx:68 - Inline normalization should use shared utility Positive Aspects
Architecture AssessmentThe changes follow React best practices:
SummaryThe changes successfully implement robust null-safety for address handling across the client application. The new shared utility module promotes code reuse and consistency. While there are a few minor optimization opportunities, the changes significantly improve application reliability without introducing any critical issues. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 2 LOW, 2 INFO |
Codex Review - React/Frontend ReviewNo issues found. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 0 LOW, 0 INFO |
Codex Review - Indexer/API Review[MEDIUM] api/src/ws/subscriptions.ts:306 - Async [LOW] api/src/ws/subscriptions.ts:368 - [INFO] indexer/patches/@apibara__plugin-drizzle@2.1.0-beta.55.patch:286 - Assumption to verify: Summary: 0 CRITICAL, 0 HIGH, 1 MEDIUM, 1 LOW, 1 INFO |
The invalidation and replacement run in separate transactions to prevent trigger-captured rollback entries from corrupting the reorg table. If the replacement transaction fails, readers see stale state until process restart. Document this tradeoff in all 3 patch targets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @loothero's task —— View job Claude Review - React/Frontend Reviewrun=22883614866 attempt=1 sha=ad7c9cf0ebce27203758c1cc5eaa02e0f1723fc2 scope=client Todo List
Analysis SummaryI've reviewed the client-side changes in this PR, which focus on improving null-safety for address handling across React components. The changes introduce a new shared address utility module and update existing components to handle nullable address values more safely. Changes OverviewThe PR modifies 8 client files:
Findings[LOW] client/src/components/Leaderboard.jsx:151 - Redundant key prop on inner element [LOW] client/src/utils/addressUtils.ts:18 - Potential edge case in address normalization [INFO] client/src/components/Leaderboard.jsx:88-92 - Mixed normalization approaches [INFO] client/src/components/dialogs/LeaderboardModal.tsx:68 - Inline normalization should use shared utility Positive Aspects
Architecture AssessmentThe changes follow React best practices:
SummaryThe changes successfully implement robust null-safety for address handling across the client application. The new shared utility module promotes code reuse and consistency. While there are a few minor optimization opportunities, the changes significantly improve application reliability without introducing any critical issues. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 2 LOW, 2 INFO |
Codex Review - General Engineering Review[LOW] - name: Verify metrics module sync
run: pnpm --dir indexer metrics:check-syncSummary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 1 LOW, 0 INFO |
Codex Review - React/Frontend ReviewNo issues found. |
Codex Review - Indexer/API Review[HIGH] indexer/patches/@apibara__plugin-drizzle@2.1.0-beta.55.patch:304 - Reorg rollback ( [LOW] api/src/ws/subscriptions.ts:306 - Async Summary: 0 CRITICAL, 1 HIGH, 0 MEDIUM, 1 LOW, 0 INFO |
server.close() stops accepting new requests so in-flight handlers finish before the subscription hub and pool are torn down. Prevents "Cannot use a pool after calling end" errors during deploy rollouts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @loothero's task —— View job Claude Review - Indexer/API Reviewrun=22884241205 attempt=1 sha=0d13099e0dc7c928a18dfdfa7f2a593419d483c9 scope=indexer-api Findings[CRITICAL] indexer/indexers/summit.indexer.ts:996 - Finality configuration contradicts PR description [HIGH] indexer/indexers/summit.indexer.ts:2143 - blocks_without_events metric is never populated correctly [HIGH] api/src/index.ts:559 - Player address not normalized before database query [MEDIUM] indexer/migrations/0004_api_perf_indexes.sql:1-17 - Index creation blocks production writes [MEDIUM] indexer/package.json:37-44 - Drizzle/pg version bumps without compatibility verification [LOW] indexer/patches/@apibara__plugin-drizzle@2.1.0-beta.55.patch:72 - reorgTriggersRegistered flag never resets [INFO] api/src/index.ts:282 - Non-deterministic pagination in /beasts/all Key Architecture AnalysisThe Apibara v2 migration patch appears well-architected:
Database schema changes are performance-focused:
API caching layer is strategically implemented:
However, the critical finality mismatch undermines the core migration goal and should be addressed immediately. Summary: 1 CRITICAL, 2 HIGH, 2 MEDIUM, 1 LOW, 1 INFO |
|
Claude finished @loothero's task —— View job Claude Review - React/Frontend Reviewrun=22884241205 attempt=1 sha=0d13099e0dc7c928a18dfdfa7f2a593419d483c9 scope=client Todo List
Analysis SummaryI've reviewed the client-side changes in this PR, which focus on improving null-safety for address handling across React components. The changes introduce a new shared address utility module and update existing components to handle nullable address values more safely. Changes OverviewThe PR modifies 8 client files:
Findings[LOW] client/src/components/Leaderboard.jsx:151 - Redundant key prop on inner element [LOW] client/src/utils/addressUtils.ts:18 - Potential edge case in address normalization [INFO] client/src/components/Leaderboard.jsx:88-92 - Mixed normalization approaches [INFO] client/src/components/dialogs/LeaderboardModal.tsx:68 - Inline normalization should use shared utility Positive Aspects
Architecture AssessmentThe changes follow React best practices:
SummaryThe changes successfully implement robust null-safety for address handling across the client application. The new shared utility module promotes code reuse and consistency. While there are a few minor optimization opportunities, the changes significantly improve application reliability without introducing any critical issues. Summary: 0 CRITICAL, 0 HIGH, 0 MEDIUM, 2 LOW, 2 INFO |
Codex Review - General Engineering ReviewNo issues found. |
Codex Review - React/Frontend ReviewNo issues found. |
Codex Review - Indexer/API Review[HIGH] /home/runner/work/summit/summit/indexer/patches/@apibara__plugin-drizzle@2.1.0-beta.55.patch:304 - Reorg [MEDIUM] /home/runner/work/summit/summit/api/src/index.ts:251 - [LOW] /home/runner/work/summit/summit/api/src/ws/subscriptions.ts:306 - WS send error sampling/logging is only applied in the synchronous throw path; callback-error path increments counters but emits no sampled log. [INFO] /home/runner/work/summit/summit/indexer/patches/@apibara__plugin-drizzle@2.1.0-beta.55.patch:271 - Critical reorg behavior is patched in vendored dependency code without a deterministic regression test in Summary: 0 CRITICAL, 1 HIGH, 1 MEDIUM, 1 LOW, 1 INFO |
Summary
Migrates the indexer from Apibara v1 to v2 and ships a comprehensive production hardening pass across the indexer, API, and client layers. Finality remains pending (lower latency for game UX).
Apibara v2 Migration (indexer)
@apibara/plugin-drizzlereorg trigger to eliminate excessive trigger churn on every blockinvalidatefrom block reorg order-key transaction to prevent cascade failuresdrizzle-ormto 0.45.1 andpg/@types/pgto latestpnpm patchesdirectory in Docker build so the drizzle patch applies in productionDatabase Migrations & Performance Indexes
consumablestable migration and register it in the Drizzle journalrewards_earned(owner, amount)for index-only leaderboard scans (eliminates 163k seq scans)0004_api_perf_indexes.sql)IF NOT EXISTSon leaderboard index to prevent restart failures on already-applied migrationsAPI Performance & Reliability
/beasts/:ownerfrom cache (derivescurrent_healthfromDate.now()for revival windows)api/src/index.tsfor maintainabilityObservability
indexer/src/lib/metrics.ts) and API (api/src/lib/metrics.ts)WS_SEND_ERROR_SAMPLE_EVERY=1logs every errorscripts/check-metrics-sync.mjsto validate metrics parity across layersindexer/scripts/railway-metrics-summary.mjs)api/scripts/stress-test.ts) with benchmarking guidance docsInfrastructure & Deployment
ALWAYS— Apibara v2 exits cleanly (code 0) on transient DB outages, soON_FAILUREwas preventing auto-recoveryrailway.jsonconfigurationClient Fixes
summit-api-production-ca43Changed Components
Test Plan
pnpm test:parityin bothclient/andindexer/api/scripts/stress-test.ts) to validate cache and query perfnode scripts/check-metrics-sync.mjsto validate metrics alignment🤖 Generated with Claude Code