Primer commit
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
---
|
||||
id: CASE-2026-05-29-corrector-baserow-verificador
|
||||
fecha: 2026-05-29
|
||||
categoria: config_location
|
||||
location_ids: ["DB63 Baserow tablas 749/750", "WLPVTRxg7W074dfzBxZL (85956 PLAZA EL SALADO)", "nF1uEaYB3mCK5em9bPn2 (Eugenia, E2E)", "pMPs9M4RaGJvWwfIFVIo (Grand Plaza Toluca, creada)"]
|
||||
run_ids: ["baserow PATCH/POST 749+750 (8 acciones)"]
|
||||
snapshots: ["generated/migrations/baserow_mesa_control_fix_749_20260529_224430.json", "generated/migrations/baserow_verificador_fix_750_20260529_224430.json"]
|
||||
status: resuelto
|
||||
memorias: ["baserow_api_y_corrector", "n8n_2004_canal_origen_complemento", "super_script_fix_branch_user_origin", "erandi_intermediaria_mp"]
|
||||
playbooks: []
|
||||
---
|
||||
|
||||
## TRIGGERS
|
||||
- `Baserow`, `bsrow.consultoriae3.com`, `token-auth JWT`, `tabla 749`, `tabla 750`, `SC BUCEFALO`
|
||||
- `Verificador desactualizado`, `n8n no encuentra sucursal`, `match webhook 749 750`
|
||||
- `PLAZA EL SALADO 85932 85956`, `La Viga 58932`, `Eugenia MP -Eugenia espacio`, `REYNOSA 85958 85970`
|
||||
- `corrector baserow`, `cuentas_oficiales.csv`, `baserow_client.py`, `fix_baserow_verificador.py`
|
||||
- `pendientes Erandi SUCURSAL`
|
||||
|
||||
## SÍNTOMA
|
||||
El workflow n8n [2004] no llena sucursal/tienda (ni dispara el complemento de Canal de Origen) para varias sucursales porque el Verificador en Baserow está desactualizado. Confirmado en vivo: Eugenia se cortaba antes del PUT.
|
||||
|
||||
## DIAGNÓSTICO
|
||||
- Acceso a la API de Baserow (read-only) con email/password → JWT. DB 63 "Bucefalo": tabla 749 (Mesa de control: Nombre/Location_ID/API_token) y 750 (Verificador: SUCURSAL/TIENDA/SC BUCEFALO/ID LOCATION BUCEFALO/SC TOKEN BUCEFALO).
|
||||
- El match del workflow es `webhook location.name → 749.Nombre (7235) → 750.SC BUCEFALO (7247)`. Inspección de ejecuciones n8n (includeData) mostró: para Eugenia el Verificador 750 devolvía 0 filas porque `750.SC BUCEFALO="85974 - MP -Eugenia"` (sin espacio) ≠ `749.Nombre="85974 - MP - Eugenia"`.
|
||||
- Cruce con la **lista oficial** de cuentas (que el owner proveyó como `n8n/cuentas_oficiales.csv`, name↔location_id) reveló: 1 nombre malo en 749 (PLAZA EL SALADO con `85932`, real `85956`), 5 nombres mal en 750, 1 fila ausente (Grand Plaza Toluca), SUCURSAL vacíos. NOTA: usar la lista oficial, NO `parse_accounts_csv` (su `resolve_location_name` metía ruido, p.ej. doble espacio en Marina Nacional que no existía en GHL).
|
||||
|
||||
## CAUSA RAÍZ
|
||||
Baserow 749/750 con nombres desalineados del nombre real de la cuenta (typos de número, espacios, mayúsculas) → el match exacto del workflow falla y corta el flujo. Filas oficiales ausentes en 750.
|
||||
|
||||
## ACCIÓN
|
||||
Corrector `scripts/fix_baserow_verificador.py` (dry-run→apply, backup previo de 749 y 750). Fuente de verdad: `n8n/cuentas_oficiales.csv` para el nombre; Verificador CSV local para SUCURSAL/TIENDA. 8 acciones aplicadas 2026-05-29 (0 errores):
|
||||
- PATCH 749.Nombre PLAZA EL SALADO `85932`→`85956`.
|
||||
- PATCH 750.SC BUCEFALO: La Viga `58932`→`85932`, PLAZA EL SALADO `85932`→`85956`, TAPACHULA `85963-`→`85963 -`, REYNOSA `85958`→`85970`, Eugenia espacio.
|
||||
- PATCH 750.SUCURSAL METEPEC ← `Metepec, Estado de México` (CSV).
|
||||
- POST 750 fila nueva Grand Plaza Toluca.
|
||||
Filas 750 NO oficiales (Morelia 3 `rET7...`, segundo Grand Plaza `Xqpdy12...`) NO se tocaron. Cliente reusable `scripts/baserow_client.py`; auditoría `scripts/audit_baserow_verificador.py`.
|
||||
|
||||
## VERIFICACIÓN
|
||||
- Re-auditoría: `749.Nombre != oficial = 0`, `750.SC BUCEFALO != oficial = 0`, ausentes = 0.
|
||||
- E2E Eugenia: ensuciar canal de un WEB_USER → disparar webhook `8d574598` → en t+5s canal=SUCURSAL, sucursal='Narvarte Oriente, Ciudad de México', tienda='EUGENIA'. El [2004] ahora llega al PUT y el complemento corre.
|
||||
|
||||
## EDGE-CASES / TRAMPAS
|
||||
- NO usar `parse_accounts_csv`/`resolve_location_name` como fuente de nombres (ruido: doble espacios). Usar la lista oficial provista.
|
||||
- El nombre debe coincidir EXACTO en los 3 puntos (webhook, 749, 750); un espacio o dígito rompe el match.
|
||||
- SUCURSAL/TIENDA sin fuente NO se inventan → lista para Erandi.
|
||||
|
||||
## REUTILIZABLE
|
||||
```python
|
||||
from scripts.baserow_client import BaserowClient
|
||||
c = BaserowClient.from_credentials()
|
||||
rows = c.list_rows(750) # user_field_names
|
||||
c.update_row(750, row_id, {"SC BUCEFALO": "..."}, dry_run=True)
|
||||
```
|
||||
|
||||
## PENDIENTES
|
||||
- **Erandi:** completar en Baserow 750 el `SUCURSAL` de SENDERO, Independencia, Isidro Fabela, Grand Plaza Toluca (+`TIENDA` de Grand Plaza Toluca). Lista: `generated/reports/baserow_pendientes_erandi.json`.
|
||||
- Decidir si las 2 filas 750 no oficiales (Morelia 3, segundo Grand Plaza) deben borrarse o si esas cuentas se dan de alta oficialmente.
|
||||
|
||||
## ENLACES
|
||||
- Scripts: `scripts/baserow_client.py`, `scripts/audit_baserow_verificador.py`, `scripts/fix_baserow_verificador.py`. Fuente: `n8n/cuentas_oficiales.csv`.
|
||||
- Backups: `generated/migrations/baserow_*_20260529_224430.json`. Lista Erandi: `generated/reports/baserow_pendientes_erandi.json`.
|
||||
- Memorias: [[baserow_api_y_corrector]], [[n8n_2004_canal_origen_complemento]], [[erandi_intermediaria_mp]].
|
||||
Reference in New Issue
Block a user