diff --git a/README.md b/README.md index 8a2dddb..4dc4787 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ graph TD ## Arquitectura de la cola persistente (MVP) - Estados: queued | processing | sent | failed. -- Campos mínimos por mensaje: id (PK), recipient, type (text), message, status, attempts (0), last_error (nullable), created_at, updated_at. +- Campos actuales por mensaje: id (PK), recipient, message, status, attempts (0), last_error (nullable), metadata (nullable), created_at, updated_at. - Índices recomendados: (status, created_at) para seleccionar pendientes rápidamente. - Sin orden estricto por chat; el envío puede intercalarse entre destinatarios. - Concurrencia: N workers globales operando en bucle, cada uno toma mensajes en estado queued y los marca processing. @@ -102,7 +102,7 @@ Estado: la tabla response_queue ya está creada e incluida en los tests de DB. - Builds response with assignment list and includes Evolution API “mentioned” JIDs via `ResponseQueue`. - Task persistence service (`src/tasks/service.ts`) with `created_by` and assignment inserts in a transaction; supports DB injection for tests. - Response queue persistente con workers en background y envío vía Evolution API (`src/services/response-queue.ts`), persistiendo metadata `{ mentioned: [...] }` y enviándola como `mentioned` en el payload. -- Contacts service and friendly names: `ContactsService` resolves display names via webhooks (CONTACTS_UPDATE/CHATS_UPDATE) and Evolution API fallback; used to render names in outgoing texts (falls back to numbers). +- Contacts service and friendly names: `ContactsService` resolves display names via webhooks (CONTACTS_UPDATE/CHATS_UPDATE) and Evolution API fallback; used to render names in outgoing texts (falls back to numbers). Skips network calls under NODE_ENV=test for fast and isolated unit tests. - Notification UX: DM acknowledgment to creator (skipped if creator is the only assignee), DM to each assignee; optional group notification controlled by `NOTIFY_GROUP_ON_CREATE` (default false) with proper mentions. - Environment variable validation (`src/server.ts`, `src/services/webhook-manager.ts`). - Health check endpoint (`/health`). @@ -213,7 +213,7 @@ bun test - WhatsApp ID normalization (`whatsapp.test.ts`). - Group sync operations (`group-sync.test.ts`). - **Needed:** Tests for `ensureUserExists` integration, `isGroupActive` integration, `CommandService` logic, `ResponseQueue` processing (mocking API), `TaskService` operations. -- Tests mostly pass; currently 1 failing test: “Database > Table Schemas > response_queue table should have required columns”. +- All unit tests passing. ## 🧑‍💻 Contributing 1. Fork the repository diff --git a/STATUS.md b/STATUS.md index 8c77900..708ec6a 100644 --- a/STATUS.md +++ b/STATUS.md @@ -23,9 +23,9 @@ - **Comandos** - `/tarea nueva` end-to-end: parseo de descripción y última fecha futura, extracción de asignados desde menciones y tokens `@...`, limpieza de la descripción, persistencia de tarea y asignaciones, y respuesta con menciones. - **Contactos y Nombres** - - Servicio `ContactsService` con caché en memoria (TTL) y actualización por webhooks (CONTACTS_UPDATE/CHATS_UPDATE); fallback a Evolution API para obtener nombres. Se usa para mostrar nombres en los textos (con fallback a números). + - Servicio `ContactsService` con caché en memoria (TTL) y actualización por webhooks (CONTACTS_UPDATE/CHATS_UPDATE); fallback a Evolution API para obtener nombres. Se usa para mostrar nombres en los textos (con fallback a números). En entorno de test evita llamadas de red para acelerar y aislar la suite. - **UX de Notificaciones** - - Confirmación por DM al creador (omitida si es el único asignado) y DM a cada asignado. + - Confirmación por DM al creador siempre (en una sola línea con id y descripción) y DM a cada asignado (excluyendo al creador). - Notificación opcional al grupo controlada por `NOTIFY_GROUP_ON_CREATE` (false por defecto), incluyendo menciones para visibilidad. - **Validaciones de Usuario** - Integración completa de normalización y `ensureUserExists` en el flujo principal de mensajes @@ -65,4 +65,4 @@ - `src/server.ts` ## Commit history and status -- Latest status: One schema test still failing; DM notifications to creator/assignees implemented; optional group notify disabled by default; basic name resolution via ContactsService integrated. +- Latest status: All unit tests passing; ACK to creator always in single-line format; optional group notify disabled by default; ContactsService avoids network calls under tests; basic name resolution via ContactsService integrated.