You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sprint 2: Fix Test Failures, Add Layout, Unify Stores
Building on the existing codebase from Sprint 1 (PR #2).
Context
This project was built by Dark Factory in Sprint 1. Two factory passes collided, creating duplicate store systems and mismatched tests. The current state:
What works: Pages exist (app/page.tsx, app/build/[id]/page.tsx), launch form, build status client with SSE, two complete API route sets, UI components, Tailwind config, dark theme
What's broken: 18 of 19 test files fail. Two incompatible store systems exist (lib/store/build-store.ts and lib/store/in-memory-project-store.ts). Missing app/layout.tsx (Next.js won't render without it). Missing .gitignore. The globals.css was overwritten and lost the glassmorphism utility classes.
Hard Constraints
Language: TypeScript with strict: true
No regressions: All existing pages and API routes must continue to work
Test requirement: ALL tests must pass (npx vitest run exits 0)
Preserve file structure: Do not reorganize existing files unless specified below
Font: Space Grotesk from Google Fonts via next/font/google
Proper metadata: title "Project Launcher", description "Launch builds instantly"
importtype{Metadata}from"next";import{Space_Grotesk}from"next/font/google";import"./globals.css";constfont=Space_Grotesk({subsets: ["latin"],variable: "--font-sans"});exportconstmetadata: Metadata={title: "Project Launcher",description: "Launch builds instantly and monitor them in real time.",};exportdefaultfunctionRootLayout({ children }: {children: React.ReactNode}): JSX.Element{return(<htmllang="en"className={`dark ${font.variable}`}><body>{children}</body></html>);}
lib/store/build-store.ts — uses globalThis.__projectLauncherStore, deterministic IDs (bld_000001), separate createBuild/updateBuildStatus/appendLog/subscribeToBuild functions
lib/store/in-memory-project-store.ts — uses globalThis.__projectStore, UUID IDs, class-based with InMemoryProjectStore
The pages and /api/projects routes use in-memory-project-store.ts. The /api/builds routes and tests/lib/build-store.test.ts use build-store.ts.
Keep BOTH stores as-is. Do not merge them. Each API route set uses its own store and that's fine. The fix is in the tests — make sure each test imports the correct store for the route it tests.
5. Fix ALL 18 failing test files
The test failures fall into these categories:
A. Config tests expect old values (tests/config/config-files.test.ts):
package.json test expects next: "14.2.24" but actual is "14.2.15" — update test to match actual
tsconfig.json test expects noImplicitAny: true — verify tsconfig actually has this, fix test or tsconfig
tailwind.config.ts test expects darkMode: ["class"] and specific colors — verify actual config, fix test
For each failing test file: read the test, read the source file it tests, and fix whichever side has the bug. Prefer fixing tests to match actual code if the code is correct.
6. Fix Tailwind config color mismatch
In tailwind.config.ts, the extended colors define light-theme values (background: "#F8FAFC", foreground: "#0F172A") which conflict with the dark theme. Update these to dark-theme values:
background: "#020617" (slate-950)
foreground: "#e2e8f0" (slate-200)
Existing Code Reference
Current file: lib/store/build-store.ts
This file is the original Sprint 1 build store. It exports: createBuild, listBuilds, getBuild, updateBuildStatus, appendLog, subscribeToBuild. Uses globalThis.__projectLauncherStore. Keep it as-is.
Current file: lib/store/in-memory-project-store.ts
This is the Sprint 1.5 project store class. Exports inMemoryProjectStore singleton. Uses globalThis.__projectStore. Keep it as-is.
Sprint 2: Fix Test Failures, Add Layout, Unify Stores
Context
This project was built by Dark Factory in Sprint 1. Two factory passes collided, creating duplicate store systems and mismatched tests. The current state:
app/page.tsx,app/build/[id]/page.tsx), launch form, build status client with SSE, two complete API route sets, UI components, Tailwind config, dark themelib/store/build-store.tsandlib/store/in-memory-project-store.ts). Missingapp/layout.tsx(Next.js won't render without it). Missing.gitignore. Theglobals.csswas overwritten and lost the glassmorphism utility classes.Hard Constraints
strict: truenpx vitest runexits 0)Changes Required
1. Add missing
app/layout.tsx(CRITICAL — app won't render without this)Create
app/layout.tsxwith:./globals.css<html lang="en" className="dark">)next/font/google2. Add
.gitignoreCreate
.gitignorewith standard Next.js entries:3. Restore glassmorphism CSS classes in
app/globals.cssThe current
globals.cssis missing the glassmorphism utility classes that tests expect. Replace the entire content ofapp/globals.csswith:4. Unify the two store systems
There are currently TWO stores:
lib/store/build-store.ts— usesglobalThis.__projectLauncherStore, deterministic IDs (bld_000001), separatecreateBuild/updateBuildStatus/appendLog/subscribeToBuildfunctionslib/store/in-memory-project-store.ts— usesglobalThis.__projectStore, UUID IDs, class-based withInMemoryProjectStoreThe pages and
/api/projectsroutes usein-memory-project-store.ts. The/api/buildsroutes andtests/lib/build-store.test.tsusebuild-store.ts.Keep BOTH stores as-is. Do not merge them. Each API route set uses its own store and that's fine. The fix is in the tests — make sure each test imports the correct store for the route it tests.
5. Fix ALL 18 failing test files
The test failures fall into these categories:
A. Config tests expect old values (
tests/config/config-files.test.ts):package.jsontest expectsnext: "14.2.24"but actual is"14.2.15"— update test to match actualtsconfig.jsontest expectsnoImplicitAny: true— verify tsconfig actually has this, fix test or tsconfigtailwind.config.tstest expectsdarkMode: ["class"]and specific colors — verify actual config, fix testglobals.csstest expects.glass-card,.glass-panel,.log-stream-panel— fixed by change Sprint 2: Fix Test Failures, Add Layout, Unify Stores #3 aboveB.
tests/api/tests import frombuild-store.tsbut routes now use different patterns:tests/api/build-id-route.test.ts— importsGETfromapp/api/builds/[id]/route.tswhich usesbuild-store.ts. Make sure imports resolve correctly.tests/api/build-logs-route.test.ts— tests SSE streaming. Make sure the SSE route handler signature matches what tests expect.tests/api/builds-route.test.ts— tests POST/GET on/api/builds. Make surebuild-store.tsexports match test imports.C.
__tests__/files test the project store system:__tests__/in-memory-project-store.test.ts— testsinMemoryProjectStoreclass methods__tests__/projects-api.integration.test.ts— tests/api/projectsroutes__tests__/projects-routes.unit.test.ts— tests project route handlers__tests__/project-schema.test.ts— testscreateProjectSchemaandprojectIdSchema__tests__/api-client.test.ts— testslib/api/client.ts__tests__/error-response.test.ts— testslib/server/error-response.ts__tests__/sse.test.ts— testslib/server/sse.ts__tests__/log-stream.test.tsx— tests log stream component__tests__/utils.test.ts— tests utility functionsFor each failing test file: read the test, read the source file it tests, and fix whichever side has the bug. Prefer fixing tests to match actual code if the code is correct.
6. Fix Tailwind config color mismatch
In
tailwind.config.ts, the extended colors define light-theme values (background: "#F8FAFC",foreground: "#0F172A") which conflict with the dark theme. Update these to dark-theme values:background:"#020617"(slate-950)foreground:"#e2e8f0"(slate-200)Existing Code Reference
Current file: lib/store/build-store.ts
This file is the original Sprint 1 build store. It exports:
createBuild,listBuilds,getBuild,updateBuildStatus,appendLog,subscribeToBuild. UsesglobalThis.__projectLauncherStore. Keep it as-is.Current file: lib/store/in-memory-project-store.ts
This is the Sprint 1.5 project store class. Exports
inMemoryProjectStoresingleton. UsesglobalThis.__projectStore. Keep it as-is.Current file: tsconfig.json
{ "compilerOptions": { "target": "ES2022", "lib": ["dom", "dom.iterable", "es2022"], "allowJs": false, "skipLibCheck": true, "strict": true, "noImplicitAny": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "baseUrl": ".", "paths": { "@/*": ["./*"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] }Current file: package.json (scripts + deps)
{ "name": "project-launcher", "version": "1.0.0", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "test": "vitest run" }, "dependencies": { "next": "14.2.15", "react": "18.3.1", "react-dom": "18.3.1", "zod": "^3.23.8", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "lucide-react": "^0.453.0", "tailwind-merge": "^2.5.4", "@radix-ui/react-dialog": "^1.1.2", "@radix-ui/react-select": "^2.1.2", "@radix-ui/react-slot": "^1.1.0" }, "devDependencies": { "typescript": "^5.6.3", "vitest": "^2.1.3", "tailwindcss": "^3.4.14", "postcss": "^8.4.47", "autoprefixer": "^10.4.20", "@types/node": "^22.8.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1" } }Acceptance Criteria
app/layout.tsxexists and renders all pages with dark theme.gitignoreexists and excludesnode_modules/,.next/,.env*,*.logapp/globals.csscontains.glass-card,.glass-panel,.log-stream-panelutility classestailwind.config.tscolors use dark-theme valuesnpx vitest runexits with 0 failuresnpx tsc --noEmitpasses)/api/buildsand/api/projectsroute sets continue to work/and/build/[id])What NOT to Change
lib/store/build-store.ts— leave as-islib/store/in-memory-project-store.ts— leave as-iscomponents/project-launcher/launch-form.tsx— leave as-iscomponents/project-launcher/build-status-client.tsx— leave as-iscomponents/ui/button.tsx,components/ui/card.tsx,components/ui/input.tsx,components/ui/progress.tsx— leave as-isapp/page.tsx— leave as-isapp/build/[id]/page.tsx— leave as-isapp/api/projects/routes — leave as-isapp/api/builds/routes — leave as-islib/build-simulator.ts— leave as-is