docs(state): Phase 10 redo complete — root cause was unapplied prod migrations 0001-0005
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
# Handoff
|
||||||
|
|
||||||
|
Living document — update at the end of each session so the next one can resume without re-deriving context. Overwrite stale sections; keep it short and actionable.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2026-06-11 (sera) — Phase 10 redo COMPLETATO, root cause trovata
|
||||||
|
|
||||||
|
### Root cause del crash (diversa dall'ipotesi del handoff precedente)
|
||||||
|
|
||||||
|
Il DB di produzione (Coolify, container `xwkk0040w0kk0gsgcgog8owk`, db `clienthub`) **non aveva NESSUNA migration applicata dopo la 0000**: mancavano `services` (0001), `leads`/`offer_phases`/`offer_phase_services`/`quotes` (0003), le colonne quotes (0004). Le summary di Phase 7/8 dicevano "migration pending connectivity" e nessuno le ha mai applicate.
|
||||||
|
|
||||||
|
Conseguenze: catalogo (→`services`), quote builder e `/quote/[token]` (→`quotes`) erano **già rotti in produzione prima di Phase 10**. Il deploy di Phase 10 ha solo aggiunto il crash della dashboard (FollowUpWidget→`leads`). Il rollback a `0bca8a6` ha mascherato il sintomo dashboard ma /quote/[token] dava ancora 500 (verificato con token 21-char valido).
|
||||||
|
|
||||||
|
NB: l'app NON è su Vercel — Gitea (`git.iamcavalli.net`) → Coolify self-hosted. Il problema non era di piattaforma; nessun motivo di migrare a Replit.
|
||||||
|
|
||||||
|
### Cosa è stato fatto (redo staged)
|
||||||
|
|
||||||
|
1. **Stage A** — commit `5aa6614`: deps `@radix-ui/react-dialog@^1.1.16` + `date-fns@^4.4.0` + `ui/dialog.tsx`/`ui/form.tsx`. Deployato e verificato.
|
||||||
|
2. **Stage B** — migrations **0001+0003+0004+0005 applicate in unica transazione atomica** al DB prod via `ssh root@178.104.27.55` → `docker exec psql` (porta 54321 chiusa dal firewall dall'esterno; SSH ok). Verificato: 25 tabelle, `leads` con 12 colonne, righe protette intatte (4 clients / 5 projects / 13 payments / 6 phases). `/quote/[token]` 500→404. Script riusabile: `scripts/push-phase10-migration.ts` (funziona solo dal server o con tunnel).
|
||||||
|
3. **Stage C** — commit `008a434`: tutto il modulo CRM da `phase10-wip` (schema, lead-service/validators, /admin/leads, modali, FollowUpWidget, sidebar). Build pulita, push fatto, deploy Coolify in corso a fine sessione.
|
||||||
|
|
||||||
|
### Da verificare a inizio prossima sessione
|
||||||
|
|
||||||
|
- [ ] Deploy Stage C live (chunk hash homepage cambiato rispetto a `797e433ab948586e-s.p.08e28id.o-okb.woff2`)
|
||||||
|
- [ ] Da browser autenticato: `/admin` (dashboard con FollowUpWidget), `/admin/leads`, `/admin/catalog`, `/admin/quotes/new` — tutte devono caricare
|
||||||
|
- [ ] Se tutto ok: `git branch -D phase10-wip` (lavoro ormai su main)
|
||||||
|
|
||||||
|
### Prossimi passi
|
||||||
|
|
||||||
|
- `/gsd-plan-phase 11` e `/gsd-plan-phase 12` — i planning folder non sono mai stati committati, vanno rigenerati (Phase 11: auto-provisioning con `winLead(leadId, quoteId)` idempotente keyed `SHA256(leadId+quoteId)`; Phase 12: Resend email + quote expiration)
|
||||||
|
- Eventuale cherry-pick di `5d75752` (sidebar "App shortcuts") se ancora desiderato — dangling, recuperabile da reflog
|
||||||
|
- **Regola da ora in poi**: ogni phase con migration → applicare al DB prod PRIMA del push del codice (le migration qui sono manuali, niente runner automatico)
|
||||||
|
|
||||||
|
### Hash utili
|
||||||
|
|
||||||
|
`5aa6614` (Stage A) · `008a434` (Stage C) · `phase10-wip` = `8e2752a` (originale recuperato) · `5d75752` (sidebar shortcuts, ancora dangling)
|
||||||
+31
-17
@@ -3,14 +3,14 @@ gsd_state_version: 1.0
|
|||||||
milestone: v2.0
|
milestone: v2.0
|
||||||
milestone_name: Business Operations Suite
|
milestone_name: Business Operations Suite
|
||||||
status: executing
|
status: executing
|
||||||
last_updated: "2026-06-11T07:40:00Z"
|
last_updated: "2026-06-11T19:00:00Z"
|
||||||
last_activity: 2026-06-11
|
last_activity: 2026-06-11
|
||||||
progress:
|
progress:
|
||||||
total_phases: 5
|
total_phases: 5
|
||||||
completed_phases: 1
|
completed_phases: 4
|
||||||
total_plans: 8
|
total_plans: 11
|
||||||
completed_plans: 5
|
completed_plans: 11
|
||||||
percent: 62.5
|
percent: 80
|
||||||
---
|
---
|
||||||
|
|
||||||
# Project State
|
# Project State
|
||||||
@@ -23,10 +23,24 @@ See: .planning/PROJECT.md (updated 2026-05-09)
|
|||||||
|
|
||||||
## Current Position
|
## Current Position
|
||||||
|
|
||||||
Phase: 09-quote-builder-client-acceptance (Plan 3 just completed)
|
Phase: 10-crm-pipeline-activity-logging (redo complete, deployed)
|
||||||
Plans: 07 (complete) | 08 (complete) | 09-01 (complete) | 09-02 (complete) | 09-03 (complete)
|
Plans: 07 (complete) | 08 (complete) | 09-01..03 (complete) | 10-01..03 (complete, redeployed 2026-06-11)
|
||||||
Status: Phase 7 executed ✓ | Phase 8 executed ✓ | Phase 9 Plan 1-3 executed ✓
|
Status: Phase 7 ✓ | Phase 8 ✓ | Phase 9 ✓ | Phase 10 ✓ (staged redo after rollback)
|
||||||
Last activity: 2026-06-11T07:40:00Z — Phase 9 Plan 3 execution complete (public quote page with rate limiting)
|
Last activity: 2026-06-11T19:00:00Z — Phase 10 staged redo deployed; production DB migrations 0001/0003/0004/0005 applied
|
||||||
|
|
||||||
|
## What Was Built (Phase 10 — CRM Pipeline & Activity Logging, redo)
|
||||||
|
|
||||||
|
### Root cause of the original Phase 10 production crash (resolved)
|
||||||
|
|
||||||
|
Production Postgres (Coolify container) had **no migrations applied after 0000** — `services`, `leads`, `offer_phases`, `offer_phase_services`, `quotes` did not exist. Phase 7/8/9 summaries said "migration pending connectivity" and were never followed up. Any page querying those tables 500'd: catalog (services), quote builder + /quote/[token] (quotes), and after Phase 10 deploy also dashboard (FollowUpWidget → leads). The Phase 10 rollback only masked the dashboard symptom.
|
||||||
|
|
||||||
|
**Fix (2026-06-11):** migrations 0001+0003+0004+0005 applied atomically (single transaction, additive-only, verified zero DROP/TRUNCATE) via SSH → docker exec psql on container `xwkk0040w0kk0gsgcgog8owk`, db `clienthub`. Protected rows verified intact post-migration (4 clients, 5 projects, 13 payments, 6 phases). `/quote/[token]` 500 → 404 (correct behavior) confirmed.
|
||||||
|
|
||||||
|
### Delivered (redo commits 5aa6614 + 008a434)
|
||||||
|
|
||||||
|
- **Stage A** (`5aa6614`): deps `@radix-ui/react-dialog`, `date-fns` + shared `ui/dialog.tsx`, `ui/form.tsx`
|
||||||
|
- **Stage B**: production DB schema aligned (see above) — script `scripts/push-phase10-migration.ts` for future reuse
|
||||||
|
- **Stage C** (`008a434`): schema.ts CRM tables (leads expansion, activities, reminders + relations), lead-service/lead-validators, `/admin/leads` list+detail+actions, LeadTable/LeadDetail/LeadForm, LogActivityModal, SendQuoteModal, FollowUpWidget on dashboard, sidebar link
|
||||||
|
|
||||||
## What Was Built (Phase 9 — Quote Builder UI & Public Pages)
|
## What Was Built (Phase 9 — Quote Builder UI & Public Pages)
|
||||||
|
|
||||||
@@ -174,18 +188,18 @@ Last activity: 2026-06-11T07:40:00Z — Phase 9 Plan 3 execution complete (publi
|
|||||||
|
|
||||||
## Session Continuity
|
## Session Continuity
|
||||||
|
|
||||||
Last session: 2026-06-11T07:40:00Z
|
Last session: 2026-06-11T19:00:00Z
|
||||||
Phase 9 Plan 3 execution complete (Public quote page with rate limiting and multistep wizard).
|
Phase 10 staged redo complete: production DB migrations applied (0001/0003/0004/0005), CRM module deployed.
|
||||||
All quote builder infrastructure in place: validators, service layer, admin UI, public page.
|
Dangling work recovered from `phase10-wip` branch (anchor of reflog commit 8e2752a — branch can be deleted once redo verified in production).
|
||||||
Ready for next plan: Phase 9 Plan 4 (Quote Items & Pricing Configuration).
|
Lesson recorded: migrations are applied manually in this project — every deploy touching schema MUST apply the migration to prod BEFORE pushing code.
|
||||||
|
|
||||||
## Operator Next Steps
|
## Operator Next Steps
|
||||||
|
|
||||||
### Immediate (Phase 9 Remaining Plans)
|
### Immediate
|
||||||
|
|
||||||
- Phase 9 Plan 4: Quote items configuration (admin can add/edit line items per phase)
|
- Verify in browser (authenticated): /admin (FollowUpWidget), /admin/leads, /admin/catalog, /admin/quotes/new
|
||||||
- Phase 9 Plan 5: Service picker and price overrides per line item
|
- Re-run `/gsd-plan-phase 11` and `/gsd-plan-phase 12` (planning folders never committed, must be regenerated)
|
||||||
- Phase 10: Email confirmation via Resend, quote expiration, sharing links
|
- Optionally cherry-pick sidebar "App shortcuts" dangling commit 5d75752 if still wanted
|
||||||
|
|
||||||
### Phase 10 (Concurrent Activities)
|
### Phase 10 (Concurrent Activities)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user