feat(F-161): completed feature
This commit is contained in:
16
work/artifacts/F-161/architect.md
Normal file
16
work/artifacts/F-161/architect.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# F-161 — Diseño
|
||||
|
||||
## Auth boundary
|
||||
`registerCheckoutRoutes` recibe `createSessionAuthenticator` (identity) en lugar de `combinedAuth`. Las rutas admin/orders permanecen combined porque sirven ambos contextos; checkout es customer-only.
|
||||
|
||||
## Read model
|
||||
`PgOrderRepository.findById` y `findByIdAndUserId` añaden `users_profiles` y resuelven:
|
||||
- nombre: snapshot `orders_orders.customer_name` → perfil.
|
||||
- teléfono: snapshot → perfil → identity.
|
||||
- email: identity user.
|
||||
|
||||
## UI
|
||||
Las cuatro tarjetas de información siempre se renderizan. Si el backend no tiene una transacción o dirección de facturación, se comunica «No registrado»/«Misma que envío» en vez de ocultar la sección.
|
||||
|
||||
## Datos existentes
|
||||
El único pedido afectado, creado segundos después del perfil/dirección del cliente, se reasocia al identity user correspondiente. No se crea una migración heurística general.
|
||||
3
work/artifacts/F-161/documenter.md
Normal file
3
work/artifacts/F-161/documenter.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# F-161
|
||||
|
||||
El detalle admin muestra siempre Cliente, Dirección de envío, Dirección de facturación y Pago. Los datos no registrados se indican expresamente. Checkout queda ligado solo a la sesión customer.
|
||||
14
work/artifacts/F-161/implementer.md
Normal file
14
work/artifacts/F-161/implementer.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# F-161 — Implementer
|
||||
|
||||
## Cambios
|
||||
- Checkout usa auth identity y ya no puede asignar pedidos al backoffice cuando coexisten cookies.
|
||||
- Read model une `users_profiles` y resuelve nombre/teléfono con snapshots como prioridad.
|
||||
- `toOrder` vuelve a exponer `customerName/customerPhone` (se estaban descartando).
|
||||
- Admin usa `/orders/:id/admin`, no el endpoint customer limitado al propietario.
|
||||
- Cliente, envío, facturación y pago siempre se muestran con fallbacks explícitos.
|
||||
- Pedido local afectado reasociado al customer correcto.
|
||||
|
||||
## Evidencia
|
||||
- 6/6 tests target PASS; tsc PASS; admin build PASS.
|
||||
- Runtime: email `info@rikrdo.es`, nombre `Ricardo Echeverriabarrena`, teléfono y dirección Benahavis presentes.
|
||||
- Facturación/pago ausentes aparecen como no registrados.
|
||||
1
work/artifacts/F-161/leader-close.json
Normal file
1
work/artifacts/F-161/leader-close.json
Normal file
@@ -0,0 +1 @@
|
||||
{"feature_id":"F-161","agent":"leader","stage":"close","verdict":"APPROVED","summary":"Order detail and checkout ownership fixed.","checks":[{"item":"all gates","ok":true},{"item":"runtime data","ok":true},{"item":"build/tests","ok":true}],"issues":[]}
|
||||
1
work/artifacts/F-161/qa.json
Normal file
1
work/artifacts/F-161/qa.json
Normal file
@@ -0,0 +1 @@
|
||||
{"feature_id":"F-161","agent":"qa","stage":"qa_gate","verdict":"APPROVED","summary":"Detalle runtime contiene cliente y envío; tarjetas de facturación/pago muestran fallback.","checks":[{"item":"email/name/phone","ok":true},{"item":"shipping address","ok":true},{"item":"missing data fallback","ok":true},{"item":"tests/build","ok":true}],"issues":[]}
|
||||
1
work/artifacts/F-161/reviewer.json
Normal file
1
work/artifacts/F-161/reviewer.json
Normal file
@@ -0,0 +1 @@
|
||||
{"feature_id":"F-161","agent":"reviewer","stage":"review_gate","verdict":"APPROVED","summary":"Se corrige la causa de ownership y el detalle deja de ocultar secciones.","checks":[{"item":"auth boundary","ok":true},{"item":"read model","ok":true},{"item":"admin endpoint","ok":true},{"item":"build/tests","ok":true}],"issues":[]}
|
||||
1
work/artifacts/F-161/security.json
Normal file
1
work/artifacts/F-161/security.json
Normal file
@@ -0,0 +1 @@
|
||||
{"feature_id":"F-161","agent":"security","stage":"security_gate","verdict":"APPROVED","summary":"Checkout queda aislado a identity auth; detalle admin sigue protegido por rol admin.","checks":[{"item":"customer ownership","ok":true},{"item":"admin RBAC","ok":true},{"item":"no PII exposure to customer route","ok":true}],"issues":[]}
|
||||
@@ -1,14 +1,16 @@
|
||||
# Feature activa: F-160 — Fix Reporting sales grouped queries returning 500
|
||||
# Feature activa: F-161 — Complete admin order detail information
|
||||
|
||||
## Causa raíz
|
||||
`runSalesQuery` concatena `${selectExpr}` directamente antes de `COUNT(...)` sin coma, generando SQL inválido en todos los grupos. Además, el grupo `terminal` selecciona `o.store_id` pero agrupa solo por `terminal_id`.
|
||||
## Diagnóstico
|
||||
El pedido existente se creó con `user_id` de `backoffice_users` porque Checkout usa `combinedAuth`, que prioriza `backoffice_session` si ambos cookies existen. Por eso el JOIN a `identity_users` no encuentra email, perfil ni dirección. La UI además oculta por completo Cliente, Direcciones y Pago cuando faltan datos.
|
||||
|
||||
## Solución
|
||||
- Añadir coma explícita tras las columnas dimensionales.
|
||||
- Agrupar terminal por `store_id, terminal_id`.
|
||||
- Añadir tests de integración del servicio SQL real para day/channel/store/terminal.
|
||||
- Checkout debe usar exclusivamente el autenticador de identidad/customer.
|
||||
- El detalle obtiene nombre/teléfono desde `users_profiles` como fallback.
|
||||
- Las tarjetas Cliente, Envío, Facturación y Pago siempre aparecen, mostrando estado explícito cuando un dato no fue registrado.
|
||||
- Reparar la asociación del pedido local afectado con el cliente correcto.
|
||||
|
||||
## Aceptación
|
||||
- Los cuatro endpoints usados por Dashboard responden 200.
|
||||
- No hay interpolación de valores del usuario; solo expresiones de enum controlado.
|
||||
- Build, tests y verify pasan.
|
||||
- El pedido muestra email, nombre, teléfono y dirección de envío.
|
||||
- No aparece el falso aviso «El cliente no tiene email asociado».
|
||||
- Pago/facturación ausentes se muestran como «No registrado», no desaparecen.
|
||||
- Futuros checkouts no usan sesiones backoffice.
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
{
|
||||
"feature_id": "F-160",
|
||||
"feature_id": "F-161",
|
||||
"stage": "close",
|
||||
"agent": "leader",
|
||||
"action": "Close Reporting sales fix",
|
||||
"action": "Close complete order detail fix",
|
||||
"state": "running",
|
||||
"next_agent": "leader",
|
||||
"waiting_for": "Seleccionar una feature pending y actualizar este estado",
|
||||
"updated_at": "2026-08-22T16:05:20Z",
|
||||
"updated_at": "2026-08-22T16:13:24Z",
|
||||
"timeline": [
|
||||
{
|
||||
"ts": "2026-08-22T16:02:17Z",
|
||||
"ts": "2026-08-22T16:05:41Z",
|
||||
"agent": "leader",
|
||||
"stage": "intake",
|
||||
"state": "running",
|
||||
"message": "Diagnose grouped Reporting sales SQL 500"
|
||||
"message": "Audit order detail customer, shipping and payment data"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:02:44Z",
|
||||
"ts": "2026-08-22T16:07:57Z",
|
||||
"agent": "architect",
|
||||
"stage": "design",
|
||||
"state": "running",
|
||||
"message": "Specify grouped sales SQL correction"
|
||||
"message": "Design customer-only checkout auth and complete detail fallbacks"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:03:01Z",
|
||||
"ts": "2026-08-22T16:08:21Z",
|
||||
"agent": "implementer",
|
||||
"stage": "build",
|
||||
"state": "running",
|
||||
"message": "Fix grouped sales SQL and add regression coverage"
|
||||
"message": "Fix checkout ownership and order detail read model"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:04:34Z",
|
||||
"ts": "2026-08-22T16:12:38Z",
|
||||
"agent": "reviewer",
|
||||
"stage": "review_gate",
|
||||
"state": "running",
|
||||
"message": "Review SQL regression fix"
|
||||
"message": "Review order ownership and detail completeness"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:04:45Z",
|
||||
"ts": "2026-08-22T16:12:50Z",
|
||||
"agent": "security",
|
||||
"stage": "security_gate",
|
||||
"state": "running",
|
||||
"message": "Verify SQL parameterization remains safe"
|
||||
"message": "Verify customer ownership isolation"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:04:57Z",
|
||||
"ts": "2026-08-22T16:13:04Z",
|
||||
"agent": "qa",
|
||||
"stage": "qa_gate",
|
||||
"state": "running",
|
||||
"message": "Validate grouped reporting endpoints"
|
||||
"message": "Validate order customer/address/payment sections"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:05:11Z",
|
||||
"ts": "2026-08-22T16:13:13Z",
|
||||
"agent": "documenter",
|
||||
"stage": "document",
|
||||
"state": "running",
|
||||
"message": "Record Reporting SQL fix"
|
||||
"message": "Document complete order detail"
|
||||
},
|
||||
{
|
||||
"ts": "2026-08-22T16:05:20Z",
|
||||
"ts": "2026-08-22T16:13:24Z",
|
||||
"agent": "leader",
|
||||
"stage": "close",
|
||||
"state": "running",
|
||||
"message": "Close Reporting sales fix"
|
||||
"message": "Close complete order detail fix"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user