diff --git a/.planning/STATE.md b/.planning/STATE.md index b5080f4..0f17386 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -4,14 +4,14 @@ milestone: v1.0 milestone_name: milestone status: verifying stopped_at: Phase 1 plans complete (01-01 through 01-04) -last_updated: "2026-06-06T08:55:46.710Z" -last_activity: 2026-06-06 -- Plan 01-03 (Pet CRUD) verified by human checkpoint; 5 post-checkpoint UX fixes applied +last_updated: "2026-06-06T09:48:37.937Z" +last_activity: 2026-06-06 -- Phase 1 fully verified; media storage switched from R2 to Supabase Storage; avatar CDN display confirmed working progress: total_phases: 7 - completed_phases: 0 + completed_phases: 1 total_plans: 4 - completed_plans: 3 - percent: 0 + completed_plans: 5 + percent: 14 --- # Project State @@ -21,14 +21,14 @@ progress: See: .planning/PROJECT.md (updated 2026-06-05) **Core value:** Pets are first-class social identities — not just content on a human's feed — so every feature is built around the pet's life, not the owner's. -**Current focus:** Phase 1 — Foundation +**Current focus:** Phase 2 — Content Core (next) ## Current Position -Phase: 1 (Foundation) — EXECUTING -Plan: 4 of 4 (next: 01-04 Media Pipeline / R2 Avatar Upload) -Status: Plans 01-01, 01-02, 01-03 complete and UAT verified -Last activity: 2026-06-06 -- Plan 01-03 (Pet CRUD) verified by human checkpoint; 5 post-checkpoint UX fixes applied +Phase: 1 (Foundation) — COMPLETE +Plan: 4 of 4 complete +Status: All Phase 1 success criteria met; walking skeleton verified end-to-end +Last activity: 2026-06-06 -- Phase 1 fully verified; media storage switched from R2 to Supabase Storage; avatar CDN display confirmed working Progress: [██░░░░░░░░] 7% diff --git a/.planning/phases/01-foundation/SUMMARY.md b/.planning/phases/01-foundation/SUMMARY.md new file mode 100644 index 0000000..a0a8f99 --- /dev/null +++ b/.planning/phases/01-foundation/SUMMARY.md @@ -0,0 +1,65 @@ +--- +phase: '01' +phase_name: Foundation +milestone: v1.0 +status: complete +completed: '2026-06-06' +plans_total: 4 +plans_complete: 4 +tests_passing: 18 +storage_switch: R2 -> Supabase Storage (post-execution fix) +--- + +# Phase 01: Foundation — COMPLETE + +**One-liner:** Walking skeleton end-to-end verified — owner can sign up, create and manage pet profiles, and upload avatars served from Supabase Storage CDN; 18 passing unit tests; all Phase 1 success criteria met. + +## What Was Built + +### Plan 01 — Walking Skeleton +Next.js 16.2.7 scaffold with Tailwind v4, shadcn/ui (base-nova, orange design system), Clerk 7 auth proxy, Prisma 7 schema (Owner / Species / Breed / Pet), tRPC 11 ownership-asserted procedures, ActivePetContext backed by localStorage, Vitest scaffold. Solved Prisma 7 breaking changes (prisma.config.ts; @prisma/adapter-pg). + +### Plan 02 — Auth + App Shell +Clerk auth pages (sign-up, log-in, forgot/reset password, verify-email) with orange-500 appearance. Protected 240 px sidebar + mobile bottom nav. Server-side pet guard redirects no-pet owners to onboarding. + +### Plan 03 — Pet CRUD +Full CRUD via tRPC (create/update/delete/listSpecies/listBreeds). PetForm, PetCard components. My Pets grid, pet profile page, pet edit page. 45-breed seed. 11 passing unit tests. + +### Plan 04 — Media Pipeline +tRPC media router (getPresignedUrl + confirmUpload) with server-only import, contentType enum, 10 MB cap, path-traversal key prefix guard. Five-state AvatarUpload component (idle / idle-with-avatar / dragging / uploading / error) with XHR progress. CDN avatars in profile, edit page, Sidebar, MobileNav. 7 passing security tests. + +### Post-execution — Supabase Storage switch +Switched from Cloudflare R2 to Supabase Storage for simpler setup and co-location with Postgres. +- src/lib/supabase-storage.ts (server-only): createSignedUploadUrl + getPublicUrl +- src/lib/avatar-url.ts (client-safe): getAvatarUrl helper +- All avatar display locations updated (profile, edit, PetCard, Sidebar, MobileNav) +- next.config.ts remotePatterns updated for Supabase hostname +- Upload + CDN delivery confirmed working end-to-end + +## Success Criteria — All Met + +| Criterion | Status | +|-----------|--------| +| Owner can sign up and log in via Clerk | complete | +| Owner with no pets redirected to onboarding | complete | +| Owner can create, edit, and delete a pet profile | complete | +| Owner can upload an avatar served from CDN | complete | +| App shell shows active pet context (sidebar + mobile nav) | complete | +| All pet mutations assert ownership | complete | +| 18 unit tests passing; TypeScript clean | complete | + +## Architecture Decisions Locked In + +- Pet-as-actor identity via active_pet_id + localStorage (must be in Phase 1; cannot retrofit) +- All media via presigned upload — binary never through API server +- Supabase Storage over R2 — simpler, co-located with Postgres, same SDK +- Stories = separate DB table (not posts with expires_at) — pre-committed for Phase 2 +- Feed via Redis fan-out sorted sets from day one — pre-committed for Phase 2 + +## Test Results + +18 tests passing, 0 failing + auth.test.ts: 4 tests + pet-profile.test.ts: 7 tests + media-upload.test.ts: 7 tests +TypeScript: npx tsc --noEmit exits 0