docs: sync FASES_IMPLEMENTADAS.md with actual project status

- Moved completed items from this session to 'Completados recientemente'
- Cleared critical debt section (PostgreSQL restart done)
- Marked stubs as 'creado' with file references
- Added new polish items: Grafana dashboards, Alertmanager, SW improvements
- Updated infrastructure table with Prometheus/Grafana
This commit is contained in:
2026-04-29 06:44:27 +00:00
parent ca239a458b
commit f78d4c9b44

View File

@@ -1,6 +1,6 @@
# Nexus POS — Resumen de Fases Implementadas
**Fecha:** 2026-04-26
**Fecha:** 2026-04-29
**Versión DB:** v3.2
**Tests:** 73/73 pasando (pytest)
@@ -17,8 +17,6 @@
## FASE 3: Multi-sucursal + Alertas + Garantías
### Migración: v2.2
| Feature | Archivos | Endpoints |
|---------|----------|-----------|
| **Multi-sucursal** | `inventory_engine.py`, `inventory_bp.py` | `GET /pos/api/inventory/stock-by-branch`, `POST /pos/api/inventory/transfers`, `POST /pos/api/inventory/sync-prices` |
@@ -27,8 +25,6 @@
## FASE 4: Infraestructura + Escalabilidad
### Migraciones: v1.9, v2.0, v2.1, v2.3
| Feature | Archivos | Infra |
|---------|----------|-------|
| **Redis Cache** | `redis_stock_cache.py`, `inventory_engine.py` | Redis 8.0.2, TTL 300s, fallback a PostgreSQL |
@@ -39,8 +35,6 @@
## FASE 5: CRM + Service Orders + Imágenes
### Migraciones: v2.4, v2.5, v2.6
| Feature | Archivos | Capacidades |
|---------|----------|-------------|
| **CRM Mejorado** | `crm_engine.py`, `crm_bp.py` | Activities timeline, tags de segmentación, loyalty program (bronze/silver/gold/platinum), analytics (LTV, churn risk, categorías favoritas) |
@@ -53,8 +47,6 @@
## FASE 6: Notificaciones + Ahorro + Logística + API Pública
### Migraciones: v2.7, v2.8, v2.9, v3.0
| Feature | Archivos | Capacidades |
|---------|----------|-------------|
| **Notificaciones** | `notification_engine.py`, `notification_bp.py` | Templates por evento+canal, dispatch automático (push/WhatsApp/email/in-app), logs con estados, eventos: low_stock, order_ready, maintenance_due, new_sale, po_received, reorder_alert, warranty_expiring |
@@ -64,8 +56,6 @@
## FASE 7: Performance Optimización
### Migración: v3.2
| Sub-fase | Archivos | Optimizaciones |
|----------|----------|----------------|
| **7a — Quick Wins Frontend** | `nginx/nexus-pos.conf`, `pos/templates/*.html`, `pos/static/js/catalog.js` | gzip nginx, `defer` en scripts, fix `innerHTML +=` (8 lugares), event delegation cart, AbortController, sessionStorage cache years/brands |
@@ -116,14 +106,17 @@
| Servicio | Versión | Puerto | Estado |
|----------|---------|--------|--------|
| PostgreSQL | 17 | 5432 | ✅ Master + 2 tenants |
| PostgreSQL | 17 | 5432 | ✅ Optimizado (8GB shared_buffers, 64MB work_mem, 8GB max_wal_size) |
| Redis | 8.0.2 | 6379 | ✅ Stock cache + classify cache |
| Meilisearch | v1.12 | 7700 | ✅ 1,546,976 documentos |
| Metabase | v0.53 | 3000 | ✅ Dashboard ID 2 |
| Nginx | — | 80/443 | ✅ gzip, cache 6M, auto-serve .min |
| Gunicorn | — | 5001 | ✅ gthread, 4×4, max_requests=1000 |
| Gunicorn POS | — | 5001 | ✅ systemd `nexus-pos.service`, gthread 4×4 |
| Gunicorn Dashboard | — | 5000 | ✅ systemd `nexus.service` |
| Quart Catalog | — | 5002 | ✅ systemd `nexus-quart.service`, hypercorn |
| Celery | — | — | ✅ 4 prefork workers, broker redis://localhost:6379/1 |
| Quart async catalog | hypercorn | 5002 | ✅ systemd `nexus-quart.service`, nginx upstream `/pos/api/catalog/async-search` |
| Prometheus | v2.51 | 9090 | ✅ Docker, node/postgres/redis exporters |
| Grafana | v10.4 | 3001 | ✅ Docker, auto-provisioned Prometheus datasource |
---
@@ -172,8 +165,15 @@ METABASE_URL=http://localhost:3000
| — | **Arreglar `scripts/minify-assets.sh`** | 2026-04-26 | `b829e4f` |
| — | **Dashboard outage fix (env vars + static files)** | 2026-04-26 | `27cb4ee` |
| — | **IA por Voz (STT + TTS) en POS y Dashboard** | 2026-04-26 | `afb3b24` |
| — | **Fix chat.js null reference (`chatTtsToggle`)** | 2026-04-26 | |
| — | **Optimizar PostgreSQL config** | 2026-04-26 | — |
| — | **Fix chat.js null reference (`chatTtsToggle`)** | 2026-04-29 | `44c3a6c` |
| — | **Optimizar PostgreSQL config + restart** | 2026-04-29 | — |
| — | **Cache warming systemd timer** | 2026-04-29 | `c766571` |
| — | **Monitoreo Prometheus + Grafana** | 2026-04-29 | `4b3b0f8` |
| — | **PWA install prompt** | 2026-04-29 | `3b8224d` |
| — | **Playwright E2E tests** | 2026-04-29 | `c4db5e7` |
| — | **Dashboard in-app charts** | 2026-04-29 | `12989e3` |
| — | **Stubs BNPL / ERP / WhatsApp Cloud / Supplier Portal** | 2026-04-29 | `2cfe4b3` |
| — | **nexus-pos.service systemd** | 2026-04-29 | `c766571` |
---
@@ -181,38 +181,34 @@ METABASE_URL=http://localhost:3000
### 🔴 Crítico — Deuda Técnica
| # | Mejora | Descripción | Bloqueo |
|---|--------|-------------|---------|
| 1 | **PostgreSQL restart para aplicar config** | `shared_buffers=8GB`, `work_mem=64MB`, `max_wal_size=8GB` configurados. Requiere `systemctl restart postgresql` (downtime ~30s). | Ventana de mantenimiento |
*Sin items críticos pendientes.*
### 🟠 Alto — Features de Negocio
### 🟠 Alto — Features de Negocio (requieren integración con terceros)
| # | Mejora | Descripción | Esfuerzo |
|---|--------|-------------|----------|
| 2 | **WhatsApp Business API (Meta Cloud)** | Actualmente solo webhook Baileys. Migrar a Meta Cloud API para escalabilidad real. Requiere verificación de cuenta Meta. | 2-3 semanas |
| 3 | **BNPL real** | Integrar APLAZO/Kueski/Clip para "compra ahora, paga en 15/30 días". Ahora solo es stub. | 2 semanas |
| 4 | **ERP Sync real** | Conectar con Aspel/Contpaqi/SAP/Odoo vía API o archivos de intercambio. Ahora solo es stub. | 2-3 semanas |
| 5 | **Mercado Libre / Amazon sync** | Publicar inventario de bodegas en marketplaces. API de ML Seller + Amazon SP-API. | 3 semanas |
| 6 | **PWA mejorada** | Offline mode, install prompt, background sync para catálogo y carrito. | 1-2 semanas |
| # | Mejora | Descripción | Esfuerzo | Notas |
|---|--------|-------------|----------|-------|
| 1 | **WhatsApp Business API (Meta Cloud) real** | Migrar de Baileys a Meta Cloud API. Requiere verificación de cuenta Meta, Business Manager, número de teléfono verificado. | 2-3 semanas | Stub creado (`whatsapp_cloud_bp.py`) |
| 2 | **BNPL real** | Integrar APLAZO/Kueski/Clip con credenciales de sandbox/producción. | 2 semanas | Stub creado (`bnpl_bp.py`) |
| 3 | **ERP Sync real** | Conectar Aspel/CONTPAQi/SAP/Odoo vía API o archivos de intercambio. | 2-3 semanas | Stub creado (`erp_bp.py`) |
| 4 | **Mercado Libre / Amazon sync** | Publicar inventario de bodegas en marketplaces. API de ML Seller + Amazon SP-API. | 3 semanas | No iniciado |
### 🟡 Medio — Diferenciadores
| # | Mejora | Descripción | Esfuerzo |
|---|--------|-------------|----------|
| 7 | **App móvil nativa (Capacitor)** | Wrap del POS como app iOS/Android. Camera nativa, push notifications, biometrics. | 3-4 semanas |
| 8 | **Portal de proveedores** | Dashboard para que proveedores vean demanda por zona y tipo de parte. | 2 semanas |
| 9 | **Dashboard in-app** | Gráficos de rendimiento en tiempo real (ventas, productividad, conversión) en el POS. | 1-2 semanas |
| 10 | **Crédito basado en comportamiento** | Evaluación automática de línea de crédito por historial de pagos del cliente. | 2 semanas |
| 11 | **Programa de embajadores** | Referidos con recompensas, tracking de conversiones. | 1 semana |
| 5 | **App móvil nativa (Capacitor)** | Wrap del POS como app iOS/Android. Camera nativa, push notifications, biometrics. | 3-4 semanas |
| 6 | **Crédito basado en comportamiento** | Evaluación automática de línea de crédito por historial de pagos del cliente. | 2 semanas |
| 7 | **Programa de embajadores** | Referidos con recompensas, tracking de conversiones. | 1 semana |
### 🟢 Bajo — Polish
| # | Mejora | Descripción |
|---|--------|-------------|
| 12 | **Cache warming automatizado** | Agregar systemd timer/service para correr `warm_cache.py` diariamente (ahora es manual). |
| 13 | **Backup automatizado** | Último backup 2026-04-27. Automatizar con cron + S3/GCS. |
| 14 | **Monitoreo/Alerting** | Prometheus/Grafana o similar para gunicorn, PostgreSQL, Redis, Celery. |
| 15 | **Tests de integración frontend** | Playwright/Cypress para flujos críticos (checkout, búsqueda, login). |
| 8 | **Backup automatizado** | Último backup 2026-04-27. Automatizar con cron + S3/GCS. |
| 9 | **Grafana dashboards predefinidos** | Actualmente solo datasource auto-provisionado. Falta crear dashboards JSON para PostgreSQL, Redis, Gunicorn. |
| 10 | **Alertas Prometheus** | Alertmanager para notificaciones cuando PostgreSQL, Redis o Gunicorn fallen. |
| 11 | **Tests E2E adicionales** | Playwright: checkout, búsqueda de catálogo, flujo de inventario. |
| 12 | **Service Worker mejorado** | Background sync real para carrito offline, notificaciones push. |
---