Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7921bd4
chore(foundation): add prettier config with tailwind plugin
Yuvraj-Sarathe Jul 1, 2026
74a7727
chore(foundation): add multi-stage Dockerfiles for api and ai-service
Yuvraj-Sarathe Jul 1, 2026
aecfb51
chore(foundation): update docker-compose with api/ai-service/judge0 s…
Yuvraj-Sarathe Jul 1, 2026
794472f
chore(foundation): add vercel.json for web deployment
Yuvraj-Sarathe Jul 1, 2026
25ca7b7
chore(foundation): add prisma seed data and seed config
Yuvraj-Sarathe Jul 1, 2026
ff5de77
chore(foundation): add tRPC client, provider, and placeholder hooks
Yuvraj-Sarathe Jul 1, 2026
c3dcb3a
style(foundation): apply prettier formatting across entire codebase
Yuvraj-Sarathe Jul 1, 2026
d181ae4
fix(foundation): resolve tRPC TypeScript integration
Yuvraj-Sarathe Jul 1, 2026
5e9289d
chore(foundation): add tsbuildinfo to gitignore
Yuvraj-Sarathe Jul 1, 2026
c6e9853
docs(foundation): add Phase 1 execution summary
Yuvraj-Sarathe Jul 1, 2026
0e5ad3b
feat(api): add auth router with signIn, signUp, getSession, signOut
Yuvraj-Sarathe Jul 1, 2026
a7eabf5
feat(api): add tracks router with getAll, getById, getProgress
Yuvraj-Sarathe Jul 1, 2026
e13b7aa
feat(api): add warRoom router with getRoom, getMessages, getLeaderboa…
Yuvraj-Sarathe Jul 1, 2026
160e996
feat(api): register auth, tracks, and warRoom routers in appRouter
Yuvraj-Sarathe Jul 1, 2026
afb0924
feat(api): add sessionToken to Session type for signOut support
Yuvraj-Sarathe Jul 1, 2026
4b942e8
docs(api): add Phase 2 Wave 1 execution summary
Yuvraj-Sarathe Jul 1, 2026
a7ff66b
feat(wave2-modules): add modules router with getById, getByTrack, sub…
Yuvraj-Sarathe Jul 1, 2026
3a92d25
feat(wave2-irs): add IRS router with getScore, getHistory, getBlindsp…
Yuvraj-Sarathe Jul 1, 2026
a50adfc
feat(wave2-register): register modules and irs routers in appRouter
Yuvraj-Sarathe Jul 1, 2026
caf3fe7
feat(2-submissions): create submissions tRPC router
Yuvraj-Sarathe Jul 1, 2026
0800b81
feat(2-submissions): register submissionsRouter in appRouter
Yuvraj-Sarathe Jul 1, 2026
5ed3f6a
docs(2-submissions): add SUMMARY.md for submissions router
Yuvraj-Sarathe Jul 1, 2026
d192787
feat(2-war): add profile router
Yuvraj-Sarathe Jul 1, 2026
5c93c66
feat(2-war): register profile router in appRouter
Yuvraj-Sarathe Jul 1, 2026
1f02d53
feat(3-wave1): include modules in tracks.getAll for list page rendering
Yuvraj-Sarathe Jul 1, 2026
ad1467f
feat(3-wave1): swap tracks list page to real tRPC getAll query
Yuvraj-Sarathe Jul 1, 2026
b65d51e
feat(web): swap dashboard page to tRPC queries
Yuvraj-Sarathe Jul 2, 2026
9177829
feat(web): swap module page to tRPC queries
Yuvraj-Sarathe Jul 2, 2026
de5bfa0
feat(web): swap war room page to tRPC queries
Yuvraj-Sarathe Jul 2, 2026
a4b19ea
feat(web): swap blindspot map page to tRPC query
Yuvraj-Sarathe Jul 2, 2026
7db864b
feat(web): swap profile page to tRPC queries
Yuvraj-Sarathe Jul 2, 2026
59ee363
feat(web): swap sign-in page to tRPC auth procedure
Yuvraj-Sarathe Jul 2, 2026
2eba0c7
feat(web): Phase 3 — delete mock-data, move types to @unvibe/types, a…
Yuvraj-Sarathe Jul 2, 2026
60112fe
chore(config): add Sentry DSN entries for AI service and web, add sen…
Yuvraj-Sarathe Jul 2, 2026
1a5dfd2
feat(web): add ErrorFallback component and error boundary files for a…
Yuvraj-Sarathe Jul 2, 2026
3c09120
feat(web): add empty state handling for tracks and blindspot-map pages
Yuvraj-Sarathe Jul 2, 2026
bfe8ae1
docs(04-wave1): add SUMMARY.md for Phase 4 Wave 1 — production hardening
Yuvraj-Sarathe Jul 2, 2026
1dbacb0
feat(04-wave2): replace mock auth store with real session management …
Yuvraj-Sarathe Jul 2, 2026
926f3eb
feat(04-wave2): add SessionRestorer to providers for auth session hyd…
Yuvraj-Sarathe Jul 2, 2026
00fdf68
feat(04-wave2): update sign-in, sign-up, app-shell to use real auth s…
Yuvraj-Sarathe Jul 2, 2026
526c460
feat(api-irs): add recalculate mutation for on-demand IRS scoring
Yuvraj-Sarathe Jul 2, 2026
2672fd0
feat(api-judge0): create typed Judge0 code execution client
Yuvraj-Sarathe Jul 2, 2026
50cf803
feat(api-judge0): add judge0 tRPC router with execute mutation
Yuvraj-Sarathe Jul 2, 2026
daf1b37
feat(api-index): register judge0 router in appRouter
Yuvraj-Sarathe Jul 2, 2026
d28bd8f
style: apply prettier formatting across all files
Yuvraj-Sarathe Jul 2, 2026
1bd5dbe
review fixes
Yuvraj-Sarathe Jul 2, 2026
460e008
fix(auth-store): update signIn/signUp to accept password and use corr…
Yuvraj-Sarathe Jul 2, 2026
d6c5a01
fix(signin): wire OAuth via next-auth, add password field and email v…
Yuvraj-Sarathe Jul 2, 2026
a7914da
fix(signup): wire OAuth via next-auth, add password field and validation
Yuvraj-Sarathe Jul 2, 2026
3b95d35
fix(schema): add passwordHash field to User model
Yuvraj-Sarathe Jul 2, 2026
934bbe8
fix(auth): add bcrypt password verification for signIn and password h…
Yuvraj-Sarathe Jul 2, 2026
c4011a2
chore(deps): add bcryptjs and @types/bcryptjs for password hashing
Yuvraj-Sarathe Jul 2, 2026
015ca48
fix(schema): add Prisma migration for passwordHash field on User
Yuvraj-Sarathe Jul 2, 2026
d379d5a
fix(auth): reject OAuth-only users from email/password sign-in
Yuvraj-Sarathe Jul 2, 2026
7918d2d
fix: remove unused useState import from code-submission component
Yuvraj-Sarathe Jul 2, 2026
f0dad65
docs: resolve debug unused useState import
Yuvraj-Sarathe Jul 2, 2026
8761435
docs: update debug knowledge base with unused-usestate-import
Yuvraj-Sarathe Jul 2, 2026
17328f9
fix(env): add apps/web/.env.example with NextAuth env vars
Yuvraj-Sarathe Jul 2, 2026
54dd3e4
Revert "fix(env): add apps/web/.env.example with NextAuth env vars"
Yuvraj-Sarathe Jul 2, 2026
1789a72
login changes
Yuvraj-Sarathe Jul 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ R2_BUCKET_NAME="unvibe-assets"
RESEND_API_KEY="re_..."

# Sentry application monitoring DSNs
SENTRY_DSN_WEB="https://example_public_key@o0.ingest.sentry.io/0"
SENTRY_DSN_API="https://example_public_key@o0.ingest.sentry.io/0"
SENTRY_DSN_API="https://examplePublicKey@o0.ingest.sentry.io/0"
SENTRY_DSN_AI="https://examplePublicKey@o0.ingest.sentry.io/0"
NEXT_PUBLIC_SENTRY_DSN="https://examplePublicKey@o0.ingest.sentry.io/0"

# API URL for web
NEXT_PUBLIC_API_URL="http://localhost:3000"

# Posthog analytics public key
NEXT_PUBLIC_POSTHOG_KEY="phc_..."
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# TypeScript incremental build info
*.tsbuildinfo

# Sentry
.sentry-clirc
14 changes: 14 additions & 0 deletions .planning/debug/knowledge-base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# GSD Debug Knowledge Base

Resolved debug sessions. Used by `gsd-debugger` to surface known-pattern hypotheses at the start of new investigations.

---

## unused-usestate-import — unused useState import in code-submission component
- **Date:** 2026-07-02
- **Error patterns:** useState, defined but never used, @typescript-eslint/no-unused-vars, code-submission
- **Root cause:** useState was imported but never used — the component uses Zustand (useEditorStore) and tRPC mutation state instead of local React state.
- **Fix:** Removed useState from the React import statement.
- **Files changed:** apps/web/src/components/features/code-submission.tsx
---

62 changes: 62 additions & 0 deletions .planning/debug/redis-econnrefused.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
status: diagnosing
trigger: "Debug a `npm run dev` error - Redis ECONNREFUSED when Docker containers not running"
created: 2026-06-30T00:00:00.000Z
updated: 2026-06-30T00:00:00.000Z
---

## Current Focus

root_cause: "BullMQ Queue and Worker are instantiated synchronously at module-level in index.ts (lines 43-47) without error handling. Both constructors immediately attempt to connect to Redis. When Docker is not running, Redis is unavailable, and BullMQ's built-in reconnection logic repeatedly retries the connection, spamming ECONNREFUSED errors."
next_action: "Return structured diagnosis with root cause and recommended fix"

## Symptoms

expected: "npm run dev starts api and web without errors"
actual: "api:dev throws AggregateError [ECONNREFUSED]: connect ECONNREFUSED 127.0.0.1:6379 repeatedly"
errors: "AggregateError [ECONNREFUSED]: connect ECONNREFUSED 127.0.0.1:6379"
reproduction: "Run npm run dev while Docker Desktop is not running"
started: "Always broken when Docker containers are not running"

## Eliminated

## Evidence

- timestamp: 2026-06-30T00:00:00.000Z
checked: apps/api/src/index.ts lines 37-47
found: BullMQ Queue('submissions') and createSubmissionWorker() are instantiated synchronously at module level, before Express server starts. connectionOpts derived from REDIS_URL env var.
implication: Redis connection is attempted immediately on module load, not lazily

- timestamp: 2026-06-30T00:00:00.000Z
checked: apps/api/src/services/submission-worker.ts lines 42-113
found: createSubmissionWorker constructs a new Worker('submissions', processor, { connection }) — Worker constructor attempts Redis connection immediately
implication: Both Queue and Worker try to connect to Redis at module load time, causing duplicate ECONNREFUSED errors

- timestamp: 2026-06-30T00:00:00.000Z
checked: infra/docker-compose.yml
found: redis:7-alpine service defined on port 6379, with healthcheck
implication: Redis is meant to be provided via Docker

- timestamp: 2026-06-30T00:00:00.000Z
checked: Docker Desktop service status
found: com.docker.service is Stopped; docker ps fails with pipe error; docker compose binary exists (v5.1.4) but daemon not running
implication: Docker containers cannot be started until Docker Desktop is running

- timestamp: 2026-06-30T00:00:00.000Z
checked: apps/api/src/index.ts lines 37-47
found: BullMQ Queue('submissions') and createSubmissionWorker() are instantiated synchronously at module level, before Express server starts. connectionOpts derived from REDIS_URL env var.
implication: Redis connection is attempted immediately on module load, not lazily

- timestamp: 2026-06-30T00:00:00.000Z
checked: infra/docker-compose.yml
found: redis:7-alpine service defined on port 6379, with healthcheck. Docker Desktop is not running (pipe not available).
implication: Redis is not available, but code doesn't handle this gracefully

## Resolution

root_cause: "BullMQ Queue('submissions') and Worker('submissions') are instantiated at module-level in apps/api/src/index.ts (lines 43-47) without any error handling. Both constructors immediately attempt to connect to Redis at redis://localhost:6379. When Docker containers are not running (Docker Desktop service stopped), Redis is unreachable, and BullMQ's internal reconnection logic causes repeated ECONNREFUSED errors that spam the console. The API server still starts because these async connection failures don't crash the process (Express listen continues), but the console noise is disruptive."
fix: "Option C: Both — (1) Start Docker containers to provide Redis, AND (2) Make Redis/BullMQ initialization lazy and resilient so the API can start without Redis (wrap in try-catch with optional flag, defer connection to first use)"
verification: ""
files_changed:

- apps/api/src/index.ts
42 changes: 42 additions & 0 deletions .planning/debug/resolved/unused-usestate-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
status: resolved
trigger: "web#build failing: 'useState' is defined but never used. @typescript-eslint/no-unused-vars in apps/web/src/components/features/code-submission.tsx"
created: 2026-07-02T10:00:00.000Z
updated: 2026-07-02T10:00:00.000Z
---

## Current Focus

hypothesis: "useState is imported but genuinely unused — the component uses Zustand (useEditorStore) and tRPC mutation state instead"
test: Remove useState from import, run build to verify
expecting: Build passes without the no-unused-vars error
next_action: Apply fix and run pnpm run build in apps/web

## Symptoms

expected: web#build passes without errors
actual: ESLint error — 'useState' is defined but never used
errors: "3:10 Error: 'useState' is defined but never used. @typescript-eslint/no-unused-vars"
reproduction: Run any build command that invokes ESLint on code-submission.tsx
started: Likely since the component was written without using useState

## Eliminated

- hypothesis: useState might be needed but was forgotten
evidence: Component uses useEditorStore for code state and trpc.useMutation for submission lifecycle — all state needs are met without useState
timestamp: 2026-07-02T10:00:00.000Z

## Evidence

- timestamp: 2026-07-02T10:00:00.000Z
checked: apps/web/src/components/features/code-submission.tsx lines 1-63
found: useState imported on line 3 but never called in component body. Component uses useEditorStore (line 11) and trpc.modules.submitDecode.useMutation() (line 12).
implication: useState is genuinely unused — removing it is the correct fix

## Resolution

root_cause: Unused import of useState in code-submission.tsx component — the component uses Zustand (useEditorStore) for state management and tRPC mutation state for submission lifecycle, with no need for local React state
fix: Remove useState from the React import on line 3
verification: Build passes cleanly — "Compiled successfully", 0 ESLint errors, 13 static pages generated
files_changed:
- apps/web/src/components/features/code-submission.tsx
113 changes: 113 additions & 0 deletions .planning/debug/ts-build-errors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
status: investigating
trigger: "Debug TypeScript build errors in UnVibe monorepo (pnpm build fails with api#build exiting code 2)"
created: 2026-06-30T21:47:00.000Z
updated: 2026-06-30T21:47:00.000Z
---

## Current Focus

hypothesis: Three independent root causes causing tsc build failure — (1) prisma generate not run, (2) tsconfig includes test files without jest types, (3) untyped catch param
test: Verify each root cause by checking node_modules/.prisma/client existence, tsconfig include/exclude, and TypeScript strict mode behavior
expecting: All three confirmed
next_action: Present completed diagnosis with fix steps

## Symptoms

expected: `pnpm build` completes with zero TypeScript errors
actual: `api#build` task exits with code 2 — three error groups
errors: |
Error Group 1 — TS2305: Module '"@prisma/client"' has no exported member 'PrismaClient'
src/index.ts(8,10): error TS2305
src/services/submission-worker.ts(13,10): error TS2305

Error Group 2 — Test globals not found (30+ errors)
src/**tests**/ai-client.test.ts(30,1): error TS2582: Cannot find name 'describe'
src/**tests**/ai-client.test.ts(33,3): error TS2304: Cannot find name 'beforeEach'
src/**tests**/ai-client.test.ts(35,5): error TS2304: Cannot find name 'jest'
... (describe, it, expect, jest, beforeEach all unrecognized)

Error Group 3 — TS7006: Parameter 'e' implicitly has an 'any' type
src/services/submission-worker.ts(100,19): error TS7006
reproduction: Run `pnpm build` in repo root (or `pnpm --filter api build`)
started: First build attempt — never successfully built

## Eliminated

- hypothesis: @prisma/client not installed as dependency
evidence: @prisma/client is listed in dependencies of apps/api/package.json at line 17, and node_modules/@prisma/client exists
timestamp: 2026-06-30T21:47:00.000Z

- hypothesis: Missing @types/jest is the full fix for Error Group 2
evidence: The real fix is to exclude test files from the build tsconfig. Adding @types/jest would only mask the problem — test files shouldn't be compiled during a production build. Test runner (jest.config.ts uses ts-jest) handles compilation separately.
timestamp: 2026-06-30T21:47:00.000Z

## Evidence

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/tsconfig.json
found: `"include": ["src/**/*"]` — this includes `src/__tests__/ai-client.test.ts`
implication: Test files are compiled during `tsc build`. This is the cause of Error Group 2.

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/node_modules/@prisma/client/index.d.ts
found: `export * from '.prisma/client/default'` — re-exports from generated client
implication: Requires `.prisma/client/` generated directory to exist.

- timestamp: 2026-06-30T21:47:00.000Z
checked: node_modules/.prisma/client/ and apps/api/node_modules/.prisma/client/
found: Neither exists anywhere in the repo
implication: `prisma generate` has never been run. This is the cause of Error Group 1.

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/tsconfig.build.json
found: Does not exist
implication: No separate build tsconfig exists to exclude test files.

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/node_modules/@types/jest
found: Does not exist (neither in apps/api/node_modules nor root node_modules)
implication: Even if tests were included, jest type definitions are not available.

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/src/services/submission-worker.ts line 100
found: `.catch((e) => logger.error(...))` — `e` is an untyped arrow function parameter in a `.catch()` callback
implication: `useUnknownInCatchVariables` (strict mode) only applies to `catch(e)` in try/catch blocks, NOT to `.catch((e) => ...)` promise callbacks. The param `e` is a regular parameter defaulting to `any`. This is Error Group 3.

- timestamp: 2026-06-30T21:47:00.000Z
checked: tsconfig.base.json line 9 — `"strict": true`
found: strict mode is enabled
implication: `noImplicitAny` is enabled, which catches any untyped parameter.

- timestamp: 2026-06-30T21:47:00.000Z
checked: turbo.json
found: build task has `"dependsOn": ["^build"]` but no dependency on `db:generate`
implication: Even if `prisma generate` were a script, it wouldn't automatically run before build

- timestamp: 2026-06-30T21:47:00.000Z
checked: apps/api/package.json build script
found: `"build": "tsc"` — uses the default tsconfig.json which includes test files
implication: No separate build tsconfig is used

## Resolution

root_cause: |
Three independent root causes:

1. **PrismaClient not found (Error Group 1):** `prisma generate` has never been run. The `@prisma/client` package is installed but its generated client code in `.prisma/client/` only materializes after `prisma generate`. TypeScript resolves the import declaration to `@prisma/client/index.d.ts` which re-exports from `.prisma/client/default` — a file that doesn't exist, so there are no exports to resolve.

2. **Test files compiled during build (Error Group 2):** `tsconfig.json` uses `"include": ["src/**/*"]` which matches `src/__tests__/ai-client.test.ts`. This file uses Jest globals (`describe`, `beforeEach`, `jest`, `expect`, `it`) but `@types/jest` is not installed. The fix is to exclude test files from the build tsconfig (standard practice), NOT to install jest types (which would only allow test code to compile into the production dist).

3. **Implicit any on catch param (Error Group 3):** Line 100 of `submission-worker.ts` has `.catch((e) => logger.error(...))`. The `useUnknownInCatchVariables` flag (implied by `strict: true`) only applies to `catch` clause variables in try/catch blocks, NOT to `.catch()` promise method callbacks. The parameter `e` is a regular untyped arrow function parameter, which strict mode's `noImplicitAny` flags as an error.

fix: |

1. Run `pnpm --filter api exec prisma generate` before build (or add `"prebuild": "prisma generate"` to apps/api/package.json)
2. Create a `tsconfig.build.json` that excludes `src/__tests__`, update build script to `"build": "tsc -p tsconfig.build.json"`
3. Add explicit type annotation `e: unknown` on line 100 of submission-worker.ts
verification: Not yet applied
files_changed:

- apps/api/tsconfig.build.json (create)
- apps/api/package.json (update build script)
- apps/api/src/services/submission-worker.ts (fix catch param type)
45 changes: 45 additions & 0 deletions .planning/intel/.last-refresh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"_meta": {
"updated_at": "2026-06-30T22:30:00.000Z",
"version": 1
},
"snapshot": {
"branch": "Python-Yuvraj",
"commit": "f785ee8",
"description": "Dev 2 — AI Service full implementation with real OpenRouter LLM calls",
"files": {
"apps/ai-service/app/main.py": "hashv1",
"apps/ai-service/app/config.py": "hashv1",
"apps/ai-service/app/services/llm_client.py": "hashv1",
"apps/ai-service/app/services/prompt_manager.py": "hashv1",
"apps/ai-service/app/services/ast_differ.py": "hashv1",
"apps/ai-service/app/routes/generate.py": "hashv1",
"apps/ai-service/app/routes/quiz.py": "hashv1",
"apps/ai-service/app/routes/diff.py": "hashv1",
"apps/ai-service/app/routes/defend.py": "hashv1",
"apps/ai-service/app/prompts/v1/code_generation.txt": "hashv1",
"apps/ai-service/app/prompts/v1/quiz_generation.txt": "hashv1",
"apps/ai-service/app/prompts/v1/defend_question.txt": "hashv1",
"apps/ai-service/app/prompts/v1/defend_evaluation.txt": "hashv1",
"apps/ai-service/tests/conftest.py": "hashv1",
"apps/ai-service/tests/test_generate.py": "hashv1",
"apps/ai-service/tests/test_quiz.py": "hashv1",
"apps/ai-service/tests/test_diff.py": "hashv1",
"apps/ai-service/tests/test_defend.py": "hashv1",
"apps/ai-service/requirements.txt": "hashv1",
"apps/ai-service/pytest.ini": "hashv1",
"apps/api/src/services/ai-client.ts": "hashv1",
"apps/api/src/services/submission-worker.ts": "hashv1",
"apps/api/src/__tests__/ai-client.test.ts": "hashv1",
"apps/api/jest.config.ts": "hashv1",
"apps/api/src/index.ts": "hashv1",
"apps/api/package.json": "hashv1"
},
"counts": {
"python_tests": 28,
"typescript_tests": 12,
"python_source_files": 10,
"typescript_source_files": 6
}
}
}
Loading