## Summary - **Fix CI build failure**: Auth0Client crashes during Next.js prerendering when env vars aren't set. Returns a no-op stub (`getSession → null`) when domain is missing — semantically correct for static generation - **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and react-syntax-highlighter were eagerly imported in monaco-diff-viewer but only rendered when user expands "Generated Tests". Extracted into a dynamic component - **Parallelize repo detail query**: `getRepositoryById` ran the activity count sequentially after the repo lookup. Since `repoId` is already available, all three queries now run in parallel ## Test plan - [ ] CI `build` check passes (was failing since #2598) - [ ] Trace page still renders generated tests correctly when expanded - [ ] Repository detail page loads correctly with activity status
6.1 KiB
6.1 KiB
| 1 | commit | target | description | status | domains | interaction |
|---|---|---|---|---|---|---|
| 2 | 13b302a8 | members/action.ts | findFirst->findUnique on composite index, parallel permission checks instead of loading all members (5 functions) | keep | query,structure | index-seek replaces table-scan |
| 3 | 13b302a8 | repositories/action.ts | findFirst->findUnique, parallel permission checks, select narrowing (5 functions) | keep | query,structure | index-seek replaces table-scan |
| 4 | 13b302a8 | members/data.ts | findFirst->findUnique for org lookup | keep | query | single-row PK seek |
| 5 | 13b302a8 | privacy-actions.ts | findFirst->findUnique with composite key + select | keep | query | index-seek replaces scan |
| 6 | 13b302a8 | review-optimizations/action.ts | Set-based lookup replacing Array.some | keep | cpu | O(1) vs O(n) per item |
| 7 | 13b302a8 | get-recent-traces.ts | Map-based lookup replacing Array.find in loop | keep | cpu | O(1) vs O(n) per item |
| 8 | 13b302a8 | llm-calls/page.tsx | Combined 2 sequential Promise.all into 1 parallel batch | keep | async | reduced sequential waterfall |
| 9 | 13b302a8 | traces/page.tsx | Parallelized 2 independent sequential queries | keep | async | reduced sequential waterfall |
| 10 | a14cd8e7 | data.ts+repo-detail-client.tsx | Consolidated 2 separate count queries into single combined query | keep | query | 2 roundtrips to 1 |
| 11 | 16fc8856 | review-optimizations/action.ts | Narrowed repository include from all columns to 3 needed fields | keep | query | reduced data transfer |
| 12 | 22ef695c | [traceId]/action.ts | Narrowed repository include to id,full_name,name,installation_id | keep | query | reduced data transfer |
| 13 | 7fcbd321 | llm-calls/page.tsx | Hoisted cached filter queries into main Promise.all | keep | async | eliminated waterfall stage |
| 14 | 972846ab | members/data.ts | Eliminated redundant findUnique for current user role | keep | query | 1 roundtrip eliminated |
| 15 | f8686933 | [traceId]/action.ts | Added select:{metadata:true} to saveOptimizationChanges findUnique | keep | query | reduced data transfer |
| 16 | cb384315 | auth0.ts | Parallelized trackUserLogin and hasCompletedOnboarding in login callback | keep | async | reduced login latency |
| 17 | bc715120 | dashboard/action.ts | Rewrite statistics CTE to use UNION instead of 3-way OR for personal accounts | keep | query | 3 index-backed scans replace bitmap OR merge |
| 18 | 2444d1b4 | dashboard/action.ts | Rewrite PR data query to use UNION CTE for personal accounts | keep | query | 3 index-backed scans replace bitmap OR merge |
| 19 | 6f9e81a6 | cached-dashboard-data.ts | Select only id,name from organizations (skips description, website, github_org_id, etc.) | keep | query | reduced data transfer |
| 20 | 6f9e81a6 | dashboard/action.ts | Select only id,name from organizations in getUserOrganizations | keep | query | reduced data transfer |
| 21 | 6f9e81a6 | members/action.ts | Select only id+members from organizations in getOrganizationMembers | keep | query | reduced data transfer |
| 22 | 6f9e81a6 | members/data.ts | Select only id+members from organizations in getMembersPageInitData | keep | query | reduced data transfer |
| 23 | 6f9e81a6 | llm-call/[id]/page.tsx | Select 6 fields from optimization_errors (skips stack_trace Text column) | keep | query | reduced data transfer |
| 24 | 6f9e81a6 | get-trace-data.ts | Select only 6 consumed fields from optimization_errors (was 4, fixed to 6) | keep | query | reduced data transfer |
| 25 | 7221d448 | get-trace-data.ts | Select 12 fields from optimization_features instead of all 30+ columns | keep | query | reduced data transfer - skips large JSON/Text columns |
| 26 | 1ef61d1e | llm-call/[id]/page.tsx | Select 22 fields from llm_calls instead of all 30 (skips messages, parsed_response, context JSON blobs) | keep | query | reduced data transfer - large JSON excluded |
| 27 | bcaf08b5 | traces/page.tsx | Store timestamps as numbers during aggregation, convert to Date once per trace at end | keep | cpu,memory | avoids 2 Date objects per call per existing trace |
| 28 | d6cab273 | llm-calls/loading.tsx + llm-call/[id]/loading.tsx | Add streaming loading skeletons for observability pages without internal Suspense | keep | async | instant shell streaming while server component data fetches resolve |
| 29 | ee535ae9 | dashboard/action.ts | Restructure getOptimizationPRs: LIMIT before JOIN to optimization_features/repositories | keep | query | JOINs only for ~10 result rows instead of all candidates |
| 30 | ab15d0b5 | review-optimizations/action.ts | Wrap getRepositoriesWithStagingEvents + getAllOptimizationEvents with React cache() for request-level deduplication | keep | async,query | eliminates 7-8x duplicate calls per request (9.1s + 15.4s → 3.5s expected) |
| 31 | 1a57228c | review-optimizations/action.ts | Rewrite getRepositoriesWithStagingEvents and getAllOptimizationEvents to use UNION queries for personal accounts | keep | query | 3 index-backed scans replace bitmap OR merge (1633ms+1939ms → expected <1200ms total) |
| 32 | PENDING | traces/page.tsx | Rewrite getDistinctTraces as raw SQL CTE to use [trace_id, created_at DESC] index for GROUP BY | keep | query | leverages composite index for MAX aggregation (expected 616ms → <200ms) |
| 33 | PENDING | traces/page.tsx | Rewrite getUniqueOrganizations as raw SQL to use partial index on (organization WHERE NOT NULL) | keep | query | partial index scan replaces full table scan (expected 727-980ms → <100ms) |
| 34 | PENDING | common/prisma/migrations | Add partial index on optimization_features(organization) WHERE organization IS NOT NULL | keep | query | covers DISTINCT organization query with smaller index |
| 35 | PENDING | review-optimizations/action.ts | Fix groupBy type annotation for organization account path | keep | structure | resolve TS2345 type error |
| 36 | PENDING | dashboard/action.ts | Replace EXISTS subqueries with LEFT JOIN in getOptimizationPRs count query (org + personal) | keep | query | avoids row-by-row EXISTS evaluation (expected 921ms → <300ms) |
| 37 | PENDING | dashboard/action.ts | Replace EXISTS subqueries with LEFT JOIN in getOptimizationPRs data query (org + personal) | keep | query | avoids row-by-row EXISTS evaluation (expected 1435ms → <500ms) |
| 38 | PENDING | apikeys/page.tsx | Rewrite getCachedApiKeys as UNION query to avoid OR with nested EXISTS | keep | query | 2 index-backed scans replace bitmap OR merge (expected 787ms → <250ms) |
| 39 | PENDING | common/user-functions.ts | Add getUserDashboardData to consolidate 4 separate user queries | keep | query | 4 roundtrips → 2 (onboarding, privacy, isPaid, subscription) |
| 40 | PENDING | cached-dashboard-data.ts | Use getUserDashboardData to eliminate separate user/subscription queries | keep | query | reduces cold-load query count from 5 → 2 |