trading-platform/docs/99-analisis/PLAN-IMPLEMENTACION-CORRECCIONES.md
Adrian Flores Cortes 8f0235c096 [TASK-2026-02-06-ANALISIS-INTEGRAL-DOCUMENTACION] docs: Complete 6-phase documentation analysis
- FASE-0: Diagnostic audit of 500+ files, 33 findings cataloged (7P0/8P1/12P2/6P3)
- FASE-1: Resolved 7 P0 critical conflicts (ports, paths, dedup OQI-010/ADR-002, orphan schemas)
- FASE-2: Resolved 8 P1 issues (traces, README/CLAUDE.md, DEPENDENCY-GRAPH v2.0, DDL drift, stack versions, DoR/DoD)
- FASE-3: Resolved 12 P2 issues (archived tasks indexed, RNFs created, OQI-010 US/RF/ET, AGENTS v2.0)
- FASE-4: Purged 3 obsolete docs to _archive/, fixed MODELO-NEGOCIO.md broken ref
- FASE-5: Cross-layer validation (DDL→OQI 66%, OQI→BE 72%, BE→FE 78%, Inventories 95%)
- FASE-6: INFORME-FINAL, SA-INDEX (18 subagents), METADATA COMPLETED

27/33 findings resolved (82%), 6 P3 deferred to backlog.
18 new files created, 40+ modified, 4 archived.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 10:57:03 -06:00

547 lines
23 KiB
Markdown

---
id: "PLAN-IMPLEMENTACION-CORRECCIONES"
title: "PLAN DE IMPLEMENTACIÓN DE CORRECCIONES - Trading Platform"
type: "Documentation"
project: "trading-platform"
version: "1.0.0"
updated_date: "2026-01-04"
---
# PLAN DE IMPLEMENTACIÓN DE CORRECCIONES - Trading Platform
**Fecha:** 2025-12-06
**Versión:** 2.0.0 - COMPLETADO
**Basado en:** REPORTE-ANALISIS-REQUISITOS.md (ARCHIVADO → docs/_archive/)
**Estado:** ✅ TODAS LAS CORRECCIONES DE BASE DE DATOS IMPLEMENTADAS
---
## RESUMEN DEL PLAN
Este documento define el plan de implementación para corregir todas las inconsistencias identificadas en el análisis de requisitos. Incluye matriz de trazabilidad para validar cobertura completa.
### Métricas del Plan
| Métrica | Valor |
|---------|-------|
| Total de correcciones | 55 |
| Sprints estimados | 3 |
| Story Points totales | 47 SP |
| Épicas impactadas | 8 |
| ADRs a crear | 5 |
| Tablas a definir | 8 |
---
## FASE 0: DECISIONES ARQUITECTÓNICAS (Pre-Sprint)
**Objetivo:** Resolver conflictos críticos que bloquean desarrollo
**Duración:** 2-3 días de refinamiento con stakeholders
### 0.1 Decisiones Requeridas
| ID | Decisión | Opciones | Impacto | Responsable |
|----|----------|----------|---------|-------------|
| DEC-001 | Moneda principal | USD con conversión MXN / MXN con conversión USD | OQI-005, pricing, facturación | Product Owner |
| DEC-002 | Fusión OQI-004/OQI-008 | Fusionar en 1 épica / Delimitar responsabilidades | Arquitectura, roadmap | Tech Lead |
| DEC-003 | Schema de usuarios | `public.users` / `auth.users` separado | Todas las épicas | DBA |
| DEC-004 | Vector Database para LLM | pgvector / Pinecone / Weaviate | OQI-007, costos | Tech Lead |
| DEC-005 | Distribución PAMM | Mensual / Trimestral | OQI-004, finanzas | Product Owner |
### 0.2 Entregables Fase 0
```
□ Documento de decisiones firmado
□ ADR-002 creado (Estructura Monorepo)
□ Definición clara de límites OQI-004 vs OQI-008
□ Estrategia de moneda documentada
```
---
## FASE 1: CORRECCIONES CRÍTICAS (Sprint 1)
**Objetivo:** Eliminar bloqueos y dependencias circulares
**Story Points:** 18 SP
### 1.1 Resolver Dependencia Circular OQI-003 ↔ OQI-006
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| CIR-001 | Definir interfaz `ISignalProvider` abstracta | 1 | ET-TRD-002-api.md |
| CIR-002 | Crear `MockSignalProvider` para desarrollo OQI-003 | 1 | ET-TRD-002-api.md |
| CIR-003 | Documentar contrato de datos entre módulos | 1 | ARQUITECTURA-UNIFICADA.md |
| CIR-004 | Actualizar diagrama de dependencias | 0.5 | docs/01-arquitectura/ |
**Trazabilidad:** Corrige TRD-001, DEP-001
### 1.2 Unificar Definición de Wallets
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| WAL-001 | Definir schema único `financial.wallets` | 2 | ET-PAY-003-database.md |
| WAL-002 | Eliminar wallet de OQI-004 (usar referencia) | 0.5 | ET-INV-003-database.md |
| WAL-003 | Eliminar wallet de OQI-008 (usar referencia) | 0.5 | ET-PTF-003-database.md |
| WAL-004 | Documentar extensiones por módulo | 1 | ARQUITECTURA-UNIFICADA.md |
| WAL-005 | Definir tabla `financial.wallet_audit_log` | 1 | ET-PAY-003-database.md |
**Trazabilidad:** Corrige PAY-002, duplicación wallets
### 1.3 Resolver Conflicto de Moneda
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| MON-001 | Definir moneda principal según DEC-001 | 0.5 | ET-PAY-001-requirements.md |
| MON-002 | Actualizar planes de pricing | 0.5 | ET-PAY-001-requirements.md |
| MON-003 | Documentar estrategia multi-currency | 1 | ET-PAY-002-api.md |
| MON-004 | Definir tabla `currency_exchange_rates` | 1 | ET-PAY-003-database.md |
**Trazabilidad:** Corrige PAY-001
### 1.4 Delimitar OQI-004 vs OQI-008
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| DUP-001 | Documentar responsabilidades exclusivas OQI-004 | 1 | OQI-004/README.md |
| DUP-002 | Documentar responsabilidades exclusivas OQI-008 | 1 | OQI-008/README.md |
| DUP-003 | Unificar perfiles de riesgo | 1 | ET-INV-001-requirements.md |
| DUP-004 | Definir cuestionario completo (15 preguntas) | 1 | ET-PTF-001-requirements.md |
| DUP-005 | Eliminar componentes duplicados de frontend | 1 | ET-PTF-004-frontend.md |
**Trazabilidad:** Corrige INV-005, PTF-001, PTF-002, DEP-002
### 1.5 Crear ADRs Faltantes
| Tarea | Descripción | SP | Archivo a Crear |
|-------|-------------|----|--------------------|
| ADR-001 | Crear ADR-002: Estructura Monorepo | 1 | docs/97-adr/ADR-002-monorepo.md |
| ADR-002 | Crear ADR-003: Estrategia de Testing | 1 | docs/97-adr/ADR-003-testing.md |
**Trazabilidad:** Corrige gaps de arquitectura
---
## FASE 2: CORRECCIONES ALTAS (Sprint 2)
**Objetivo:** Completar schemas y especificaciones técnicas
**Story Points:** 17 SP
### 2.1 Completar Tablas Faltantes - Education
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| EDU-T01 | Definir schema `education.user_gamification_profile` | 1 | ET-EDU-001-database.md |
| EDU-T02 | Definir schema `education.user_activity_log` | 1 | ET-EDU-001-database.md |
| EDU-T03 | Definir schema `education.course_reviews` | 0.5 | ET-EDU-001-database.md |
| EDU-T04 | Definir schema `education.certificates` | 0.5 | ET-EDU-001-database.md |
| EDU-T05 | Documentar algoritmo de progreso | 0.5 | ET-EDU-002-api.md |
| EDU-T06 | Documentar workflow de certificados | 0.5 | ET-EDU-002-api.md |
**Trazabilidad:** Corrige EDU-001, EDU-002, EDU-003, EDU-005, EDU-006
### 2.2 Completar Tablas Faltantes - LLM
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| LLM-T01 | Definir schema `llm.user_preferences` | 1 | ET-LLM-003-database.md |
| LLM-T02 | Definir schema `llm.user_memory` | 1 | ET-LLM-003-database.md |
| LLM-T03 | Especificar Vector Database (según DEC-004) | 1 | ET-LLM-001-requirements.md |
| LLM-T04 | Documentar RAG pipeline | 1 | ET-LLM-002-api.md |
| LLM-T05 | Definir límites de contexto | 0.5 | ET-LLM-002-api.md |
| LLM-T06 | Documentar modo proactivo | 0.5 | ET-LLM-002-api.md |
**Trazabilidad:** Corrige LLM-001, LLM-002, LLM-003, LLM-004
### 2.3 Completar Trading Engine
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| TRD-T01 | Especificar algoritmo Paper Engine | 2 | ET-TRD-002-api.md |
| TRD-T02 | Agregar 'partially_filled' a ENUM | 0.5 | ET-TRD-003-database.md |
| TRD-T03 | Definir ML overlay endpoints | 1 | ET-TRD-002-api.md |
| TRD-T04 | Estandarizar latency simulation | 0.5 | ET-TRD-001-requirements.md |
**Trazabilidad:** Corrige TRD-002, TRD-003, TRD-004, TRD-006
### 2.4 Completar Payments
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| PAY-T01 | Documentar Stripe webhook handlers | 1 | ET-PAY-002-api.md |
| PAY-T02 | Especificar 6 historias faltantes | 2 | ET-PAY-001-requirements.md |
| PAY-T03 | Documentar refund policy técnicamente | 0.5 | ET-PAY-002-api.md |
**Trazabilidad:** Corrige PAY-003, PAY-004, PAY-005
### 2.5 Estandarización Global
| Tarea | Descripción | SP | Archivos a Modificar |
|-------|-------------|----|--------------------|
| STD-001 | Estandarizar TIMESTAMPTZ en todos los schemas | 1 | Todos los ET-*-database.md |
| STD-002 | Definir schema `auth` explícitamente | 0.5 | ET-AUTH-003-database.md |
| STD-003 | Corregir referencias a users (auth.users) | 0.5 | Todos los ET-*-database.md |
**Trazabilidad:** Corrige AUTH-001, DB-001, DB-002
---
## FASE 3: CORRECCIONES MEDIAS (Sprint 3)
**Objetivo:** Completar documentación y detalles técnicos
**Story Points:** 12 SP
### 3.1 Completar Especificaciones Auth
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| AUTH-T01 | Documentar endpoint resend-verification | 0.5 | ET-AUTH-002-api.md |
| AUTH-T02 | Documentar endpoint backup-codes | 0.5 | ET-AUTH-002-api.md |
| AUTH-T03 | Especificar TTL de tempToken | 0.5 | ET-AUTH-003-database.md |
| AUTH-T04 | Completar schema login_attempts | 0.5 | ET-AUTH-003-database.md |
| AUTH-T05 | Definir tabla rate_limiting_config | 0.5 | ET-AUTH-003-database.md |
**Trazabilidad:** Corrige AUTH-002, AUTH-003, AUTH-005, AUTH-006
### 3.2 Índices de Performance
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| IDX-001 | Definir índices para auth (login_attempts, sessions) | 1 | ET-AUTH-003-database.md |
| IDX-002 | Definir índices para education (enrollments, progress) | 1 | ET-EDU-001-database.md |
| IDX-003 | Definir índices para trading (positions, orders) | 1 | ET-TRD-003-database.md |
| IDX-004 | Definir índices para financial (transactions, wallets) | 1 | ET-PAY-003-database.md |
**Trazabilidad:** Corrige AUTH-008, DB-003
### 3.3 Completar Investment/Portfolio
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| INV-T01 | Definir fórmula de cálculo de rendimiento | 0.5 | ET-INV-002-api.md |
| INV-T02 | Documentar withdrawal rules completas | 0.5 | ET-INV-003-database.md |
| INV-T03 | Especificar Monte Carlo simulation | 1 | ET-PTF-002-api.md |
| INV-T04 | Definir rebalancing triggers | 0.5 | ET-PTF-003-database.md |
**Trazabilidad:** Corrige INV-003, INV-004, PTF-003, PTF-004
### 3.4 Completar ML Signals
| Tarea | Descripción | SP | Archivo a Modificar |
|-------|-------------|----|--------------------|
| ML-T01 | Documentar actualización actual_outcome | 0.5 | ET-ML-002-api.md |
| ML-T02 | Especificar feature normalization | 0.5 | ET-ML-001-requirements.md |
| ML-T03 | Definir model versioning strategy | 0.5 | ET-ML-003-database.md |
| ML-T04 | Calibrar confidence thresholds | 0.5 | ET-ML-002-api.md |
**Trazabilidad:** Corrige ML-001, ML-002, ML-004, ML-006
### 3.5 Crear ADRs Restantes
| Tarea | Descripción | SP | Archivo a Crear |
|-------|-------------|----|--------------------|
| ADR-T01 | Crear ADR-004: DevOps y CI/CD | 1 | docs/97-adr/ADR-004-devops.md |
| ADR-T02 | Crear ADR-005: Estrategia de Caching | 1 | docs/97-adr/ADR-005-caching.md |
| ADR-T03 | Crear ADR-006: Seguridad y Autenticación | 1 | docs/97-adr/ADR-006-security.md |
**Trazabilidad:** Corrige gaps de arquitectura
---
## MATRIZ DE TRAZABILIDAD COMPLETA
### Hallazgos vs Correcciones
| ID Hallazgo | Severidad | Corregido Por | Sprint |
|-------------|-----------|---------------|--------|
| AUTH-001 | ALTA | STD-001 | 2 |
| AUTH-002 | MEDIA | AUTH-T01, AUTH-T02 | 3 |
| AUTH-003 | MEDIA | AUTH-T03 | 3 |
| AUTH-004 | BAJA | - (backlog) | - |
| AUTH-005 | ALTA | AUTH-T04 | 3 |
| AUTH-006 | MEDIA | AUTH-T05 | 3 |
| AUTH-007 | BAJA | - (backlog) | - |
| AUTH-008 | MEDIA | IDX-001 | 3 |
| EDU-001 | CRÍTICA | EDU-T01 | 2 |
| EDU-002 | CRÍTICA | EDU-T02 | 2 |
| EDU-003 | ALTA | EDU-T03 | 2 |
| EDU-004 | ALTA | - (dev phase) | - |
| EDU-005 | MEDIA | EDU-T05 | 2 |
| EDU-006 | MEDIA | EDU-T06 | 2 |
| EDU-007 | BAJA | - (backlog) | - |
| TRD-001 | CRÍTICA | CIR-001 a CIR-004 | 1 |
| TRD-002 | CRÍTICA | TRD-T01 | 2 |
| TRD-003 | ALTA | TRD-T03 | 2 |
| TRD-004 | ALTA | TRD-T02 | 2 |
| TRD-005 | MEDIA | - (backlog) | - |
| TRD-006 | MEDIA | TRD-T04 | 2 |
| TRD-007 | BAJA | - (backlog) | - |
| INV-001 | ALTA | DEC-005 | 0 |
| INV-002 | ALTA | MON-001 | 1 |
| INV-003 | MEDIA | INV-T01 | 3 |
| INV-004 | MEDIA | INV-T02 | 3 |
| INV-005 | CRÍTICA | DUP-001 a DUP-005 | 1 |
| INV-006 | BAJA | - (backlog) | - |
| PAY-001 | CRÍTICA | MON-001 a MON-004 | 1 |
| PAY-002 | CRÍTICA | WAL-001 a WAL-005 | 1 |
| PAY-003 | ALTA | PAY-T02 | 2 |
| PAY-004 | ALTA | PAY-T01 | 2 |
| PAY-005 | MEDIA | PAY-T03 | 2 |
| PAY-006 | MEDIA | - (backlog) | - |
| PAY-007 | BAJA | - (backlog) | - |
| ML-001 | ALTA | ML-T01 | 3 |
| ML-002 | ALTA | ML-T02 | 3 |
| ML-003 | MEDIA | - (backlog) | - |
| ML-004 | MEDIA | ML-T03 | 3 |
| ML-005 | BAJA | - (backlog) | - |
| ML-006 | MEDIA | ML-T04 | 3 |
| LLM-001 | CRÍTICA | LLM-T01, LLM-T02 | 2 |
| LLM-002 | CRÍTICA | LLM-T03, LLM-T04 | 2 |
| LLM-003 | ALTA | LLM-T06 | 2 |
| LLM-004 | ALTA | LLM-T05 | 2 |
| LLM-005 | MEDIA | - (backlog) | - |
| LLM-006 | BAJA | - (backlog) | - |
| PTF-001 | CRÍTICA | DUP-001 a DUP-005 | 1 |
| PTF-002 | ALTA | DUP-004 | 1 |
| PTF-003 | ALTA | INV-T03 | 3 |
| PTF-004 | MEDIA | INV-T04 | 3 |
| PTF-005 | MEDIA | - (backlog) | - |
| PTF-006 | BAJA | - (backlog) | - |
| DB-001 | CRÍTICA | STD-003 | 2 |
| DB-002 | ALTA | STD-002 | 2 |
| DB-003 | ALTA | IDX-001 a IDX-004 | 3 |
| DB-004 | MEDIA | - (backlog) | - |
| DB-005 | MEDIA | - (backlog) | - |
| DEP-001 | CRÍTICA | CIR-001 a CIR-004 | 1 |
| DEP-002 | CRÍTICA | DUP-001 a DUP-005 | 1 |
| DEP-003 | UNDEFINED | LLM-T04 (parcial) | 2 |
| DEP-004 | MISSING | - (ver sección 8) | - |
| DEP-005 | MISSING | - (ver sección 8) | - |
---
## VALIDACIÓN DE COBERTURA
### Análisis de Gaps
#### Hallazgos NO Cubiertos en Plan (Severidad BAJA - Backlog)
| ID | Descripción | Justificación |
|----|-------------|---------------|
| AUTH-004 | OAuth providers sin prioridad | No bloquea, definir en implementación |
| AUTH-007 | Diagrama MFA incompleto | Documentación secundaria |
| EDU-007 | Prerequisitos sin validación | Feature enhancement |
| TRD-005 | Slippage sin parámetros | Definir en testing |
| TRD-007 | Librería de gráficos | Ya está en stack (Lightweight Charts) |
| INV-006 | Reportes sin formato | Definir en frontend |
| PAY-006 | CFDI sin detalles | Fase 2 de pagos (México) |
| PAY-007 | Templates de notificación | Definir en frontend |
| ML-003 | AMDDetector | Feature futura |
| ML-005 | Backtesting framework | Post-MVP |
| LLM-005 | Datos de mercado | Integración con OQI-003 |
| LLM-006 | UI chat | Definir en frontend |
| PTF-005 | Benchmark comparison | Feature enhancement |
| PTF-006 | Goal tracking | Feature enhancement |
| DB-004 | FK inconsistentes | Validar en migración |
| DB-005 | ENUMs duplicados | Refactor post-MVP |
#### Dependencias NO Cubiertas Completamente
| ID | Problema | Corrección Propuesta |
|----|----------|---------------------|
| DEP-003 | LLM necesita datos de todos los módulos | Agregar tarea de definición de interfaces de datos para LLM |
| DEP-004 | Cursos premium sin pagos documentado | Agregar integración OQI-002 → OQI-005 |
| DEP-005 | Trading sin billing documentado | Agregar integración OQI-003 → OQI-005 |
---
## CORRECCIONES ADICIONALES IDENTIFICADAS
### 8.1 Relaciones Faltantes Detectadas
| ID | Relación | Corrección | Sprint |
|----|----------|------------|--------|
| REL-001 | OQI-002 → OQI-005 (cursos premium) | Documentar en ET-EDU-001-requirements.md | 2 |
| REL-002 | OQI-003 → OQI-005 (trading billing) | Documentar en ET-TRD-001-requirements.md | 2 |
| REL-003 | OQI-007 → OQI-001 (contexto de usuario) | Documentar en ET-LLM-001-requirements.md | 2 |
| REL-004 | OQI-007 → OQI-002 (contenido educativo) | Documentar en ET-LLM-001-requirements.md | 2 |
| REL-005 | OQI-007 → OQI-003 (datos de trading) | Documentar en ET-LLM-001-requirements.md | 2 |
| REL-006 | OQI-007 → OQI-004 (datos de inversión) | Documentar en ET-LLM-001-requirements.md | 2 |
| REL-007 | OQI-001 → OQI-005 (subscription status) | Documentar en ET-AUTH-001-requirements.md | 2 |
### 8.2 Objetos Dependientes No Especificados
| Objeto | Módulo Origen | Módulos que lo Usan | Corrección |
|--------|---------------|---------------------|------------|
| `user_id` FK | OQI-001 | TODOS | Definir como `auth.users.id` universalmente |
| `subscription_status` | OQI-005 | OQI-001, OQI-002, OQI-003 | Crear ENUM compartido |
| `risk_profile` | OQI-004/008 | OQI-003, OQI-006 | Unificar en schema compartido |
| `wallet_id` | OQI-005 | OQI-004, OQI-008 | Ya cubierto en WAL-001 |
| `signal_data` | OQI-006 | OQI-003, OQI-007 | Definir interfaz en CIR-001 |
| `prediction_result` | OQI-006 | OQI-003, OQI-007, OQI-008 | Documentar estructura |
### 8.3 Componentes Frontend Duplicados
| Componente | OQI-004 | OQI-008 | Acción |
|------------|---------|---------|--------|
| PerformanceChart | Sí | AllocationChart | Unificar en shared components |
| TransactionList | Sí | - | Reusar |
| InvestmentDashboard | Sí | PortfolioDashboard | Fusionar |
| GoalTracker | - | Sí | Mantener en OQI-008 |
### 8.4 Types/Interfaces Compartidas No Definidas
| Interface | Módulos | Corrección | Archivo |
|-----------|---------|------------|---------|
| `IUser` | TODOS | Definir en shared types | types/user.ts |
| `ISignal` | OQI-003, OQI-006, OQI-007 | Definir en shared types | types/signal.ts |
| `IWallet` | OQI-004, OQI-005, OQI-008 | Definir en shared types | types/wallet.ts |
| `IRiskProfile` | OQI-004, OQI-006, OQI-008 | Definir en shared types | types/risk.ts |
| `ISubscription` | OQI-001, OQI-002, OQI-005 | Definir en shared types | types/subscription.ts |
| `IPrediction` | OQI-003, OQI-006, OQI-007 | Definir en shared types | types/prediction.ts |
---
## TAREAS ADICIONALES (Agregadas post-validación)
### Sprint 2 - Adiciones
| Tarea | Descripción | SP | Archivo |
|-------|-------------|----|--------------------|
| REL-T01 | Documentar integración OQI-002 → OQI-005 | 0.5 | ET-EDU-001-requirements.md |
| REL-T02 | Documentar integración OQI-003 → OQI-005 | 0.5 | ET-TRD-001-requirements.md |
| REL-T03 | Documentar integraciones OQI-007 → ALL | 1 | ET-LLM-001-requirements.md |
| REL-T04 | Documentar OQI-001 → OQI-005 (subs check) | 0.5 | ET-AUTH-001-requirements.md |
| TYP-T01 | Crear types/shared/ con interfaces comunes | 2 | apps/frontend/src/types/shared/ |
| TYP-T02 | Documentar ubicación de shared types | 0.5 | ARQUITECTURA-UNIFICADA.md |
| OBJ-T01 | Definir `subscription_status` ENUM compartido | 0.5 | ET-PAY-003-database.md |
| OBJ-T02 | Documentar estructura `prediction_result` | 0.5 | ET-ML-002-api.md |
**SP Adicionales Sprint 2:** 6 SP
**Nuevo Total Sprint 2:** 23 SP
---
## RESUMEN FINAL DEL PLAN
### Por Sprint
| Sprint | Objetivo | SP Original | SP Adicional | SP Total |
|--------|----------|-------------|--------------|----------|
| Fase 0 | Decisiones arquitectónicas | 0 | 0 | 0 |
| Sprint 1 | Correcciones críticas | 18 | 0 | 18 |
| Sprint 2 | Correcciones altas | 17 | 6 | 23 |
| Sprint 3 | Correcciones medias | 12 | 0 | 12 |
| **TOTAL** | | **47** | **6** | **53** |
### Cobertura de Hallazgos
| Severidad | Total | Cubiertos | Backlog | % Cobertura |
|-----------|-------|-----------|---------|-------------|
| CRÍTICA | 12 | 12 | 0 | 100% |
| ALTA | 18 | 18 | 0 | 100% |
| MEDIA | 25 | 18 | 7 | 72% |
| BAJA | 10 | 0 | 10 | 0% |
| **TOTAL** | **65** | **48** | **17** | **74%** |
### Objetos Adicionales Identificados
| Tipo | Cantidad | Estado |
|------|----------|--------|
| Relaciones faltantes | 7 | Agregadas al plan |
| Objetos compartidos | 6 | Agregados al plan |
| Interfaces TypeScript | 6 | Agregadas al plan |
| Componentes duplicados | 4 | Documentados para refactor |
---
## DIAGRAMA DE DEPENDENCIAS CORREGIDO
```
┌─────────────────┐
│ OQI-001 │
│ (Auth) │
│ ┌─────────┐ │
│ │auth.users│ │
└───┴────┬────┴───┘
│ user_id FK (universal)
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ OQI-002 │ │ OQI-005 │ │ OQI-003 │
│ (Education) │ │ (Payments) │ │ (Trading) │
│ │◄───┤ ├───►│ │
│ premium_access│ │ subscription_ │ │ billing_check │
└───────┬───────┘ │ status ENUM │ └───────┬───────┘
│ │ │ │
│ │ financial. │ │
│ │ wallets │◄───────────┤
│ └───────┬───────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ OQI-004 │ │
│ │ (Investment) │◄───────────┤
│ │ PAMM only │ │
│ │ (usa wallet) │ │
│ └───────┬───────┘ │
│ │ │
│ ┌───────┴───────┐ ┌───────┴───────┐
│ │ OQI-008 │ │ OQI-006 │
│ │ (Portfolio) │◄───┤ (ML Signals) │
│ │ Manager only │ │ ISignalProvider│
│ │ (usa wallet) │ │ interface │
│ └───────┬───────┘ └───────┬───────┘
│ │ │
└────────────────────┼────────────────────┘
┌─────────────────┐
│ OQI-007 │
│ (LLM Agent) │
│ Consume ALL │
│ via interfaces│
└─────────────────┘
```
---
## CHECKLIST DE VALIDACIÓN
### Pre-Sprint 1
- [x] Decisión DEC-001 (moneda) documentada ✅
- [x] Decisión DEC-002 (OQI-004/008) documentada ✅
- [x] Decisión DEC-003 (schema users) documentada ✅
- [x] Decisión DEC-004 (vector DB) documentada ✅
- [x] Decisión DEC-005 (distribución PAMM) documentada ✅
### Post-Sprint 1 - BASE DE DATOS ✅
- [x] Dependencia circular resuelta (trading.signals como interfaz)
- [x] Wallets unificadas (financial.wallets)
- [x] Moneda definida (USD primario, currency_exchange_rates)
- [x] OQI-004/008 delimitadas (PAMM vs Portfolio separados)
- [x] ADR-002 a ADR-007 creados
### Correcciones DDL Implementadas (2025-12-06) ✅
- [x] Todas las tablas faltantes definidas (67 tablas en 8 schemas)
- [x] trading.paper_balances creado
- [x] trading functions (initialize/reset/update balance)
- [x] financial.customers creado
- [x] financial.payment_methods creado
- [x] investment.withdrawal_requests creado
- [x] investment.daily_performance creado
- [x] auth.phone_channel enum agregado
- [x] auth.users.backup_codes agregado
- [x] trading.positions campos parciales agregados
- [x] Migrations legacy eliminados (política Carga Limpia)
### Pendiente (Sprints siguientes)
- [ ] Trading engine especificado (documentación API)
- [ ] LLM pipeline documentado
- [ ] Types compartidos definidos (TypeScript)
- [ ] Índices de performance validados en producción
- [ ] Endpoints auth completados (implementación)
---
*Plan generado por Requirements-Analyst Agent*
*Validado contra REPORTE-ANALISIS-REQUISITOS.md (ARCHIVADO → docs/_archive/)*
*Trading Platform - Trading Platform*