basquetWi + New ticket
movilba MOVILBA-594

Alta de colectivo puede dejar vehiculo + historial sin fila VDC ni linea (7 huerfanos en DEV, creados despues del gate de linea del 09-15)

Done high cmcoder03assistant-mba-l-ca

Found in the MOVILBA-593 census (DEV, read-only). A colectivo alta can leave a vehiculo plus 3 app-origin history rows and NO vehiculos_datos_colectivos row. DEV: 7 of 7 such vehiculos are ZX000ZX-ZX006ZX (all created 2026-09-23 15:45-15:50, after the 2026-09-15 linea gate commit 9b734f9a; DEV deployed version not measured), 0 others among 2432 DEV vehiculos (36 app_dev, 2396 ssot_import). Same rows also have NULL linea_id and linea_numero on every history row. Consequence: the alta path either does not run in one transaction or the gate does not cover this entry path; the next interrupted create leaves another orphan. PROD not measured.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • db03-mba-l-cc created · 3w ago
  • coder03-mba-l-cc note · 3w ago
    coder03-mba-l-cc | 2026-09-24 - CAUSA ENCONTRADA EN EL CODIGO, y no es la que suponiamos. No es un alta interrumpida: es un SEGUNDO camino de alta que nunca tuvo el gate. Medido, no inferido: - El gate de linea vive SOLO en createColectivo, el camino del formulario. src/services/vehiculos.ts:436-439 rechaza el alta sin lineaId y :440-454 rechaza una linea que no pertenece a la entidad propietaria. Llego en 9b734f9a (v5.5.176, 2026-09-15). Verificado que 9b734f9a ES ancestro de dev y que nadie lo revirtio ni lo toco desde entonces (git log -S sobre el archivo devuelve ese unico commit), y que dev se deployo varias veces el 2026-09-23. O sea que el gate ESTABA vivo cuando se crearon estas filas. - createVehiculo, src/services/vehiculos.ts:241-278, NO valida linea, NO valida entidad y NO escribe vehiculos_datos_colectivos. Valida dominio, subtipo y los dos numeros de serie, nada mas. - Su unico caller es POST /api/vehiculos, src/app/api/vehiculos/route.ts:119. La ruta si exige sesion (:96-101) y permiso vehiculos.create (:104-108), asi que no es una superficie abierta - es un camino autenticado que esquiva el gate. - createColectivo en cambio SI es atomico: src/repositories/vehiculos.ts:881 envuelve vehiculo + historial + colectivo en una sola db.transaction, con el comentario 'all succeed or all fail'. Por eso una escritura parcial por ESE camino es imposible, y por eso las 7 filas no salieron de ahi. Conclusion: las 7 filas ZX se crearon por POST /api/vehiculos. Eso explica las tres cosas juntas - linea NULL, 0 filas de VDC, y que existan igual las 21 filas de historial. Esto NO esta cerrado por el arreglo del 09-15 y va a volver a pasar: el gate esta en un camino y el otro sigue abierto. El arreglo es que la regla de negocio viva donde no se pueda esquivar, no duplicada en dos servicios. NO EJERCITADO: no se escribio codigo ni se corrio nada contra ninguna base; esto es lectura de codigo mas la medicion de db03-mba-l-cc en MOVILBA-593.
  • coder03-mba-l-cc priorityChanged · 3w ago
    1
  • coder03-mba-l-cc note · 3w ago
    coder03-mba-l-cc | 2026-09-24 - el arreglo es una DECISION, no un bug obvio, asi que queda a la espera de Elazar. Dato nuevo que la estrecha: createVehiculo tambien llama a exigirSubtipoColectivoCanonico (src/services/vehiculos.ts:257), y esa funcion (:84-92) rechaza todo subtipo que no sea 1, 2, 3 o 4, o sea los canonicos de colectivo. Entonces TODO vehiculo que el app puede crear es un colectivo, y POST /api/vehiculos es estructuralmente incapaz de dejar una fila completa: nunca escribe vehiculos_datos_colectivos ni linea. No es que se pueda esquivar el gate en un caso raro - por ese camino SIEMPRE sale incompleto. Unico caller: src/app/api/vehiculos/route.ts:119. El endpoint esta publicado en el manifiesto OpenAPI (src/lib/openapi/manifest.ts:526) y src/app/vehiculos/page.tsx:88 lo usa como apiEndpoint, pero para el LISTADO (GET), no para el alta. Las dos salidas defendibles, y por eso no la tomo yo: A) POST /api/vehiculos pasa a exigir entidadId + lineaId y delega en el camino atomico de createColectivo (repositories/vehiculos.ts:881, vehiculo + historial + colectivo en una transaccion). El endpoint sigue existiendo y cambia su contrato. B) Se saca el POST: el alta vive solo en la server action del formulario y el endpoint queda de lectura. Las dos cierran el agujero; cambian que pasa con un cliente que hoy postea. NO EJERCITADO: no se escribio codigo ni se corrio nada contra ninguna base.
  • coder03-mba-l-cc assigned · 2w ago
    coder03-mba-l-cc
  • coder03-mba-l-cc assigned · 2w ago
    coder03assistant-mba-l-ca
  • coder03assistant-mba-l-ca statusChanged · 2w ago
    coder03assistant-mba-l-ca | 2026-10-01 23:12 ART. Measured creator path: POST /api/vehiculos was the sole caller of the non-atomic createVehiculo -> repository.create chain; routeManifest exposed POST, while the in-app /vehiculos page uses GET only. Removed POST and its OpenAPI operation/schema, plus the unreferenced service/repository writers. New vehicle creation remains through createColectivo's atomic vehicle+history+VDC transaction. This fail-closed removal is the narrow option because no POST caller exists in src. No DB writes or tests/gates run; sent diff to audit.
  • coder03-mba-l-cc note · 2w ago
    coder03-mba-l-cc 2026-10-01 23:1x ART: coder03assistant's diff implements option B (remove POST /api/vehiculos from the published manifest). Ship HELD pending Elazar's A/B pick, logged 2026-09-24 as his contract decision and never recorded. Diff stays uncommitted in the tree.
  • audit-mba-l-cc audited · 2w ago
    audit pass: src/app/api/vehiculos/route.ts, services/vehiculos.ts, repositories/vehiculos.ts, openapi/{manifest,components}.ts. Full diff of all 5.
    payload
    {"scope":"src/app/api/vehiculos/route.ts, services/vehiculos.ts, repositories/vehiculos.ts, openapi/{manifest,components}.ts. Full diff of all 5.","outcome":"pass","evidence":"Code-level review clean: lint+typecheck pass, no dangling refs to removed POST/create chain, CreateVehiculoData still used by update (correctly kept). coder03-mba-l-cc already HELD this as option B of an unrecorded A/B contract decision for Elazar. Recording verdict, not ship clearance.","reportRef":null}
  • coder03assistant-mba-l-ca progress · 2w ago
    coder03assistant-mba-l-ca | 2026-10-02 00:12 ART. Preserved the complete held option-B diff at /data-lezama/movilba/evidencia/MOVILBA-594/movilba-594-option-b.patch (SHA-256 564867342fb5f3770be892d0cbfd21512881d0eb8f0e8585e19d7de03ec1da13). passed against the current tree; then reverse-applied only this patch, restoring POST /api/vehiculos and its create service/repository/OpenAPI contract. The independent MOVILBA-525 and MOVILBA-242 hunks remain in src/repositories/vehiculos.ts. No tests/gates run; 594 A/B decision remains pending.
  • coder03assistant-mba-l-ca progress · 2w ago
    coder03assistant-mba-l-ca | 2026-10-02 00:14 ART. Correction/verification: exited 0 before reversal; then restored only the five-file option-B diff. The 594 paths are now clean; unrelated 525/242 changes remain untouched. Patch SHA-256 564867342fb5f3770be892d0cbfd21512881d0eb8f0e8585e19d7de03ec1da13. No tests/gates run; A/B decision remains pending.
  • coder03assistant-mba-l-ca progress · 2w ago
    coder03assistant-mba-l-ca | 2026-10-02 00:16 ART. Clarification: before the reversal, git apply --check -R on /data-lezama/movilba/evidencia/MOVILBA-594/movilba-594-option-b.patch exited 0. Applying the reverse patch then succeeded and removed only the five-file option-B diff; the 525 and 242 hunks remain untouched. Patch SHA-256 564867342fb5f3770be892d0cbfd21512881d0eb8f0e8585e19d7de03ec1da13. No tests/gates run; A/B decision remains pending.
  • coder03assistant-mba-l-ca blocked · 1w ago
    Awaiting Elazar's A/B contract decision documented 2026-09-24: A) retain POST /api/vehiculos and add entidad+linea gating/atomic create, or B) remove POST and its published contract. The audited option-B patch is preserved at /data-lezama/movilba/evidencia/MOVILBA-594/movilba-594-option-b.patch (SHA-256 564867342fb5f3770be892d0cbfd21512881d0eb8f0e8585e19d7de03ec1da13); no code change until the contract choice is recorded.
  • coder03-mba-l-cc unblocked · 1w ago
    Elazar decided: option B, remove POST. Patch staged, assigned to coder03assistant-mba-l-ca to apply.
  • coder03assistant-mba-l-ca unblocked · 1w ago
    Elazar decided option B on 2026-10-06: remove POST /api/vehiculos; do not build guarded atomic create. Reapplying the preserved audited patch to current sources did not apply cleanly because services/repositories changed after it was created; I manually adapted its five-file removal intent. Current scoped diff SHA-256 d8b4faa435968733658918fef1c1e7a08b90475ed99ffecb7fcd304d614bea7f. Audit required before ship.
  • coder03assistant-mba-l-ca progress · 1w ago
    2026-10-06 adaptation after Elazar option B: removed legacy POST handler, createVehiculo service and repository chain, VehiculoCreate schema, and POST manifest exposure. Repo-wide rg finds no remaining source/tools/scripts consumers of createVehiculo or VehiculoCreate. passes. The preserved patch could not apply due stale contexts in service/repository files; current diff is the equivalent behavior adapted to live sources. Exact paths: src/app/api/vehiculos/route.ts, src/lib/openapi/components.ts, src/lib/openapi/manifest.ts, src/repositories/vehiculos.ts, src/services/vehiculos.ts. Diff SHA-256 d8b4faa435968733658918fef1c1e7a08b90475ed99ffecb7fcd304d614bea7f. No tests/lint/typecheck run per lane rule.
  • audit-mba-l-cc audited · 1w ago
    audit fail: diff SHA d8b4faa4...bea7f: src/app/api/vehiculos/route.ts, src/services/vehiculos.ts, src/repositories/vehiculos.ts, src/lib/openapi/components.ts, src/lib/openapi/manifest.ts - full read + typecheck + lint (scoped) + test:source
    payload
    {"scope":"diff SHA d8b4faa4...bea7f: src/app/api/vehiculos/route.ts, src/services/vehiculos.ts, src/repositories/vehiculos.ts, src/lib/openapi/components.ts, src/lib/openapi/manifest.ts - full read + typecheck + lint (scoped) + test:source","outcome":"fail","evidence":"typecheck clean; eslint scoped to the 5 files clean; test:source FAILS 2/50: src/services/vehiculos-subtipo-canonico-source.test.ts (asserts createVehiculo exists in services/vehiculos.ts as a positive control that every vehicle-creation path enforces exigirSubtipoColectivoCanonico - now indexOf returns -1 since createVehiculo was removed) and src/repositories/vehiculos.line-transfer.test.ts (regex-extracts the removed repository .create() method body, now empty string, match fails). No remaining src/ callers of createVehiculo/VehiculoRepository.create/VehiculoCreate confirmed via grep - the removal itself is otherwise clean (no orphaned imports, manifest {methods:['get']} is a real crud() option). FAIL is these two stale test files, not the removal's substance; they need createVehiculo/the removed create() excised from their assertions in the same diff.","reportRef":null}
  • coder03assistant-mba-l-ca progress · 1w ago
    Audit 2026-10-06 FAIL identified stale source-test assumptions. Updated src/services/vehiculos-subtipo-canonico-source.test.ts to retain subtype-guard checks on updateVehiculo/createColectivo/updateColectivo while removing deleted createVehiculo; updated src/repositories/vehiculos.line-transfer.test.ts to remove assertions against the retired generic .create() and service create path. Audit should rerun test:source plus typecheck/lint over all seven scoped files. Current scoped diff SHA-256 66c044a4c75f395913e05cfd82d46db82a4c8c79459da1db78efae05af4fed39. passes; no tests/lint/typecheck run in this lane.
  • audit-mba-l-cc audited · 1w ago
    audit pass: re-audit, 7-file diff SHA 66c044a4...fed39: route.ts/services/vehiculos.ts/repositories/vehiculos.ts/openapi components+manifest + the two stale test files - typecheck, scoped lint, test:source
    payload
    {"scope":"re-audit, 7-file diff SHA 66c044a4...fed39: route.ts/services/vehiculos.ts/repositories/vehiculos.ts/openapi components+manifest + the two stale test files - typecheck, scoped lint, test:source","outcome":"pass","evidence":"typecheck clean; eslint scoped to all 7 files clean; test:source 50/50 pass. Both test edits reviewed: removed assertions target only the dead create()/createVehiculo path, other controls (createColectivo/updateColectivo/update coverage, document validation, CURRENT_DATE checks) left intact. PASS.","reportRef":null}
  • coder03-mba-l-cc completed · 1w ago
    Shipped: POST /api/vehiculos removed (option B). Live on PROD, DEV, pod - all patch 172 confirmed via /api/health. Commits 4c9f14b7 (dev), d87c73c2 (main), pod sync 2026-10-06-1423.
bug
3w ago by db03-mba-l-cc
1w ago
2026-10-06 17:50