Skip to content

Fixes - #17

Merged
Yuvraj-Sarathe merged 60 commits into
mainfrom
Fixes
Jul 2, 2026
Merged

Fixes#17
Yuvraj-Sarathe merged 60 commits into
mainfrom
Fixes

Conversation

@Yuvraj-Sarathe

Copy link
Copy Markdown
Member

Fixed bad login algo

- Create root .prettierrc with semi, singleQuote, trailingComma, printWidth, tabWidth
- Add format and format:check tasks to turbo.json
- Add format and format:check scripts to root package.json
- Install prettier and prettier-plugin-tailwindcss as devDependencies
- apps/api/Dockerfile: Node.js 20 Alpine with pnpm frozen-lockfile install, build, and runner stages
- apps/ai-service/Dockerfile: Python 3.12 slim with pip install and uvicorn runner
…ervices

- Add api service (port 3001) with build context, depends_on postgres+redis
- Add ai-service (port 8000) with OPENROUTER_API_KEY
- Add judge0-db, judge0-redis, judge0-server, judge0-worker services
- Change API default port from 4000 to 3001
- Update web trpc client default URL to port 3001
- Configure Next.js framework with turbo build --filter=web
- Set install command to run pnpm install from monorepo root
- Create apps/api/prisma/seed.ts with 3 tracks, 5 modules, and demo user
- Add prisma seed field to apps/api/package.json using tsx
- Replace basic trpc fetch with createTRPCReact client
- Add TRPCProvider wrapping QueryClientProvider with httpBatchLink
- Add placeholder hooks (useDashboardData, useTracksData, etc.) for Phase 3
- Wrap root layout in TRPCProvider via modified providers.tsx
- Install @trpc/react-query@^10.45.2 and @trpc/client@^10.45.2 in web workspace
- Run pnpm format to fix formatting in all 94 files with style issues
- Enforce consistent semi, singleQuote, trailingComma, printWidth, tabWidth
- Add @unvibe/api tsconfig path alias in web pointing to API source
- Import actual AppRouter type from API for full type safety
- Downgrade @tanstack/react-query to v4 to match @trpc/react-query@10 peer dep
- Add @trpc/server as web dependency for type resolution
- Suppress unused-var lint for placeholder params in hooks.ts
- Document all 6 sub-items delivered
- Record deviations (4 auto-fixes)
- List verification results and file manifest
- signIn: public query, finds user by email
- signUp: public mutation, creates new user
- getSession: protected query, returns session user
- signOut: protected mutation, deletes session
- getAll: public query, lists published tracks with module counts
- getById: public query, gets track with ordered modules
- getProgress: protected query, returns per-track progress for user
…rd, joinRoom

- getRoom: public query, returns latest war room
- getMessages: public query, placeholder for socket-based messaging
- getLeaderboard: public query, top 20 IRS scores
- joinRoom: protected mutation, validates room exists
- Import all 3 routers from ./routers/*
- Merge them into appRouter under namespaced keys
- Add sessionToken: string to Session interface
- Return sessionToken from resolveSession for downstream use
- Records 5 commits for auth, tracks, warRoom routers
- Documents decisions, deviations, and verification results
…mitDecode, getProgress

- getById: public query to fetch a single module by ID
- getByTrack: public query to list modules for a track ordered by position
- submitDecode: protected mutation to create a code submission and enqueue to BullMQ
- getProgress: protected query to check user's latest submission status for a module
…ots, getLeaderboard

- getScore: protected query returning the user's latest IRS score
- getHistory: protected query returning last 20 scores for the user
- getBlindspots: protected query analysing scored submissions to identify low-score modules
- getLeaderboard: public query returning top 50 scores with user info
- Create mutation with module validation, BullMQ enqueue, and null-safe submissionQueue guard
- getHistory query with optional moduleId filter and limit
- getById query with ownership check and parsedFeedback helper
- Follows ctx.session.user.id pattern from existing routers
- Import submissionsRouter from ./routers/submissions
- Add to appRouter object under key 'submissions'
- getProfile: user info + IRS score + submission/defend counts
- getRecent: last N submissions with module title + score
- getStats: aggregated stats with average score and streak
- extractScore helper for JSON feedback parsing
- Uses ctx.session.user.id pattern matching existing routers
- Import profileRouter from ./routers/profile
- Add profile: profileRouter to appRouter definition
- Changed getAll include from _count.modules to modules (select: id, title, order)
- Added moduleCount field for convenience
- This gives the tracks list page the module data it needs to render links
- Replaced useTracksQuery from mock-data/hooks with trpc.tracks.getAll.useQuery()
- Removed difficulty badge (not in Prisma schema, was mock-only)
- Removed progress section (requires auth, not available from public getAll)
- Added moduleCount display showing number of modules per track
- Updated description text
- Replace useDashboardQuery with trpc.profile.getProfile,
  trpc.tracks.getAll, trpc.warRoom.getLeaderboard, trpc.profile.getStats
- Compute rank from leaderboard position
- Provide empty array fallback for radar data (not in API yet)
- Map leaderboard API shape to component props
- Replace useModuleQuery with trpc.tracks.getById and trpc.modules.getById
- Adapt Prisma Module shape to ModulePlayer's expected MockModule shape
- Provide empty arrays for annotations, quiz, and diffLines (not in API)
- Remove Badge imports (concepts not available from API)
- Replace useWarRoomQuery with trpc.warRoom.getRoom and trpc.warRoom.getLeaderboard
- Simplify members badge since API room lacks members count
- Map leaderboard API shape to component props
- Messages handled via Socket.io; pass empty array as initial
- Replace useBlindspotsQuery with trpc.irs.getBlindspots
- Adapt API response (moduleTitle, attemptCount, severity) to UI expectations
- Generate evidence and next action text dynamically from available data
…try-sdk to ai-service requirements

- Add SENTRY_DSN_AI, NEXT_PUBLIC_SENTRY_DSN, NEXT_PUBLIC_API_URL to .env.example
- Update existing Sentry DSN examples to consistent format
- Add sentry-sdk>=2.0.0 to ai-service/requirements.txt
…ll app pages

- Create reusable ErrorFallback component in components/app/
- Add error.tsx boundaries for dashboard, tracks, track modules, war-room,
  blindspot-map, profile, and auth signin pages
- Each error boundary re-exports ErrorFallback for Next.js App Router
- Show empty state card when tracks list is empty
- Show empty state card when no blindspots identified yet
- Both preserve existing PageHeader for consistent UX
…via tRPC fetch

- Replace hardcoded MockUser with real User type (id, name, email, image)
- Add signIn(email) -> calls tRPC auth.signIn query, stores result in localStorage
- Add signUp(name, email) -> calls tRPC auth.signUp mutation, stores result
- Add signOut() -> calls tRPC auth.signOut, clears localStorage
- Add checkSession() -> re-fetches session from API
- Add restoreSession() -> reads session from localStorage on mount
- Set isLoading: true initially for loading state handling
…ration on mount

- Restores user session from localStorage on initial page load
- Wraps provider tree inside TRPCProvider for store availability
- New protectedProcedure.mutation that aggregates all scored submissions
- Calculates average overallScore from parsed feedback JSON
- Creates a new IRSScore record with details (scoredCount, lastCalculated)
- Mirrors triggerIRSRecalculation logic from submission-worker.ts
- Judge0Error class with optional statusCode for upstream error propagation
- executeCode() function with synchronous wait=true mode
- LANGUAGE_IDS map for 7 languages (python, javascript, typescript, cpp, java, go, rust)
- Configurable JUDGE0_URL via env var (defaults to localhost:2358)
- protectedProcedure.mutation accepting code, language (enum), and optional stdin
- Input validated via zod: code min 1 char, language must be one of 7 supported
- Maps language string to Judge0 numeric language ID
- Returns stdout, stderr, compileOutput, time, memory, and status description
- Translates Judge0Error to TRPCError for uniform error handling
- Import judge0Router from ./routers/judge0
- Add judge0: judge0Router to the tRPC appRouter
- Creates new migration 20260702113513_add_password_hash
- Adds nullable passwordHash TEXT column to User table
- Migration applied and Prisma client regenerated
- If passwordHash is null (OAuth-only user), signIn now throws
  UNAUTHORIZED instead of silently creating a session
- Previously anyone who knew an OAuth user's email could sign in
  as them without a password
Root cause: useState was imported but never used — the component uses Zustand (useEditorStore) and tRPC mutation state instead of local React state.
- Create .env.example documenting all required NextAuth environment variables
- Includes AUTH_SECRET/AUTH_URL, NEXTAUTH_SECRET/NEXTAUTH_URL
- Includes GITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET
- Includes GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET
- .env.local (with actual secret) exists on disk but is gitignored for security
@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@Yuvraj-Sarathe
Yuvraj-Sarathe merged commit 976e1fe into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant