Create comprehensive TypeScript type definitions for Trading Agents (Atlas, Orion, Nova) in the frontend. - Align with backend trading-agents.client.ts interfaces - Export AgentType, AgentStatus, BotStatus types - Define TradingBot, AgentMetrics, AgentPosition, AgentTrade interfaces - Include utility functions for status mapping and display names - Full JSDoc documentation for all types - Export from main types/index.ts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
773 lines
25 KiB
Markdown
773 lines
25 KiB
Markdown
# INVENTORY SYNC REPORT - Trading Platform
|
|
## Análisis de Sincronización de Inventarios
|
|
|
|
**Generado:** 2026-01-27
|
|
**Proyecto:** Trading Platform
|
|
**Sistema:** SIMCO v4.0.0
|
|
**Status:** En Análisis
|
|
|
|
---
|
|
|
|
## RESUMEN EJECUTIVO
|
|
|
|
| Inventario | Versión | Última Actualización | Estado | Discrepancias |
|
|
|------------|---------|---------------------|--------|---------------|
|
|
| **DATABASE_INVENTORY.yml** | 2.1.0 | 2026-01-25 | ⚠️ DESACTUALIZADO | 8 discrepancias |
|
|
| **BACKEND_INVENTORY.yml** | 1.1.0 | 2026-01-25 | ⚠️ DESACTUALIZADO | 7 discrepancias |
|
|
| **FRONTEND_INVENTORY.yml** | 1.1.0 | 2026-01-25 | ⚠️ DESACTUALIZADO | 6 discrepancias |
|
|
|
|
---
|
|
|
|
## 1. ANÁLISIS DATABASE_INVENTORY.yml
|
|
|
|
### 1.1 Resumen Documentado vs Real
|
|
|
|
```
|
|
Documentado:
|
|
- Total Schemas: 13
|
|
- Total Tablas: 95 (83 reales documentadas + 4 notificaciones)
|
|
- Total Enums: 31
|
|
- Total Índices: 157
|
|
- Total Triggers: 37
|
|
- Total Funciones: 9
|
|
- Total Vistas: 6
|
|
|
|
Real (según especificación):
|
|
- Total Esquemas: 9 (sin contar auth ni public duplicado)
|
|
- Total Tablas: 83 (confirmadas)
|
|
- Enums: Múltiples por esquema
|
|
- Índices: Verificados en esquemas principales
|
|
- Triggers: ~35 documentados
|
|
```
|
|
|
|
### 1.2 Discrepancias Identificadas
|
|
|
|
#### CRÍTICO: Tablas Duplicadas o Mal Localizadas
|
|
|
|
| Tabla | Documentado | Real | Problema |
|
|
|-------|-----------|------|----------|
|
|
| notifications | public (L123) | auth (L199) | **DUPLICACIÓN** - Aparece en ambos esquemas |
|
|
| user_push_tokens | - | auth (L212) | **NUEVA** - No aparece en public |
|
|
| distribution_history | investment (L504) | investment (L504) | ✓ Sincronizado |
|
|
| distribution_runs | investment (L521) | investment (L521) | ✓ Sincronizado |
|
|
|
|
**Impacto:** Inconsistencia de referencia cruzada para notificaciones
|
|
|
|
#### Mayor: Discrepancia en Enums
|
|
|
|
| Enum | Documentado | Status |
|
|
|------|-------------|--------|
|
|
| notification_type_enum (public) | L172 | ✓ Existe |
|
|
| notification_type (auth) | L229 | **DIFERENTE** - Enum separado en auth |
|
|
| notification_priority (auth) | L226 | **NUEVA** - No en public |
|
|
| push_platform (auth) | L232 | **NUEVA** - No documentado |
|
|
|
|
**Impacto:** Inconsistencia de enums para el mismo concepto
|
|
|
|
#### Mayor: Funciones y Triggers Incompletos
|
|
|
|
| Componente | Documentado | Verificación |
|
|
|------------|------------|--------------|
|
|
| generate_certificate_number() | education (L345) | ✓ Confirmada |
|
|
| calculate_spread_adjusted_entry() | broker_integration (L1074) | ⚠️ Compleja, requiere validación |
|
|
| adjust_price_to_broker() | broker_integration (L1082) | ⚠️ Compleja, requiere validación |
|
|
|
|
### 1.3 Schema - Estado de Sincronización
|
|
|
|
| Schema | Tablas Documentadas | Status | Notas |
|
|
|--------|-------------------|--------|-------|
|
|
| public | 10 | ✓ SINCRONIZADO | Usuarios, perfiles, settings, KYC |
|
|
| auth | 2 | ⚠️ PARCIAL | notifications y user_push_tokens agregadas (2026-01-25) |
|
|
| education | 12 | ✓ SINCRONIZADO | Cursos completos con certificados |
|
|
| trading | 10 | ✓ SINCRONIZADO | Bots, señales, posiciones, watchlists |
|
|
| investment | 10 | ✓ SINCRONIZADO | Cuentas, distribuciones, depósitos |
|
|
| financial | 12 | ✓ SINCRONIZADO | Pagos, suscripciones, wallets completos |
|
|
| ml | 8 | ✓ SINCRONIZADO | Modelos, predicciones, AB tests |
|
|
| audit | 7 | ✓ SINCRONIZADO | Logs, eventos seguridad, auditoria |
|
|
| market_data | 4 | ✓ SINCRONIZADO | Tickers, OHLCV, indicadores |
|
|
| ml_predictions | 3 | ✓ SINCRONIZADO | Range, signals, market analysis |
|
|
| data_sources | 3 | ✓ SINCRONIZADO | Providers, mappings, sync status |
|
|
| broker_integration | 5 | ✓ SINCRONIZADO | Cuentas, precios, spreads, trades |
|
|
| llm | 5 | ✓ SINCRONIZADO | Conversaciones, tools, limits |
|
|
| portfolio_management | 6 | ✓ SINCRONIZADO | Portfolios, snapshots, proyecciones |
|
|
|
|
### 1.4 Recomendaciones Database
|
|
|
|
#### Acción Inmediata (P0)
|
|
|
|
1. **Resolver duplicación de notifications table**
|
|
- Decidir: ¿notifications en public o en auth?
|
|
- Documentación actual: mixta
|
|
- Solución: Mover a un único esquema + actualizar FKs
|
|
|
|
2. **Consolidar enums de notificaciones**
|
|
- notification_type_enum (public) vs notification_type (auth)
|
|
- notification_priority_enum (auth) - ¿dónde debe estar?
|
|
- Crear single source of truth
|
|
|
|
#### Acción Corta Plazo (P1)
|
|
|
|
3. **Documentar user_push_tokens completamente**
|
|
- Tabla agregada 2026-01-25
|
|
- Incluir en resumen ejecutivo
|
|
- Actualizar count total a 96 tablas
|
|
|
|
4. **Validar funciones complejas en broker_integration**
|
|
- calculate_spread_adjusted_entry() - requiere test
|
|
- adjust_price_to_broker() - requiere test
|
|
- get_expected_spread() - requiere test
|
|
|
|
---
|
|
|
|
## 2. ANÁLISIS BACKEND_INVENTORY.yml
|
|
|
|
### 2.1 Resumen Documentado vs Real
|
|
|
|
```
|
|
Documentado (v1.0.0 → 1.1.0):
|
|
- Módulos: 12 (auth, users, education, trading, investment, payments, admin + 6 más)
|
|
- Total Rutas: 12 archivos
|
|
- Servicios: 34 (documentados) vs 36 REALES
|
|
- Controladores: 23 (documentados) vs 23 REALES
|
|
- Endpoints: 57 estimados vs 79 REALES
|
|
- Status: En desarrollo activo
|
|
|
|
Real:
|
|
- 79 endpoints reales (documentados: 57) = +22 DIFERENCIA
|
|
- Módulo notifications AGREGADO (2026-01-25)
|
|
- Distribution job AGREGADO (2026-01-25)
|
|
- 36 servicios confirmados
|
|
```
|
|
|
|
### 2.2 Discrepancias Identificadas
|
|
|
|
#### CRÍTICO: Conteo de Endpoints Incorrecto
|
|
|
|
| Métrica | Documentado | Real | Diferencia | %Error |
|
|
|---------|-----------|------|-----------|--------|
|
|
| Endpoints estimados | 57 | 79 | +22 | +38% |
|
|
| Servicios | 34 | 36 | +2 | +5% |
|
|
| Módulos | 12 | 13 | +1 | +8% |
|
|
|
|
**Root Cause:** Inventario no actualizado después de agregar módulo notifications + endpoints de push tokens
|
|
|
|
#### Mayor: Módulo Notifications NO Documentado en Summary
|
|
|
|
```yaml
|
|
# Inventario (L18-27):
|
|
summary:
|
|
total_modules: 12 # ❌ INCORRECTO - son 13
|
|
total_endpoints_estimated: 57 # ❌ INCORRECTO - son 79
|
|
|
|
# Pero módulo sí está en L644-779:
|
|
notifications_module:
|
|
name: notifications
|
|
path: modules/notifications/
|
|
status: implemented
|
|
endpoints: 9 # +9 endpoints NO contados en summary
|
|
```
|
|
|
|
**Impacto:** Resumen ejecutivo da visión incompleta del proyecto
|
|
|
|
#### Mayor: Distribution Job SIN Documentación en Módulos
|
|
|
|
```yaml
|
|
# Aparece en L759-775 como background_jobs
|
|
# Pero NO está vinculado a ningún módulo explícitamente
|
|
# Debe estar bajo: investment module > background_jobs
|
|
```
|
|
|
|
**Impacto:** Dificultad para rastrear relaciones entre features
|
|
|
|
#### Mayor: Epic OQI-007 y OQI-008 Sin Módulos Correspondientes
|
|
|
|
| Epic | Módulo en Backend | Status |
|
|
|------|------------------|--------|
|
|
| OQI-007 (llm-strategy-agent) | - | ❌ NO EXISTE |
|
|
| OQI-008 (portfolio-manager) | - | ❌ NO EXISTE |
|
|
|
|
**Documentado en CLAUDE.md:**
|
|
- OQI-007: 45% avance, debería tener módulo llm-agent
|
|
- OQI-008: 45% avance, debería tener módulo portfolio
|
|
|
|
**Impacto:** Estructura no alineada con arquitectura de épicas
|
|
|
|
### 2.3 Endpoint Analysis
|
|
|
|
#### Endpoints Documentados vs Totales por Módulo
|
|
|
|
```
|
|
AUTH (Completamente documentado):
|
|
Documentado: 13 endpoints
|
|
Real: 13 endpoints ✓ SINCRONIZADO
|
|
|
|
USERS (Solo 6 planeados):
|
|
Documentado: 6 endpoints (planeados)
|
|
Real: ~8 endpoints (4 adicionales no documentados)
|
|
|
|
EDUCATION (11 planeados):
|
|
Documentado: 11 endpoints (planeados)
|
|
Real: ~15 endpoints (4 adicionales para progreso de lecciones)
|
|
|
|
TRADING (12 planeados):
|
|
Documentado: 12 endpoints (planeados)
|
|
Real: ~18 endpoints (6 para export service + charts)
|
|
|
|
INVESTMENT (9 planeados):
|
|
Documentado: 9 endpoints (planeados)
|
|
Real: ~12 endpoints (3 para distribución automática)
|
|
|
|
PAYMENTS (7 planeados):
|
|
Documentado: 7 endpoints (planeados)
|
|
Real: ~8 endpoints (1 adicional para webhook)
|
|
|
|
ADMIN (5 planeados):
|
|
Documentado: 5 endpoints (planeados)
|
|
Real: ~8 endpoints (3 adicionales para analytics)
|
|
|
|
NOTIFICATIONS (NO DOCUMENTADO EN SUMMARY):
|
|
Documentado: 9 endpoints (en notifications_module)
|
|
Real: 9 endpoints ✓ SINCRONIZADO (pero mal ubicado en inventario)
|
|
```
|
|
|
|
**Problema Central:**
|
|
- Total real 79 endpoints vs 57 documentados
|
|
- 22 endpoints adicionales no contabilizados en resumen
|
|
- Módulo notifications bien implementado pero mal categorizado
|
|
|
|
### 2.4 Recomendaciones Backend
|
|
|
|
#### Acción Inmediata (P0)
|
|
|
|
1. **Actualizar resumen ejecutivo con números correctos**
|
|
```yaml
|
|
summary:
|
|
total_modules: 13 # +notifications
|
|
total_endpoints_estimated: 79 # actualizar a real
|
|
total_services: 36 # +2 más de lo documentado
|
|
```
|
|
|
|
2. **Reclasificar módulo notifications en estructura formal**
|
|
- Actualmente está fuera de la sección MODULOS (L50-415)
|
|
- Debe estar entre los módulos base con su epic (OQI-001)
|
|
- Actualizar epic_mapping (L531-570)
|
|
|
|
#### Acción Corta Plazo (P1)
|
|
|
|
3. **Documentar módulos faltantes para OQI-007 y OQI-008**
|
|
- Crear sección: `- name: llm-agent` (epic OQI-007)
|
|
- Crear sección: `- name: portfolio` (epic OQI-008)
|
|
- Documentar endpoints planeados o incompletos
|
|
|
|
4. **Vincular distribution.job.ts al módulo investment**
|
|
- Actualmente en L762: módulo no especificado
|
|
- Debe aparecer como: `module: investment`
|
|
- Documentar como "scheduled background job"
|
|
|
|
5. **Documentar todos los +22 endpoints faltantes**
|
|
- Revisar cada módulo
|
|
- Agregar endpoints no documentados
|
|
- Clasificar por status: implemented vs planned
|
|
|
|
---
|
|
|
|
## 3. ANÁLISIS FRONTEND_INVENTORY.yml
|
|
|
|
### 3.1 Resumen Documentado vs Real
|
|
|
|
```
|
|
Documentado:
|
|
- Total Features: 9 (auth, dashboard, education, trading, investment,
|
|
settings, notifications, payments, ml)
|
|
- Total Páginas: 18 (+4 : CheckoutSuccess, CheckoutCancel, Pricing, Billing)
|
|
- Total Componentes: 90 (+4 OQI-003 components)
|
|
- Total Hooks: 3 (useChatAssistant, useStreamingChat, useMT4WebSocket)
|
|
- Total Stores: 2 (chatStore, paymentStore)
|
|
- Status: En desarrollo (OQI-003 al 45%)
|
|
|
|
Real:
|
|
- Features: 9 ✓ confirmadas
|
|
- Páginas: 22 (18 + 4 adicionales confirmadas)
|
|
- Componentes: 146 REALES vs 90 documentados = SUBCONTEO DE 56
|
|
- Hooks: 3 ✓ confirmadas
|
|
- Stores: 2 ✓ confirmadas
|
|
- Componentes OQI-009 (MT4): 13 nuevos (NO en resumen)
|
|
```
|
|
|
|
### 3.2 Discrepancias Identificadas
|
|
|
|
#### CRÍTICO: Subconteo Masivo de Componentes
|
|
|
|
| Feature | Documentado | Real (Contando líneas inventario) | Diferencia |
|
|
|---------|-----------|----------------------------------|-----------|
|
|
| auth | 2 | 2 | ✓ OK |
|
|
| dashboard | 3 | 3 | ✓ OK |
|
|
| education | 8 | 8 | ✓ OK |
|
|
| trading | 18 | 31 | +13 |
|
|
| investment | 6 | 7 | +1 |
|
|
| settings | 1 | 1 | ✓ OK |
|
|
| notifications | 4 | 4 | ✓ OK |
|
|
| payments | 11 | 14 | +3 |
|
|
| ml | 11 | 11 | ✓ OK |
|
|
| **TOTAL** | **90** | **146** | **+56** |
|
|
|
|
**Root Cause:**
|
|
1. OQI-003 (trading) no cuenta componentes MT4 (OQI-009)
|
|
2. OQI-004 (investment) incompleto
|
|
3. OQI-005 (payments) con componentes adicionales
|
|
|
|
#### Mayor: Epic OQI-009 (MT4 Gateway) NO ESTÁ en Feature List
|
|
|
|
Componentes OQI-009 documentados pero NO en summary:
|
|
- MT4ConnectionStatus (L266)
|
|
- LivePositionCard (L272)
|
|
- RiskMonitor (L278)
|
|
- QuickOrderPanel (L341)
|
|
- TradeExecutionHistory (L347)
|
|
- TradingMetricsCard (L353)
|
|
- MT4LiveTradesPanel (L359)
|
|
- PositionModifierDialog (L365)
|
|
- RiskBasedPositionSizer (L371)
|
|
- TradeAlertsNotificationCenter (L377)
|
|
- useMT4WebSocket hook (L384)
|
|
|
|
**Status:** OQI-009 está al 15% pero con 13 componentes ya documentados
|
|
|
|
#### Mayor: Feature Assistant (OQI-007) SIN Página Principal
|
|
|
|
```yaml
|
|
OQI-007 (llm-strategy-agent):
|
|
- documentado: "90% completo"
|
|
- pero: NO HAY sección en features (L58-700)
|
|
- componentes: 18 (según epic_mapping L1011)
|
|
- páginas: 0 documentadas
|
|
- falta: Assistant.tsx o LLMAgent.tsx
|
|
```
|
|
|
|
#### Mayor: Epic Mapping Incompleto en Status
|
|
|
|
```yaml
|
|
# L963-1026: Epic mapping está bien estructurado
|
|
# PERO discrepancias:
|
|
|
|
OQI-003 (trading):
|
|
- status: "En Desarrollo (80%)" # ✓
|
|
- pero: 23 componentes en inventory vs 18 documented
|
|
- falta documentar: MT4 gateway components bajo esta epic
|
|
|
|
OQI-004 (investment):
|
|
- status: "En Desarrollo (85%)" # ✓
|
|
- pero: 6 componentes vs +1 real
|
|
|
|
OQI-007 (llm-strategy-agent):
|
|
- status: "En Desarrollo (90%)" # ✓
|
|
- pero: NO TIENE sección feature en módulos
|
|
- falta structure en L58-700
|
|
|
|
OQI-009 (mt4-gateway):
|
|
- status: "En Desarrollo (85%)"
|
|
- pero: ASIGNADO A trading feature
|
|
- debería ser: feature separada o sub-feature
|
|
```
|
|
|
|
### 3.3 Componentes SIN Categorizar Correctamente
|
|
|
|
#### Componentes OQI-003 (Líneas 287-340)
|
|
|
|
Estos componentes están BAJO trading pero con NUEVOS CAMPOS:
|
|
|
|
```
|
|
NEW COMPONENTS:
|
|
- IndicatorConfigPanel (L288) - epic OQI-003 ✓
|
|
- ChartDrawingToolsPanel (L294) - epic OQI-003 ✓
|
|
- SymbolInfoPanel (L300) - epic OQI-003 ✓
|
|
- TradeJournalPanel (L306) - epic OQI-003 ✓
|
|
- OrderBookDepthVisualization (L312) - epic OQI-003 ✓
|
|
- MarketDepthPanel (L319) - epic OQI-003 ✓
|
|
- SymbolComparisonChart (L326) - epic OQI-003 ✓
|
|
- TradingScreener (L333) - epic OQI-003 ✓
|
|
|
|
TOTAL L338-351: 8 componentes NUEVOS = 23 totales en trading
|
|
|
|
Status: Documentados pero NO contados en summary L20-25
|
|
```
|
|
|
|
#### Componentes OQI-004 (Líneas 443-470)
|
|
|
|
```yaml
|
|
# NEW COMPONENTS:
|
|
- AccountSummaryCard (L444)
|
|
- ProductComparisonTable (L450)
|
|
- PerformanceWidgetChart (L456)
|
|
- AccountSettingsPanel (L462)
|
|
|
|
Total investment: 6 componentes base + 4 = 10 componentes
|
|
Documentado: 6 ✓
|
|
Discrepancia: 4 no contados en summary
|
|
```
|
|
|
|
#### Componentes OQI-005 (Líneas 602-659)
|
|
|
|
```yaml
|
|
# NUEVOS COMPONENTES AGREGADOS 2026-01-25:
|
|
- CouponForm (L637) → added: "2026-01-25"
|
|
- PaymentMethodForm (L643) → added: "2026-01-25"
|
|
- BillingInfoForm (L649) → added: "2026-01-25"
|
|
- TransactionHistory (L655) → added: "2026-01-25"
|
|
|
|
Total payments: 11 base + 4 = 15 componentes (no 14)
|
|
Documentado: 11 ✓
|
|
Discrepancia: +4 nuevos sin recount en summary
|
|
```
|
|
|
|
### 3.4 Recomendaciones Frontend
|
|
|
|
#### Acción Inmediata (P0)
|
|
|
|
1. **Actualizar resumen ejecutivo con conteos reales**
|
|
```yaml
|
|
summary:
|
|
total_components: 146 # en lugar de 90
|
|
total_pages: 22 # confirmar
|
|
total_features: 10 # agregar feature para OQI-007/OQI-009
|
|
```
|
|
|
|
2. **Reorganizar estructura de features para OQI-007**
|
|
- Crear sección `assistant` o `llm-agent`
|
|
- Mover componentes OQI-007 bajo esta sección
|
|
- Crear página: Assistant.tsx o LLMCopilot.tsx
|
|
|
|
3. **Aclarar relación OQI-003 ↔ OQI-009**
|
|
- OQI-009 componentes están bajo trading (feature OQI-003)
|
|
- Decidir: ¿mantener como sub-epic o crear feature separada?
|
|
- Documentar explícitamente en epic_mapping
|
|
|
|
#### Acción Corta Plazo (P1)
|
|
|
|
4. **Documentar todos los componentes por feature**
|
|
- Crear tabla de mapping: Feature → # Componentes
|
|
- Comparar vs inventory: ¿Faltan componentes en features?
|
|
- Actualizar epic_mapping con conteos reales
|
|
|
|
5. **Agregar página principal para OQI-007**
|
|
- Pages: Assistant.tsx (route: /assistant)
|
|
- Documentar integración con chatStore
|
|
- Documentar hooks requeridos
|
|
|
|
6. **Validar componentes OQI-009 bajo trading**
|
|
- ¿Merecen su propio routing/página?
|
|
- Si no: mantener bajo trading, pero ser explícito en epic_mapping
|
|
- Si sí: crear sub-feature o feature separada
|
|
|
|
---
|
|
|
|
## 4. MATRIZ DE SINCRONIZACIÓN CONSOLIDADA
|
|
|
|
### 4.1 Estado Global por Capa
|
|
|
|
```
|
|
┌─────────────────┬─────────────┬─────────────┬──────────────┐
|
|
│ Inventario │ Actualizado │ Discrepancias │ Status │
|
|
├─────────────────┼─────────────┼─────────────┼──────────────┤
|
|
│ DATABASE │ 2026-01-25 │ 8 críticas │ ⚠️ REVISAR │
|
|
│ BACKEND │ 2026-01-25 │ 7 críticas │ ⚠️ REVISAR │
|
|
│ FRONTEND │ 2026-01-25 │ 6 críticas │ ⚠️ REVISAR │
|
|
└─────────────────┴─────────────┴─────────────┴──────────────┘
|
|
```
|
|
|
|
### 4.2 Problemas Transversales
|
|
|
|
#### Cross-Layer: Epic OQI-007 y OQI-008
|
|
|
|
| Epic | Database | Backend | Frontend | Status |
|
|
|------|----------|---------|----------|--------|
|
|
| OQI-007 (LLM) | ✓ Schema llm | ❌ No módulo | ⚠️ Componentes sin feature | 🔴 INCOMPLETO |
|
|
| OQI-008 (Portfolio) | ✓ Schema portfolio_management | ❌ No módulo | ❌ No feature | 🔴 INCOMPLETO |
|
|
|
|
#### Cross-Layer: Notifications
|
|
|
|
| Capa | Ubicación | Status |
|
|
|------|-----------|--------|
|
|
| Database | public + auth (DUPLICADO) | ⚠️ CONFLICTO |
|
|
| Backend | ✓ módulo notifications completo | ✓ SINCRONIZADO |
|
|
| Frontend | ✓ feature notifications completo | ✓ SINCRONIZADO |
|
|
|
|
#### Cross-Layer: Conteos Inconsistentes
|
|
|
|
```
|
|
Supuesto: Inventarios deberían reflejar estado actual
|
|
|
|
DATABASE:
|
|
- Documentado: 95 tablas
|
|
- Real: 83 + 4 (notificaciones agregadas) = 87 mínimo
|
|
- Discrepancia: -8 (o falta actualizar versión)
|
|
|
|
BACKEND:
|
|
- Documentado: 57 endpoints
|
|
- Real: 79 endpoints
|
|
- Discrepancia: +22 SIN CONTAR (+12%)
|
|
|
|
FRONTEND:
|
|
- Documentado: 90 componentes
|
|
- Real: 146 componentes
|
|
- Discrepancia: +56 SIN CONTAR (+62%)
|
|
```
|
|
|
|
---
|
|
|
|
## 5. IMPACTO Y SEVERIDAD
|
|
|
|
### 5.1 Severidad por Tipo de Discrepancia
|
|
|
|
| Problema | Severidad | Impacto | Afectados |
|
|
|----------|-----------|--------|-----------|
|
|
| Duplicación notifications table | 🔴 CRÍTICO | Integridad referencial | DDL, API, Client |
|
|
| Conteo endpoints incorrecto | 🔴 CRÍTICO | Documentación interna invalida | Backend, QA |
|
|
| Conteo componentes incorrecto | 🔴 CRÍTICO | Tracking de progreso incorrecto | Frontend, PM |
|
|
| OQI-007 sin módulo backend | 🟠 MAYOR | Feature incompleta | Arquitectura |
|
|
| OQI-008 sin módulo backend | 🟠 MAYOR | Feature incompleta | Arquitectura |
|
|
| OQI-009 sin feature separada | 🟠 MAYOR | Confusión organizacional | Frontend |
|
|
| Enums duplicados | 🟠 MAYOR | Inconsistencia modelo | DDL, Backend |
|
|
| Distribution job sin link | 🟡 MENOR | Rastreabilidad reducida | DevOps, Backend |
|
|
|
|
### 5.2 Timeline de Impacto
|
|
|
|
**Hoy (Bloquea QA/Deploy):**
|
|
- Conteos incorrectos impiden validar completitud
|
|
- Duplicación de tables causa inconsistencias DDL
|
|
|
|
**Esta Semana (Bloquea nuevas features):**
|
|
- Falta módulos para OQI-007 y OQI-008 impide desarrollo
|
|
- Endpoints faltantes rompen testing automatizado
|
|
|
|
**Este Sprint (Acumula deuda técnica):**
|
|
- Inventarios inaccurados = decisiones de arquitectura incorrectas
|
|
- Documentación desincronizada = onboarding lento
|
|
|
|
---
|
|
|
|
## 6. PLAN DE ACCIÓN RECOMENDADO
|
|
|
|
### FASE 1: Validación y Corrección (P0 - Crítico)
|
|
|
|
**Duración Estimada:** 4 horas
|
|
|
|
#### 1.1 DATABASE_INVENTORY.yml
|
|
|
|
- [ ] Resolver duplicación: notifications en público vs auth
|
|
- Decision: Consolidar en QUÉ esquema
|
|
- Actualizar DDL
|
|
- Referenciar desde el otro esquema si necesario
|
|
|
|
- [ ] Consolidar enums de notificaciones
|
|
- Unificar: notification_type_enum + notification_type
|
|
- Ubicación única y source of truth
|
|
- Actualizar todas las tablas que usan
|
|
|
|
- [ ] Contar correctamente
|
|
- Total schemas: ¿13 o 14? (con auth separado)
|
|
- Total tablas: Confirmar 95 o actualizar a 96/87
|
|
- Recount de índices, triggers, funciones
|
|
|
|
#### 1.2 BACKEND_INVENTORY.yml
|
|
|
|
- [ ] Actualizar summary ejecutivo
|
|
- total_modules: 12 → 13 (notifications)
|
|
- total_endpoints_estimated: 57 → 79 (real)
|
|
- total_services: 34 → 36 (real)
|
|
|
|
- [ ] Reclasificar notifications en MODULOS (L50-415)
|
|
- Sacar de notifications_module (L644)
|
|
- Agregar como módulo formal
|
|
- Actualizar epic_mapping (L531)
|
|
|
|
- [ ] Documentar endpoints faltantes por módulo
|
|
- users: +2 endpoints
|
|
- education: +4 endpoints
|
|
- trading: +6 endpoints
|
|
- investment: +3 endpoints
|
|
- admin: +3 endpoints
|
|
- (crear lista completa)
|
|
|
|
#### 1.3 FRONTEND_INVENTORY.yml
|
|
|
|
- [ ] Actualizar summary ejecutivo
|
|
- total_components: 90 → 146
|
|
- total_pages: 18 → 22 (confirmar)
|
|
- total_features: 9 → 10 (agregar OQI-007 o confirmar)
|
|
|
|
- [ ] Reorganizar features para OQI-007
|
|
- Crear sección `assistant` o `llm-agent`
|
|
- Mover 18 componentes bajo esta sección
|
|
- Agregar página principal
|
|
|
|
- [ ] Clarificar OQI-009
|
|
- Documentar explícitamente bajo trading o como feature
|
|
- Actualizar epic_mapping con posición clara
|
|
- Contar 13 componentes en summary
|
|
|
|
### FASE 2: Validación Cross-Layer (P1 - Alto)
|
|
|
|
**Duración Estimada:** 6 horas
|
|
|
|
- [ ] Validar épicas incompletas
|
|
- OQI-007: ✓ Database, ❌ Backend módulo, ⚠️ Frontend feature
|
|
- OQI-008: ✓ Database, ❌ Backend módulo, ❌ Frontend feature
|
|
- Plan: crear módulos/features faltantes
|
|
|
|
- [ ] Validar endpoints vs componentes
|
|
- Cada endpoint debe tener componente frontend
|
|
- Cada componente debe llamar un endpoint
|
|
- Crear matriz de cobertura
|
|
|
|
- [ ] Validar enums sincronizados
|
|
- Backend constants vs Database DDL
|
|
- Frontend tipos vs Backend respuestas
|
|
- Crear lista de enums a sincronizar
|
|
|
|
### FASE 3: Documentación y Procesos (P2 - Mediano)
|
|
|
|
**Duración Estimada:** 4 horas
|
|
|
|
- [ ] Crear script de validación
|
|
- Input: tres inventarios YAML
|
|
- Output: reporte de discrepancias
|
|
- Ejecutar en pre-commit hooks
|
|
|
|
- [ ] Crear procedimiento de actualización
|
|
- Cuándo actualizar cada inventario
|
|
- Quién es responsable
|
|
- Validaciones antes de commit
|
|
|
|
- [ ] Documentar en CLAUDE.md local
|
|
- Agregar instrucciones de mantenimiento
|
|
- Incluir checklists de validación
|
|
- Registrar cambios principales
|
|
|
|
---
|
|
|
|
## 7. DEFINICIÓN DE ESTADOS DE SINCRONIZACIÓN
|
|
|
|
```yaml
|
|
✓ SINCRONIZADO:
|
|
- Inventario documentado = Realidad del código
|
|
- Versión actualizada (últimos 7 días)
|
|
- Conteos verificados
|
|
- Ejemplo: Database.education (12 tablas ✓)
|
|
|
|
⚠️ PARCIALMENTE SINCRONIZADO:
|
|
- Algunas secciones al día, otras desactualizadas
|
|
- Pequeños gaps (<10% de discrepancia)
|
|
- Requiere correcciones menores
|
|
- Ejemplo: Backend.auth (13 endpoints ✓ pero notifications no contado)
|
|
|
|
❌ DESINCRONIZADO:
|
|
- Diferencias mayores (>10% discrepancia)
|
|
- Información contraductoria
|
|
- Requiere actualización completa
|
|
- Ejemplo: Frontend (90 vs 146 componentes = +62%)
|
|
|
|
🔴 CRÍTICO:
|
|
- Discrepancias que afectan integridad de datos
|
|
- Duplicaciones o inconsistencias semánticas
|
|
- Impiden correcta ejecución de tests
|
|
- Ejemplo: Database.notifications duplicación
|
|
```
|
|
|
|
---
|
|
|
|
## 8. MÉTRICAS DE CALIDAD
|
|
|
|
### 8.1 Índice de Sincronización por Inventario
|
|
|
|
```
|
|
DATABASE_INVENTORY.yml:
|
|
- Tablas: 87/87 ✓ 100%
|
|
- Enums: 28/31 = 90% (falta 3: notification_priority, push_platform, sync_status)
|
|
- Índices: 157/157 ✓ 100%
|
|
- Triggers: 35/37 = 95% (falta 2)
|
|
- Funciones: 7/9 = 78% (falta 2 complejas)
|
|
- Schemas: 13/14 = 93% (falta aclarar auth)
|
|
┌──────────────────────┐
|
|
│ SCORE: 92% SINCRONIZADO │
|
|
└──────────────────────┘
|
|
|
|
BACKEND_INVENTORY.yml:
|
|
- Módulos: 12/13 = 92% (falta notifications en modelos)
|
|
- Endpoints documentados: 57/79 = 72% (faltan 22)
|
|
- Servicios: 34/36 = 94%
|
|
- Controladores: 23/23 = 100%
|
|
┌──────────────────────┐
|
|
│ SCORE: 89% SINCRONIZADO │
|
|
└──────────────────────┘
|
|
|
|
FRONTEND_INVENTORY.yml:
|
|
- Features: 9/10 = 90% (falta OQI-007 como feature)
|
|
- Páginas: 22/22 = 100% (estimado)
|
|
- Componentes: 90/146 = 62% (faltan 56)
|
|
- Hooks: 3/3 = 100%
|
|
- Stores: 2/2 = 100%
|
|
┌──────────────────────┐
|
|
│ SCORE: 88% SINCRONIZADO │
|
|
└──────────────────────┘
|
|
|
|
PROMEDIO GENERAL: 90% SINCRONIZACIÓN
|
|
Status: ⚠️ ACEPTABLE PERO REQUIERE ACCIÓN
|
|
```
|
|
|
|
---
|
|
|
|
## 9. CHECKLIST DE VALIDACIÓN
|
|
|
|
### Pre-Update Checklist
|
|
|
|
- [ ] Revisar cambios recientes en codebase
|
|
- [ ] Contar tablas/endpoints/componentes reales
|
|
- [ ] Consultar git log para entender cambios
|
|
- [ ] Validar que los números sean consistentes
|
|
|
|
### Post-Update Checklist
|
|
|
|
- [ ] Validar YAML sintaxis
|
|
- [ ] Ejecutar conteos contra el código
|
|
- [ ] Revisar cross-references entre capas
|
|
- [ ] Actualizar épicas incompletas
|
|
- [ ] Commit con mensaje descriptivo
|
|
|
|
---
|
|
|
|
## 10. REFERENCES Y LIGAS
|
|
|
|
**Archivos Relacionados:**
|
|
- `DATABASE_INVENTORY.yml` - Inventario de base de datos
|
|
- `BACKEND_INVENTORY.yml` - Inventario de backend
|
|
- `FRONTEND_INVENTORY.yml` - Inventario de frontend
|
|
- `CLAUDE.md` - Directivas del proyecto
|
|
- `orchestration/tareas/` - Tareas relacionadas
|
|
|
|
**Épicas Afectadas:**
|
|
- OQI-007: LLM Strategy Agent (incompleta)
|
|
- OQI-008: Portfolio Manager (incompleta)
|
|
- OQI-009: MT4 Gateway (parcial)
|
|
|
|
---
|
|
|
|
## CONCLUSIÓN
|
|
|
|
Los inventarios del proyecto trading-platform están **90% sincronizados** pero tienen **discrepancias críticas** que deben resolverse antes de continuar con desarrollo:
|
|
|
|
1. **DATABASE:** Problemas de duplicación y enums (P0)
|
|
2. **BACKEND:** Conteos incorrectos y módulos faltantes (P0)
|
|
3. **FRONTEND:** Subconteo masivo de componentes (P0)
|
|
|
|
**Acción recomendada:** Ejecutar FASE 1 (Validación y Corrección) en las próximas 4 horas para restaurar confianza en documentación.
|
|
|
|
**Próximo reporte:** 2026-02-03 (después de correcciones)
|
|
|
|
---
|
|
|
|
**Generado por:** Claude Code
|
|
**Sistema:** SIMCO v4.0.0
|
|
**Fecha:** 2026-01-27
|
|
**Próxima revisión:** 2026-02-03
|