Comprehensive analysis of 101 DDL tables across 11 schemas: - Phase 1-2: Schema validation, 37 gaps cataloged (3 resolved) - Phase 3: Integrity audit (80 FKs, 89 CHECKs, 17 issues: 2 CRIT/5 HIGH) - Phase 4: DDL-Backend mapping (84% interfaces, 75% services, 61% controllers) - Phase 5: Documentation purge catalog (201 files analyzed) - Phase 6: Remediation plan (4 sprints, 204h) Key finding: Backend uses raw SQL + pg Pool (NOT TypeORM). 13 deliverables + updated inventories to v2.0.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
715 lines
28 KiB
YAML
715 lines
28 KiB
YAML
# ═══════════════════════════════════════════════════════════════════
|
|
# PLAN-MAESTRO-REMEDIACION.yml
|
|
# Trading Platform - Plan de Remediacion del Modelado de Base de Datos
|
|
# ═══════════════════════════════════════════════════════════════════
|
|
|
|
version: "1.0.0"
|
|
fecha: "2026-02-05"
|
|
tarea: "TASK-2026-02-05-ANALISIS-VALIDACION-MODELADO-BD"
|
|
fase: "FASE-6: Plan Maestro de Remediacion"
|
|
agente: "Claude Code (Opus 4.6)"
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# RESUMEN EJECUTIVO
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
resumen_ejecutivo:
|
|
descripcion: |
|
|
Plan de remediacion basado en analisis integral de 101 tablas DDL, 11 schemas,
|
|
y coherencia multicapa (DDL-Backend-Frontend). Priorizado por impacto funcional
|
|
y dependencias tecnicas. Organizado en 4 sprints ejecutables.
|
|
|
|
estado_actual:
|
|
tablas_ddl: 101
|
|
schemas: 11
|
|
coherencia_ddl_inventario: "100%" # RESUELTO en esta tarea
|
|
coherencia_ddl_backend_entities: "68%"
|
|
coherencia_ddl_backend_services: "52%"
|
|
coherencia_ddl_backend_controllers: "45%"
|
|
coherencia_global: "54%"
|
|
gaps_totales: 37
|
|
gaps_resueltos: 3
|
|
gaps_pendientes: 34
|
|
fk_errors: 0 # RESUELTO en esta tarea
|
|
enum_conflicts: 3
|
|
entities_faltantes: 31
|
|
|
|
target:
|
|
coherencia_ddl_backend_entities: "95%"
|
|
coherencia_ddl_backend_services: "85%"
|
|
coherencia_global: "90%"
|
|
gaps_pendientes: 0
|
|
enum_conflicts: 0
|
|
entities_faltantes: 0
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# MATRIZ IMPACTO vs ESFUERZO
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
matriz_impacto_esfuerzo:
|
|
|
|
# CUADRANTE 1: Alto Impacto + Bajo Esfuerzo → HACER PRIMERO
|
|
quick_wins:
|
|
- gap: "GAP-ENUM-P1-003"
|
|
accion: "Migrar 3 tablas a public.trading_timeframe"
|
|
impacto: "Elimina conflicto timeframe"
|
|
esfuerzo: "2h"
|
|
riesgo: "Bajo (non-breaking, valores compatibles)"
|
|
|
|
- gap: "GAP-REL-P1-002"
|
|
accion: "Agregar wallet_id FK en trading.bots"
|
|
impacto: "Vincula bots con wallets"
|
|
esfuerzo: "1h"
|
|
riesgo: "Bajo"
|
|
|
|
- gap: "GAP-REL-P1-003"
|
|
accion: "Agregar symbol_id FK en market_data.tickers"
|
|
impacto: "Vincula catalogos"
|
|
esfuerzo: "1h"
|
|
riesgo: "Bajo"
|
|
|
|
- gap: "GAP-NAME-P2-001"
|
|
accion: "Estandarizar asset_type -> asset_class"
|
|
impacto: "Consistencia nomenclatura"
|
|
esfuerzo: "1h"
|
|
riesgo: "Bajo"
|
|
|
|
- gap: "GAP-PURGE-P2-001"
|
|
accion: "Purgar docs obsoletas"
|
|
impacto: "Limpieza documental"
|
|
esfuerzo: "1h"
|
|
riesgo: "Bajo"
|
|
|
|
# CUADRANTE 2: Alto Impacto + Alto Esfuerzo → PLANIFICAR
|
|
strategic:
|
|
- gap: "GAP-BE-P2-001"
|
|
accion: "Crear 31 entities backend"
|
|
impacto: "68% -> 95% entity coverage"
|
|
esfuerzo: "62h"
|
|
riesgo: "Medio (volumen alto)"
|
|
|
|
- gap: "GAP-SVC-P2-001"
|
|
accion: "Crear audit services (7 tablas)"
|
|
impacto: "0% -> 100% audit coherencia"
|
|
esfuerzo: "32h"
|
|
riesgo: "Medio"
|
|
|
|
- gap: "GAP-DUP-P1-001"
|
|
accion: "Consolidar symbols/tickers"
|
|
impacto: "Elimina duplicacion catalogo master"
|
|
esfuerzo: "12h"
|
|
riesgo: "Alto (afecta ml, market_data, data-service)"
|
|
|
|
# CUADRANTE 3: Bajo Impacto + Bajo Esfuerzo → OPORTUNISTA
|
|
oportunista:
|
|
- gap: "GAP-ENUM-P1-002"
|
|
accion: "Crear public.risk_profile"
|
|
esfuerzo: "2h"
|
|
nota: "Opcional, valores ya identicos"
|
|
|
|
- gap: "GAP-IDX-P3-001"
|
|
accion: "Agregar indices compuestos"
|
|
esfuerzo: "2h"
|
|
|
|
- gap: "GAP-ORPHAN-P3-001"
|
|
accion: "Documentar market_data.staging"
|
|
esfuerzo: "0.5h"
|
|
|
|
# CUADRANTE 4: Bajo Impacto + Alto Esfuerzo → DIFERIR
|
|
diferir:
|
|
- gap: "GAP-SVC-P2-002"
|
|
accion: "OHLCV service completo"
|
|
esfuerzo: "16h"
|
|
nota: "Solo relevante cuando market_data pipeline este activo"
|
|
|
|
- gap: "GAP-SVC-P2-003"
|
|
accion: "Currency exchange service"
|
|
esfuerzo: "16h"
|
|
nota: "Solo relevante cuando se habilite multi-moneda"
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# SPRINTS DE REMEDIACION
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
sprints:
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# SPRINT 1: Quick Wins DDL + Enum Resolution (5 dias)
|
|
# ═══════════════════════════════════════════════════════════════
|
|
sprint_1:
|
|
nombre: "Quick Wins DDL + Enum Resolution"
|
|
duracion: "5 dias"
|
|
esfuerzo_total: "24h"
|
|
prioridad: CRITICA
|
|
prerequisitos: []
|
|
|
|
objetivo: |
|
|
Resolver todos los conflictos DDL, enums, y FKs faltantes.
|
|
Ejecutar purga documental catalogada.
|
|
|
|
tareas:
|
|
- id: "S1-T1"
|
|
nombre: "Ejecutar migracion timeframe enum"
|
|
gap_ref: "GAP-ENUM-P1-003"
|
|
tipo: DDL
|
|
esfuerzo: "2h"
|
|
dependencias: []
|
|
sql: |
|
|
-- 3 tablas: trading.bots, trading.signals, trading.drawing_tools
|
|
-- Usar patron ADD COLUMN new -> UPDATE -> DROP old -> RENAME new
|
|
validacion: "Recrear BD en WSL, verificar tablas se crean correctamente"
|
|
|
|
- id: "S1-T2"
|
|
nombre: "Agregar FK trading.bots -> financial.wallets"
|
|
gap_ref: "GAP-REL-P1-002"
|
|
tipo: DDL
|
|
esfuerzo: "1h"
|
|
dependencias: []
|
|
sql: "ALTER TABLE trading.bots ADD COLUMN wallet_id UUID REFERENCES financial.wallets(id);"
|
|
validacion: "Verificar FK se crea, no rompe datos existentes"
|
|
|
|
- id: "S1-T3"
|
|
nombre: "Agregar FK market_data.tickers -> trading.symbols"
|
|
gap_ref: "GAP-REL-P1-003"
|
|
tipo: DDL
|
|
esfuerzo: "1h"
|
|
dependencias: []
|
|
sql: "ALTER TABLE market_data.tickers ADD COLUMN symbol_id UUID REFERENCES trading.symbols(id);"
|
|
validacion: "Verificar FK se crea"
|
|
|
|
- id: "S1-T4"
|
|
nombre: "Agregar FK investment.accounts -> financial.wallets"
|
|
gap_ref: "GAP-REL-P1-001"
|
|
tipo: DDL
|
|
esfuerzo: "2h"
|
|
dependencias: []
|
|
sql: |
|
|
-- Verificar si wallet_id ya existe en DDL actual
|
|
-- Si no: ALTER TABLE investment.accounts ADD COLUMN wallet_id UUID REFERENCES financial.wallets(id);
|
|
validacion: "Verificar FK funciona, evaluar ON DELETE behavior"
|
|
|
|
- id: "S1-T5"
|
|
nombre: "Documentar decision transaction_type"
|
|
gap_ref: "GAP-ENUM-P1-001"
|
|
tipo: DOCUMENTACION
|
|
esfuerzo: "2h"
|
|
dependencias: []
|
|
accion: |
|
|
Crear ADR documentando la decision de MANTENER transaction_type separados:
|
|
- financial.transaction_type (9 valores, wallets)
|
|
- investment.transaction_type (3 valores, cuentas inversion)
|
|
Razon: valores diferentes, renombrar es breaking change.
|
|
Enforcement: calificacion de schema estricta en backend.
|
|
|
|
- id: "S1-T6"
|
|
nombre: "Estandarizar asset_type -> asset_class"
|
|
gap_ref: "GAP-NAME-P2-001"
|
|
tipo: DDL
|
|
esfuerzo: "1h"
|
|
dependencias: []
|
|
|
|
- id: "S1-T7"
|
|
nombre: "Documentar feature_flags schema"
|
|
gap_ref: "GAP-DDL-P0-002"
|
|
tipo: DOCUMENTACION
|
|
esfuerzo: "3h"
|
|
dependencias: []
|
|
accion: |
|
|
1. Crear ET (Especificacion Tecnica) en docs/02-definicion-modulos/
|
|
2. Agregar a CLAUDE.md del proyecto (seccion schemas)
|
|
3. Documentar 3 tablas: flags, user_flags, evaluations
|
|
4. Documentar 2 enums: flag_status, rollout_stage
|
|
5. Documentar funcion evaluate_flag()
|
|
|
|
- id: "S1-T8"
|
|
nombre: "Ejecutar purga documental"
|
|
gap_ref: "GAP-PURGE-P2-001, GAP-PURGE-P2-002"
|
|
tipo: OPERACIONES
|
|
esfuerzo: "3h"
|
|
dependencias: []
|
|
accion: |
|
|
Segun PURGA-DOCUMENTAL.yml:
|
|
1. Eliminar directorio vacio 2026-01-28/
|
|
2. Archivar 4 carpetas de tareas (2026-01-25/, 2026-01-27/MASTER-ANALYSIS, 2026-02-03/DDL-VALIDATION)
|
|
3. Archivar 2 coherence baselines (2026-01-28)
|
|
4. Actualizar _INDEX.yml
|
|
|
|
- id: "S1-T9"
|
|
nombre: "Documentar tablas faltantes en inventarios"
|
|
gap_ref: "GAP-INV-P1-001 a P1-005"
|
|
tipo: DOCUMENTACION
|
|
esfuerzo: "6h"
|
|
dependencias: []
|
|
accion: |
|
|
Las 19 tablas ya estan en DATABASE_INVENTORY v2.0.0.
|
|
Crear definiciones (ET) para cada grupo:
|
|
- education: 7 tablas → ET en OQI-002
|
|
- trading: 2 tablas → ET en OQI-003
|
|
- financial: 2 tablas → ET en OQI-005
|
|
- ml: 2 tablas → ET en OQI-006
|
|
- auth/inv/llm/port/mkt: 6 tablas → ETs en modulos respectivos
|
|
|
|
- id: "S1-T10"
|
|
nombre: "Recrear BD en WSL para validar cambios DDL"
|
|
tipo: VALIDACION
|
|
esfuerzo: "1h"
|
|
dependencias: ["S1-T1", "S1-T2", "S1-T3", "S1-T4", "S1-T6"]
|
|
validacion: "wsl unified-recreate-db.sh trading-platform --drop"
|
|
|
|
criterio_exito:
|
|
- "0 conflictos de enum activos"
|
|
- "3 FKs cross-schema agregadas"
|
|
- "feature_flags documentado"
|
|
- "BD recrea sin errores"
|
|
- "Purga documental ejecutada"
|
|
|
|
metricas_esperadas:
|
|
gaps_resueltos: "+12 (total: 15/37)"
|
|
coherencia_ddl_inventario: "100% (mantenida)"
|
|
enum_conflicts: "3 -> 0"
|
|
fk_faltantes: "3 -> 0"
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# SPRINT 2: Backend Entities Core (10 dias)
|
|
# ═══════════════════════════════════════════════════════════════
|
|
sprint_2:
|
|
nombre: "Backend Entities - Core Schemas"
|
|
duracion: "10 dias"
|
|
esfuerzo_total: "62h"
|
|
prioridad: ALTA
|
|
prerequisitos: ["sprint_1"]
|
|
|
|
objetivo: |
|
|
Crear las 31 entities backend faltantes para alcanzar 95%+ entity coverage.
|
|
Priorizar schemas criticos primero (audit, trading, education).
|
|
|
|
tareas:
|
|
- id: "S2-T1"
|
|
nombre: "Crear 7 entities audit"
|
|
gap_ref: "GAP-BE-P2-001 (audit)"
|
|
schema: audit
|
|
entities:
|
|
- "AuditLog -> audit.audit_logs"
|
|
- "SecurityEvent -> audit.security_events"
|
|
- "SystemEvent -> audit.system_events"
|
|
- "TradingAudit -> audit.trading_audit"
|
|
- "ApiRequestLog -> audit.api_request_logs"
|
|
- "DataAccessLog -> audit.data_access_logs"
|
|
- "ComplianceLog -> audit.compliance_logs"
|
|
esfuerzo: "14h (2h/entity)"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
- id: "S2-T2"
|
|
nombre: "Crear 5 entities education"
|
|
gap_ref: "GAP-BE-P2-001 (education)"
|
|
schema: education
|
|
entities:
|
|
- "UserActivityLog -> education.user_activity_log"
|
|
- "ReviewHelpfulVote -> education.review_helpful_votes"
|
|
- "CourseTag -> education.course_tags"
|
|
- "CourseTagAssignment -> education.course_tag_assignments"
|
|
- "Video -> education.videos"
|
|
esfuerzo: "10h"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
- id: "S2-T3"
|
|
nombre: "Crear 3 entities trading"
|
|
gap_ref: "GAP-BE-P2-001 (trading)"
|
|
schema: trading
|
|
entities:
|
|
- "PriceAlert -> trading.price_alerts"
|
|
- "DrawingTool -> trading.drawing_tools"
|
|
- "DrawingTemplate -> trading.drawing_templates"
|
|
esfuerzo: "6h"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
- id: "S2-T4"
|
|
nombre: "Crear 3 entities financial"
|
|
gap_ref: "GAP-BE-P2-001 (financial)"
|
|
schema: financial
|
|
entities:
|
|
- "WalletLimit -> financial.wallet_limits"
|
|
- "CurrencyExchangeRate -> financial.currency_exchange_rates"
|
|
- "Refund -> financial.refunds"
|
|
esfuerzo: "6h"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
- id: "S2-T5"
|
|
nombre: "Crear 3 entities investment"
|
|
gap_ref: "GAP-BE-P2-001 (investment)"
|
|
schema: investment
|
|
entities:
|
|
- "DistributionHistory -> investment.distribution_history"
|
|
- "DistributionRun -> investment.distribution_runs"
|
|
- "AgentExecution -> investment.agent_executions"
|
|
esfuerzo: "6h"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
- id: "S2-T6"
|
|
nombre: "Crear entities menores (ml, portfolio, market_data, auth, feature_flags)"
|
|
gap_ref: "GAP-BE-P2-001 (resto)"
|
|
entities:
|
|
ml:
|
|
- "LlmSignal -> ml.llm_signals"
|
|
- "PredictionOverlay -> ml.prediction_overlays"
|
|
portfolio:
|
|
- "RebalanceHistory -> portfolio.rebalance_history"
|
|
- "PortfolioSnapshot -> portfolio.portfolio_snapshots"
|
|
market_data:
|
|
- "Ohlcv5m -> market_data.ohlcv_5m"
|
|
- "Ohlcv15m -> market_data.ohlcv_15m"
|
|
- "Staging -> market_data.staging"
|
|
auth:
|
|
- "RateLimitingConfig -> auth.rate_limiting_config"
|
|
- "UserPushToken -> auth.user_push_tokens"
|
|
feature_flags:
|
|
- "Flag -> feature_flags.flags"
|
|
esfuerzo: "20h"
|
|
dependencias: []
|
|
paralelizable: true
|
|
|
|
estrategia_ejecucion: |
|
|
Las 6 tareas son 100% paralelizables (sin dependencias entre schemas).
|
|
Con 3 agentes ejecutando en paralelo, el sprint se reduce de 62h a ~21h.
|
|
|
|
Cada entity debe incluir:
|
|
1. Archivo entity con decoradores TypeORM (@Entity, @Column, @ManyToOne, etc.)
|
|
2. Columnas exactas del DDL (tipo, nullable, default)
|
|
3. Relaciones basadas en FKs del DDL
|
|
4. Schema property apuntando al schema correcto
|
|
|
|
criterio_exito:
|
|
- "31 entities creadas con build exitoso"
|
|
- "Entity coverage: 68% -> 99% (99/101, excluyendo user_flags y evaluations de multi-CREATE)"
|
|
- "npm run build exitoso"
|
|
- "Inventarios actualizados"
|
|
|
|
metricas_esperadas:
|
|
entities_faltantes: "31 -> 0"
|
|
coherencia_entities: "68% -> 99%"
|
|
gaps_resueltos: "+1 (GAP-BE-P2-001)"
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# SPRINT 3: Backend Services Critical (10 dias)
|
|
# ═══════════════════════════════════════════════════════════════
|
|
sprint_3:
|
|
nombre: "Backend Services - Critical Coverage"
|
|
duracion: "10 dias"
|
|
esfuerzo_total: "68h"
|
|
prioridad: ALTA
|
|
prerequisitos: ["sprint_2"]
|
|
|
|
objetivo: |
|
|
Crear servicios backend criticos: audit (7 tablas), feature_flags,
|
|
completar bots service, risk assessment service.
|
|
|
|
tareas:
|
|
- id: "S3-T1"
|
|
nombre: "Crear AuditService + SecurityEventService + ComplianceService"
|
|
gap_ref: "GAP-SVC-P2-001"
|
|
schema: audit
|
|
esfuerzo: "32h"
|
|
dependencias: ["S2-T1"]
|
|
entregables:
|
|
- "AuditService (audit_logs, data_access_logs)"
|
|
- "SecurityEventService (security_events)"
|
|
- "TradingAuditService (trading_audit)"
|
|
- "ComplianceService (compliance_logs)"
|
|
- "AuditController con endpoints admin-only"
|
|
endpoints:
|
|
- "GET /api/admin/audit/logs"
|
|
- "GET /api/admin/audit/security"
|
|
- "GET /api/admin/audit/trading"
|
|
- "GET /api/admin/audit/compliance"
|
|
- "GET /api/admin/audit/export"
|
|
|
|
- id: "S3-T2"
|
|
nombre: "Crear FeatureFlagService"
|
|
gap_ref: "GAP-SVC-P2-006"
|
|
schema: feature_flags
|
|
esfuerzo: "8h"
|
|
dependencias: ["S2-T6"]
|
|
entregables:
|
|
- "FeatureFlagService con cache Redis"
|
|
- "FeatureFlagMiddleware para route gating"
|
|
- "FeatureFlagController"
|
|
endpoints:
|
|
- "GET /api/admin/flags"
|
|
- "PUT /api/admin/flags/:name"
|
|
- "GET /api/flags/evaluate/:name"
|
|
|
|
- id: "S3-T3"
|
|
nombre: "Completar BotsService (60% -> 100%)"
|
|
gap_ref: "GAP-SVC-P2-004"
|
|
schema: trading
|
|
esfuerzo: "16h"
|
|
dependencias: ["S2-T3"]
|
|
faltante:
|
|
- "CRUD completo (create, update, delete)"
|
|
- "WebSocket monitoring real-time"
|
|
- "Integracion con wallet via FK"
|
|
- "Historial de ejecuciones"
|
|
|
|
- id: "S3-T4"
|
|
nombre: "Crear RiskAssessmentService"
|
|
gap_ref: "GAP-SVC-P2-005"
|
|
schema: investment
|
|
esfuerzo: "12h"
|
|
dependencias: ["S2-T5"]
|
|
entregables:
|
|
- "RiskAssessmentService"
|
|
- "RiskAssessmentController"
|
|
endpoints:
|
|
- "GET /api/risk/questionnaire"
|
|
- "POST /api/risk/assessment"
|
|
- "PUT /api/users/:id/risk-profile"
|
|
|
|
criterio_exito:
|
|
- "Audit schema 100% serviced"
|
|
- "Feature flags operativo con cache"
|
|
- "Bots service 100% completo"
|
|
- "Risk assessment calculando score"
|
|
- "npm run build exitoso"
|
|
|
|
metricas_esperadas:
|
|
coherencia_services: "52% -> 72%"
|
|
gaps_resueltos: "+4 (GAP-SVC-P2-001, P2-004, P2-005, P2-006)"
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# SPRINT 4: Consolidation + Symbols Migration (10 dias)
|
|
# ═══════════════════════════════════════════════════════════════
|
|
sprint_4:
|
|
nombre: "Consolidation + Symbol Catalog Migration"
|
|
duracion: "10 dias"
|
|
esfuerzo_total: "50h"
|
|
prioridad: MEDIA
|
|
prerequisitos: ["sprint_3"]
|
|
|
|
objetivo: |
|
|
Consolidar catalogos de simbolos, crear servicios market_data y currency,
|
|
completar definiciones documentales, actualizar roadmap.
|
|
|
|
tareas:
|
|
- id: "S4-T1"
|
|
nombre: "Consolidar trading.symbols vs market_data.tickers"
|
|
gap_ref: "GAP-DUP-P1-001"
|
|
tipo: DDL + BACKEND
|
|
esfuerzo: "12h"
|
|
dependencias: []
|
|
pasos:
|
|
- "1. Agregar campos ML a trading.symbols (is_ml_enabled, polygon_ticker, supported_timeframes)"
|
|
- "2. Crear migracion para mover datos de tickers a symbols"
|
|
- "3. Actualizar market_data.tickers a vista o tabla dependiente"
|
|
- "4. Actualizar todas las referencias en ml schema y data-service"
|
|
- "5. Recrear BD y verificar"
|
|
riesgo: "Alto - afecta Python data-service, ml schema queries"
|
|
|
|
- id: "S4-T2"
|
|
nombre: "Crear Market Data OHLCV Service"
|
|
gap_ref: "GAP-SVC-P2-002"
|
|
esfuerzo: "16h"
|
|
dependencias: ["S2-T6", "S4-T1"]
|
|
|
|
- id: "S4-T3"
|
|
nombre: "Crear Currency Exchange Service"
|
|
gap_ref: "GAP-SVC-P2-003"
|
|
esfuerzo: "8h"
|
|
dependencias: ["S2-T4"]
|
|
nota: "Reducido a 8h si solo se implementa lectura de rates sin API externa"
|
|
|
|
- id: "S4-T4"
|
|
nombre: "Completar definiciones documentales"
|
|
gap_ref: "GAP-DOC-P2-001"
|
|
esfuerzo: "10h"
|
|
dependencias: []
|
|
|
|
- id: "S4-T5"
|
|
nombre: "Resolver gaps P3 (oportunista)"
|
|
gap_ref: "GAP-IDX-P3-001, GAP-DEL-P3-001, GAP-ORPHAN-P3-001/002, GAP-ARCH-P3-001"
|
|
esfuerzo: "4h"
|
|
dependencias: []
|
|
|
|
criterio_exito:
|
|
- "1 catalogo de simbolos unificado"
|
|
- "Market data y currency services operativos"
|
|
- "Todas las definiciones documentales creadas"
|
|
- "0 gaps P3 pendientes"
|
|
|
|
metricas_esperadas:
|
|
coherencia_services: "72% -> 85%"
|
|
gaps_pendientes: "0"
|
|
coherencia_global: "54% -> 90%"
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# GRAFO DE DEPENDENCIAS
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
dependencias:
|
|
sprint_level:
|
|
- "Sprint 1 -> Sprint 2 (entities necesitan DDL correcto)"
|
|
- "Sprint 2 -> Sprint 3 (services necesitan entities)"
|
|
- "Sprint 3 -> Sprint 4 (consolidation necesita services base)"
|
|
|
|
task_level_criticas:
|
|
- "S1-T1 (enum migration) -> S1-T10 (BD validation)"
|
|
- "S1-T2..T4 (FKs) -> S1-T10 (BD validation)"
|
|
- "S2-T1 (audit entities) -> S3-T1 (audit services)"
|
|
- "S2-T6 (feature_flags entity) -> S3-T2 (feature_flags service)"
|
|
- "S2-T3 (trading entities) -> S3-T3 (bots service)"
|
|
- "S2-T5 (investment entities) -> S3-T4 (risk service)"
|
|
- "S4-T1 (symbols consolidation) -> S4-T2 (market data service)"
|
|
|
|
parallelism:
|
|
sprint_1: "T1..T9 son independientes, T10 espera T1..T6"
|
|
sprint_2: "T1..T6 son 100% paralelizables (diferentes schemas)"
|
|
sprint_3: "T1..T4 son paralelizables (diferentes schemas)"
|
|
sprint_4: "T1 secuencial, T2..T5 parcialmente paralelizables"
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# ESTIMACION TOTAL
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
estimacion:
|
|
esfuerzo_secuencial:
|
|
sprint_1: "24h"
|
|
sprint_2: "62h"
|
|
sprint_3: "68h"
|
|
sprint_4: "50h"
|
|
total: "204h"
|
|
|
|
esfuerzo_paralelo_estimado:
|
|
sprint_1: "12h (2 agentes)"
|
|
sprint_2: "21h (3 agentes)"
|
|
sprint_3: "32h (2 agentes)"
|
|
sprint_4: "28h (2 agentes)"
|
|
total: "~93h"
|
|
|
|
duracion_calendario:
|
|
con_1_agente: "~35 dias (7 semanas)"
|
|
con_2_agentes: "~20 dias (4 semanas)"
|
|
con_3_agentes: "~15 dias (3 semanas)"
|
|
|
|
distribucion_por_tipo:
|
|
ddl_modifications: "10h (5%)"
|
|
entity_creation: "62h (30%)"
|
|
service_creation: "68h (33%)"
|
|
documentation: "28h (14%)"
|
|
consolidation: "20h (10%)"
|
|
validation_testing: "16h (8%)"
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# RIESGOS Y MITIGACION
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
riesgos:
|
|
- id: "R1"
|
|
riesgo: "Symbols consolidation causa regresion en Python data-service"
|
|
probabilidad: MEDIA
|
|
impacto: ALTO
|
|
mitigacion: "Ejecutar en Sprint 4 cuando servicios base esten estables. Crear script de migracion reversible."
|
|
|
|
- id: "R2"
|
|
riesgo: "31 entities no compilan por dependencias circulares"
|
|
probabilidad: BAJA
|
|
impacto: MEDIO
|
|
mitigacion: "Crear entities por schema aislado, lazy-load relations cross-schema"
|
|
|
|
- id: "R3"
|
|
riesgo: "Audit services muy grandes (32h) retrasan Sprint 3"
|
|
probabilidad: MEDIA
|
|
impacto: MEDIO
|
|
mitigacion: "Implementar read-only primero (queries), write operations en fase posterior"
|
|
|
|
- id: "R4"
|
|
riesgo: "Enum migration rompe datos existentes"
|
|
probabilidad: BAJA
|
|
impacto: ALTO
|
|
mitigacion: "Solo timeframe es safe (valores compatibles). transaction_type se documenta, no se migra."
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# INTEGRACION CON ROADMAP EXISTENTE
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
integracion_roadmap:
|
|
roadmap_actual: "ROADMAP-2026-Q1.yml v1.0.0 (2026-01-27)"
|
|
|
|
cambios_requeridos:
|
|
- seccion: "M1 (Gaps P0)"
|
|
cambio: |
|
|
Agregar: Sprint 1 de remediacion modelado (enum migrations, FKs, feature_flags doc).
|
|
GAP-DDL-P0-001 ya resuelto (FK price_alerts corregida).
|
|
Metricas baseline actualizadas: 37 gaps (no 12), 101 tablas (no 89).
|
|
|
|
- seccion: "M2 (Gaps P1)"
|
|
cambio: |
|
|
Integrar: Sprint 2 entities + Sprint 3 services.
|
|
Nuevos gaps P1 identificados: 14 (vs 4 original).
|
|
Target DDL-Backend coherence revisado: 54% actual (no 85%).
|
|
|
|
- seccion: "Metricas baseline"
|
|
cambio: |
|
|
Actualizar todas las metricas baseline con datos verificados:
|
|
- Tablas: 101 (no 89)
|
|
- Gaps: 37 (no 12), de los cuales 3 resueltos
|
|
- Coherencia global: 54% (no 81.25% - recalculada con precision)
|
|
- Entity coverage: 68% (no ~85%)
|
|
- Service coverage: 52%
|
|
- Controller coverage: 45%
|
|
|
|
- seccion: "Nuevos milestones"
|
|
cambio: |
|
|
Insertar M0.5: "Modelado BD Corregido" entre M0 y M1.
|
|
Sprint 1+2 de remediacion como prerequisito para M1 (P0 funcionales).
|
|
|
|
nota: |
|
|
El ROADMAP-2026-Q1.yml necesita actualizacion significativa.
|
|
Las metricas originales estaban infladas (coherencia 81.25% vs 54% real).
|
|
Se recomienda crear ROADMAP-2026-Q1 v2.0.0 incorporando estos hallazgos.
|
|
|
|
# ─────────────────────────────────────────────────────────────────
|
|
# CHECKLIST DE REMEDIACION
|
|
# ─────────────────────────────────────────────────────────────────
|
|
|
|
checklist:
|
|
pre_sprint_1:
|
|
- "[ ] Verificar acceso a WSL para recrear BD"
|
|
- "[ ] Verificar backup de datos actuales"
|
|
- "[ ] Confirmar que PURGA-DOCUMENTAL.yml esta aprobado"
|
|
|
|
post_sprint_1:
|
|
- "[ ] BD recrea sin errores"
|
|
- "[ ] 0 conflictos enum"
|
|
- "[ ] 3 nuevas FKs validadas"
|
|
- "[ ] feature_flags documentado"
|
|
- "[ ] Purga ejecutada"
|
|
- "[ ] Inventarios sincronizados"
|
|
|
|
post_sprint_2:
|
|
- "[ ] 31 entities compilan (npm run build)"
|
|
- "[ ] Entity coverage >= 95%"
|
|
- "[ ] BACKEND_INVENTORY actualizado"
|
|
- "[ ] DDL-BACKEND-COHERENCE actualizado"
|
|
|
|
post_sprint_3:
|
|
- "[ ] Audit endpoints operativos"
|
|
- "[ ] Feature flags con cache Redis"
|
|
- "[ ] Bots service 100%"
|
|
- "[ ] Risk assessment operativo"
|
|
- "[ ] Service coverage >= 72%"
|
|
|
|
post_sprint_4:
|
|
- "[ ] 1 catalogo simbolos unificado"
|
|
- "[ ] 0 gaps pendientes"
|
|
- "[ ] Coherencia global >= 90%"
|
|
- "[ ] COHERENCE-MASTER-REPORT v2.0 generado"
|
|
- "[ ] ROADMAP-2026-Q1 v2.0 actualizado"
|
|
|
|
# ═══════════════════════════════════════════════════════════════════
|
|
# FIN DE PLAN-MAESTRO-REMEDIACION.yml
|
|
# ═══════════════════════════════════════════════════════════════════
|