# 2026-02-12 — ReadStreak Launch Push (Day 2)

## ReadStreak Critical Bug — App Stuck on Loading
- **Status:** CRITICAL — App shows "Loading..." and never hydrates
- **URL:** https://readstreak.dev.apps.symph.co
- **Port:** 3024 (confirmed running via Next.js 15.5.12)
- **Suspected cause:** Introduced during Lifetime tier changes (`1c32239`)
- **Investigation needed:** Firebase init, auth state, client-side JS errors
- **HTML renders** but React hydration/JS likely failing

## Features Completed Today
All these commits landed and need verification once loading bug is fixed:

| Commit | Feature |
|--------|---------|
| `1c32239` | Lifetime tier — ₱1,299 one-time, year 2100 expiry, purple branding |
| `ad99db1` | Hybrid downgrade — excess books view-only with lock icon |
| `bc1ab26` | Read button direct to session — skip book detail page |
| `dc08b11` | Quick-log dialog fix — initializes to current page |
| `7662597` | Tier limits updated — Spark 2/2, Bookworm 10/10, Legend unlimited |
| `6c3c262` | Page counter shows current page (50, 51, 52...) |
| `caae903` | SymphPay price fix — whole currency units, not cents |
| `d3e2ce3` | XP by tracking mode — pages→page XP, time→time XP |
| `e0bb0fa` | Dashboard "Currently Reading" removed (redundant) |
| `d918937` | Page-level caching — eliminates skeleton loaders |
| `32185f2` | Selective caching — books/week 30s cache, leaderboard live |

## Key Files Modified for Lifetime Tier
- `/src/lib/config/pricing.ts` — Added LIFETIME tier config
- `/src/lib/locale.ts` — Added PHP/USD prices for lifetime
- `/src/app/api/webhooks/symph-pay/route.ts` — Handles lifetime subscription activation
- `/src/lib/subscription.ts` — `canTrackBook()` function for tier limits

## Pricing Decisions Finalized
| Tier | PHP | USD | Limits |
|------|-----|-----|--------|
| Spark | Free | Free | 2 books, 2 friends |
| Bookworm | ₱99/mo | $1.99/mo | 10/10 |
| Legend | ₱199/mo | $3.99/mo | Unlimited |
| Lifetime | ₱1,299 | $24.99 | Unlimited, forever |

## Technical Decisions
- **SymphPay:** Use whole currency units (99 = ₱99.00), NOT cents
- **Page counter UX:** Show current page number, not pages read this session
- **Downgrade:** Hybrid — N most recent books trackable, excess view-only
- **Lifetime:** `subscription.isLifetime: true`, `expiresAt: 2100-01-01`

## Next Actions (After Loading Bug Fix)
1. Test Lifetime checkout flow end-to-end
2. Complete Stats page caching
3. Configure RESEND_API_KEY for email reminders
4. Address GitHub security vulnerabilities (3 on default branch)

## Nick's QA Protocol (ALWAYS FOLLOW)
1. Build completes without errors
2. Kill old server process (`fuser -k 3024/tcp`)
3. Start new server
4. **Verify BUILD_ID matches** (`.next/BUILD_ID` vs HTML)
5. **5 rounds of testing** — different flows, different states
6. Hard refresh / incognito test
7. Check server logs for errors

---
*Session with Nick (CTO) — high-stakes launch readiness work*

---

## Product Pipeline Metrics (Loewe inquiry)

Loewe asked for actual metrics on discovery phase duration.

**Snapshot as of 2026-02-12 15:13 UTC:**
- **Total products:** 96
- **Build phase:** 29 (30%)
- **Design phase:** 1 (1%)
- **Discovery phase:** 66 (69%)

**Discovery → Build Timeline (observed):**
- Agent work (artifacts): 30 min - 2 hours
- Human review: variable (instant to days)
- End-to-end typical: same day to 2 days when actively pushed

**Key insight:** 66 products stuck in Discovery are waiting on human decisions (approve/reject), not agent work. The pipeline stood up ~100 products in 3 days since Feb 10.

**Bottleneck:** Human decision velocity, not agent execution speed.

---

## ReadStreak Production Deployment (MAJOR MILESTONE)

### Cloud Run Deployment Complete ✅
- **Service:** `readstreak` on `us-central1`
- **URL:** `https://readstreak-1026787195922.us-central1.run.app`
- **Commits:** `5650f4a` (Firebase 10→12, 0 vulnerabilities), `32990ba` (Cloud Run deploy)

### Production Infrastructure
- **Firebase Admin:** Lazy initialization to avoid build-time errors in Docker
- **Output mode:** `standalone` for Docker compatibility
- **Secrets configured in Cloud Run:**
  - `SYMPH_PAY_API_KEY` (prod key)
  - `SECRET_KEY` (NextAuth)
  - `CRON_SECRET`

### SymphPay Production Setup ✅
- **Merchant ID:** `4856241612390400`
- **API Key:** `Kf0FvTZ63MlRMqEf`
- **Products created:**
  - Bookworm: `4873453794492416` (₱99/mo)
  - Legend: `5999353701335040` (₱199/mo)
  - Lifetime: `5950493683613696` (₱1,299)
- **Note:** Using `one_time` products (SymphPay subscription type returns null IDs)

### Domain Mapping — BLOCKED
- **Target domain:** `readstreak.app` (Namecheap)
- **DNS records needed:**
  - A records: 216.239.32.21, 216.239.34.21, 216.239.36.21, 216.239.38.21
  - AAAA records: 2001:4860:4802:32::15, etc.
- **Blocker:** Nick DMed Namecheap credentials but DM session not located
- **Nick's Discord ID:** `1166016070117761164`

### Technical Fixes for Production
- ESLint config added (`.eslintrc.json`) for Next.js flat config compatibility
- Console.log cleanup — removed noisy client logs, kept server-side
- Firebase Admin uses `credential.cert()` with lazy init

---

## Learnings #production #deployment #cloud-run

1. **Firebase App Hosting requires interactive GitHub OAuth** — can't use from CLI, use Cloud Run instead
2. **SymphPay subscriptions broken** — productType `subscription` returns null IDs; workaround is `one_time`
3. **Docker + Next.js:** Must use `output: 'standalone'` and copy `.next/standalone` + `.next/static` + `public`
4. **Firebase Admin in Docker:** Use lazy initialization to avoid build-time credential errors

---

## Hubbit (Couples App) — Firestore Rules Bug Fix

**Issue:** Lester reported app stuck on "Joining your partner..." after Google sign-in

**Root Cause:** Classic Firestore rules catch-22:
- Rules required `partnerIds` to include user's UID to read couple documents
- But to join via invite code, you need to **query** couples by `inviteCode`
- Query fails because user isn't a partner yet → can't read → can't find the couple to join

**Fix Applied:**
```javascript
// Before (broken):
allow read: if isSignedIn() && (
  resource.data.partnerIds[0] == request.auth.uid ||
  resource.data.partnerIds[1] == request.auth.uid
);

// After (working):
allow read: if isSignedIn();  // Allow lookup by invite code
allow update: if isSignedIn() && (
  resource.data.partnerIds[0] == request.auth.uid ||
  resource.data.partnerIds[1] == request.auth.uid ||
  // Allow joining as second partner if slot is empty
  (resource.data.partnerIds[1] == '' && request.resource.data.partnerIds[1] == request.auth.uid)
);
```

**Learning:** #firestore #rules #invite-flow
When building invite/join flows with Firestore:
- Users need to **read** documents they're not yet associated with (to find by invite code)
- Either allow broader reads OR use a separate lookup collection (`invite_codes/{code}` → `coupleId`)
- Keep **write** rules strict — that's where real security matters

---

## Frontend Design Excellence Skill Created #design #skills #jim

**Context:** Jim asked "how might we improve your generated fe outputs for products? right now we only have svgs and emojis and it looks bland. we want it to feel like a senior designer and senior dev made the website."

**Created:** `skills/frontend-design-excellence/SKILL.md`

**Key components:**
1. **Anti-pattern checklist** — Explicit "bland" markers to catch:
   - Emoji as primary visuals ❌
   - Generic SVG icons only ❌
   - No hero images ❌
   - Inter/system fonts everywhere ❌
   - No hover states ❌
   - Flat colored boxes ❌
   - Bootstrap-style grid layouts ❌

2. **Required elements** for every build:
   - Custom hero visual (generated via `nano-banana-pro` or quality stock)
   - Typography personality (distinctive display font, not Inter)
   - Visual depth (layered shadows, glass, gradients)
   - Motion & interaction (hover states, transitions)
   - Layout sophistication (bento grids, asymmetry)

3. **Image generation protocol** — When to use `nano-banana-pro`:
   - Hero sections (always)
   - Feature illustrations
   - Empty states
   - 404 pages

4. **Reference gallery** — Quality bar examples:
   - Linear, Stripe, Vercel (dev tools)
   - Airbnb, Headspace (consumer)
   - Notion, Figma (SaaS)

5. **Integrated into web-app-builder** — Quality gate is now REQUIRED before marking builds complete

**Commits:**
- `74823da` — Add frontend-design-excellence skill
- `c3fe191` — Require quality gate in web-app-builder

**Learning:** The existing `frontend-design` skill had good guidance but wasn't being enforced. The new skill is a checklist/gate that catches bland outputs before delivery.

---

## Job Processor Activity

Heavy job backlog today (~60+ pending jobs). Multiple processor runs spawned subagents for:
- Discovery phases (content-creation, finance-freelancer-tools, software-quality-assurance)
- Design generations (paluwagan, internal-prompt-engineering-tool, content-creation-1)
- Build feedback (bir-tax-tracker, finance-rotating-savings-group, social-media-content)
- Phase feedback (various products)

Gateway experienced session lock contention due to high volume. Jobs processing in batches.

---

## TIL (Today I Learned)

- Quality gates need to be **explicit checklists** not just guidance documents — people (and AIs) skip guidance, but checklists get followed
- "Senior designer + senior dev" is a good mental benchmark for quality bar
- Image generation should be non-negotiable for hero sections — text-only heroes always look AI-generated

## ReadStreak E2E Health Check (3:03 AM PHT)
- Homepage: ✅ 200
- Dashboard: ✅ 200
- Library: ✅ 200
- Friends: ✅ 200
- Process: Idle (no process on port 3024, serving cached pages)
- Last build: 2026-02-12 17:55 UTC (~1hr ago)
- Status: **PASS** — pages serving correctly from Next.js cache, app idle per resource conservation policy

---

## BarangayOS v2 Design Complete (07:11 UTC) #design #government-barangay

Ragan requested design regeneration after PRD update (public calendar feature added).

**v2 Design Assets Generated:**
- **Logo:** `logo-barangayos-v2.png` — Simplified minimal design (geometric icon + clean wordmark)
- **6 Screens:**
  1. `screen-01-dashboard.png` — Officials overview
  2. `screen-02-residents.png` — Resident management
  3. `screen-03-document-generation.png` — Clearance form
  4. `screen-04-transaction-log.png` — Better table typography
  5. `screen-05-citizen-portal.png` — Request & track
  6. `screen-06-public-calendar.png` — NEW community events
- **Brand Guidelines:** Updated with Navy Blue (`#1E3A5F`) + Teal (`#0D9488`)
- **Typography:** Plus Jakarta Sans (UI) + JetBrains Mono (tables/data)

**Location:** `/home/aria/products/government-barangay/design/assets/`

**User Feedback Incorporated:**
- ✅ Simpler logo (per Ragan's request)
- ✅ Better table fonts (per Ragan's request)
- ✅ Public Calendar screens (new PRD feature)

Awaiting Ragan's review of generated screens.
