basquetWi + New ticket
movilba MOVILBA-617

PDF vehiculo: v_vehiculos_ciclo_actual empate BAJA/ALTA mismo dia + labels IP ADAS/IP MDVR en export

Done normal cmcoder04-mba-l-ca

PDF ficha vehiculo (dominio, vehiculo id) autoexportado: bloque Estado Actual se contradice a si mismo cuando la ultima baja y la re-alta que la sigue caen el mismo dia. v_vehiculos_ciclo_actual (estado_ciclo_actual, docs/migrations/2026-09-17-v-vehiculos-ciclo-actual-cuerpo-instalado-RECORD.md) resuelve el empate con baja.fecha_baja >= alta.fecha_alta; debe ser un > estricto para que la reapertura del mismo dia gane. Vehiculo id 5630/AF106WZ: fila 120595 (modif, baja 2026-03-27) y fila 120597 (modif 2026-03-27, sin baja, expte EX-2026-14728877) empatan y la vista devuelve BAJA, asi que el PDF imprime Baja registrada/Expediente de Baja/Observaciones de Baja de la fila 120595 dos lineas debajo de Estado actual: Alta (que sale de otra fuente, vehiculo.estadoActualNombre, correcta). Ademas, mismo export: las etiquetas IP ADAS / IP MDVR (page.tsx ~939/964) deberian decir ID ADAS / ID MDVR, como ya dice correctamente la ficha en pantalla (linea ~1299) para el mismo campo ipMdvr/ipAdas. Reportado por Elazar via coder03.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • audit-mba-l-cc created · 2w ago
  • db03-mba-l-cc progress · 2w ago
    STARTED MOVILBA-617 at 2026-09-30 03:18:59 -0300 (db03-mba-l-cc, DDL half). Assigned by coder03, read-only measurement first, PROD then DEV, CREATE OR REPLACE only.
  • coder04-mba-l-ca assigned · 2w ago
    coder04-mba-l-ca / coder
  • coder04-mba-l-ca progress · 2w ago
    coder04-mba-l-ca | 2026-09-30 03:xx ART MOVILBA-617 code scope: changed only the vehicle PDF labels at src/app/vehiculos/[dominio]/page.tsx:939,964 from IP ADAS/IP MDVR to ID ADAS/ID MDVR. Surface census: ficha PDF had both wrong labels (now corrected); on-screen ficha already labels these values ID Cámaras ADAS and ID MDVR; add and edit forms already label them ID Cámaras ADAS and ID MDVR; XLSX exports already use ID ADAS/ID MDVR (src/lib/exports/vehiculos.ts and rutap-historico.ts); JSON API has data keys idAdas/idMdvr or identificacion_camaras_adas/ip_mdvr, not display labels. No other surface label correction needed. No tests/lint/typecheck run per instruction; DB/view tie portion untouched and owned by db03.
  • coder04-mba-l-ca statusChanged · 2w ago
    coder04-mba-l-ca | 2026-09-30 03:xx ART — PDF label hunk complete; four-surface census recorded. Awaiting audit.
  • audit-mba-l-cc audited · 2w ago
    audit pass: label hunk page.tsx L936-965, IP ADAS/IP MDVR -> ID ADAS/ID MDVR only
    payload
    {"scope":"label hunk page.tsx L936-965, IP ADAS/IP MDVR -> ID ADAS/ID MDVR only","outcome":"pass","evidence":"typecheck+lint clean; grep confirms no IP ADAS/IP MDVR left anywhere in src; diff isolated to 2 label strings, catalogos.md hunk untouched","reportRef":null}
  • db03-mba-l-cc progress · 2w ago
    db03-mba-l-cc 2026-09-30: id_mdvr apostrophe check, read-only. Vehiculo 5630 raw_id_mdvr='303030313000' traces to rutap_fila_excel=4962, snapshot 7 (2026-09-28-1042-parque-rutap.xlsx, md5 e7d7c3e6c6e285e9d0b7e21450e0691b, matches rutap.snapshots row 7, file re-hashed by me). Read cell AC4962 (col AC=header 'ID MDVR', row confirmed by matching CUIT column A='30-54577585-5' on both AC4962 and neighbor AC4964) directly via openpyxl with data_only=False: value is the Python string "'303030313000", cell.data_type='s' (shared string, not a formula/number). openpyxl does not synthesize a leading apostrophe for Excel's text-format prefix - Excel's own apostrophe-forces-text convention is stored as a cell format flag, not as literal string content, so a leading apostrophe surfaced by openpyxl means the character is genuinely part of the stored string. CONCLUSION: apostrophe is in Eugenia's book cell, not an import artifact. clean() preserving it verbatim is correct/faithful. No code change needed.
  • db03-mba-l-cc progress · 2w ago
    db03-mba-l-cc 2026-09-30: rehearsed clean both bases under ROLLBACK, file /data-lezama/movilba/drafts/2026-09-30-movilba-617-ciclo-actual-tie-fix-DEV-Y-PROD.sql (CREATE OR REPLACE VIEW only, no DROP - PROD relacl not NULL). Two separate defects fixed in one CASE: 1. comparator >= -> > (the assigned fix) 2. latest_baja tiebreak: added (h.fecha_alta = h.fecha_baja) DESC before creado_en/id, plus a matching self-terminal OR-clause in the final CASE, so a tie resolves BAJA only when the winning baja row is itself self-terminal (its own fecha_alta = fecha_baja) - otherwise resolves ALTA per fix 1. Counts, isolated separately per coder03's ask: PROD (2417 active): comparator alone moves 1404 BAJA->ALTA. Tiebreak fix alone (on top of 1) moves 9 back ALTA->BAJA - the exact 9-vehicle gap named earlier (AE338MR/AE338MT/AI105QP/AI357IV/NSA348/NUK620/PGX165/PIK926/PJP967). Net 1395 changed. Final split ALTA 1600 / BAJA 817 - EXACT match to coder03's independent ground-truth control, not just close. DEV (2440 active): comparator alone 1421; tiebreak fix alone 23 (DEV has extra app-origin rows). Final split ALTA 1609 / BAJA 831. Shape-a check against the pinned libro (2026-09-28-1042-parque-rutap.xlsx, md5 e7d7c3e6c6e285e9d0b7e21450e0691b = rutap.snapshots id 7, re-hashed by me): the 5 single-row vehicles have Fecha_Alta AND Fecha_Baja both populated with the same date in the book itself (cols AH/AI, rows 3/4/6/9/10), expedientes empty. Book has a real baja recorded, not vigente - the empty expediente doesn't undermine it. Ground truth BAJA confirmed correct, data is not malformed. POST gate in the migration asserts vehiculo 5630 resolves ALTA on both bases (confirmed in rehearsal). Sent to audit for PASS. id_mdvr apostrophe finding already posted above - confirmed genuinely in the book, no code change.
  • audit-mba-l-cc audited · 2w ago
    audit pass: DDL half: CREATE OR REPLACE v_vehiculos_ciclo_actual, comparator + self-terminal tiebreak, PRE/POST gates
    payload
    {"scope":"DDL half: CREATE OR REPLACE v_vehiculos_ciclo_actual, comparator + self-terminal tiebreak, PRE/POST gates","outcome":"pass","evidence":"read full SQL file; diffed CTEs against installed-body RECORD - only latest_baja gains baja_fecha_alta (internal, not exposed) + tiebreak key, CASE gains > and self-terminal OR; no column dropped/added on output, no DROP VIEW; POST asserts 5630=ALTA; 9-vehicle tiebreak correction cross-checked against pinned libro by db03, ground truth confirmed","reportRef":null}
  • audit-mba-l-cc audited · 2w ago
    audit fail: latest_baja tiebreak ORDER BY, line 125: (h.fecha_alta = h.fecha_baja) DESC
    payload
    {"scope":"latest_baja tiebreak ORDER BY, line 125: (h.fecha_alta = h.fecha_baja) DESC","outcome":"fail","evidence":"Postgres DESC defaults NULLS FIRST; a fecha_alta-IS-NULL row's NULL comparison would rank ahead of a genuine self-terminal true row, reversing the tiebreak on the next import. 0 live PROD/DEV rows today per coder03's count - landmine, not active bug. Fix: append NULLS LAST, or rewrite as (h.fecha_alta IS NOT DISTINCT FROM h.fecha_baja) DESC. Comparator hunk (>= -> >) stands PASSED separately.","reportRef":null}
  • audit-mba-l-cc audited · 2w ago
    audit pass: latest_baja tiebreak ORDER BY re-check, line 133 only
    payload
    {"scope":"latest_baja tiebreak ORDER BY re-check, line 133 only","outcome":"pass","evidence":"IS NOT DISTINCT FROM ... DESC NULLS LAST confirmed in file; apostrophe paragraph re-read, verdict dropped, points to MOVILBA-618; rest of file unchanged from prior PASS. Both hunks now clear, apply PROD then DEV.","reportRef":null}
  • db03-mba-l-cc progress · 2w ago
    db03-mba-l-cc 2026-09-30 03:34: APPLIED both bases after audit PASS. PROD via SUPERUSER_ELAZAR_URL (current_database=movilba), COMMIT, POST OK, split ALTA 1600 / BAJA 817. DEV via DEV_DATABASE_URL (current_database=movilba_dev), COMMIT, POST OK, split ALTA 1609 / BAJA 831. Both match rehearsal exactly. Vehiculo 5630 confirmed ALTA on both. File landed at docs/migrations/2026-09-30-movilba-617-ciclo-actual-tie-fix-DEV-Y-PROD.sql (not yet committed - coder03/audit to review/commit path). id_mdvr apostrophe: confirmed genuine book content, verdict removed per correction, pointed at MOVILBA-618 (db04).
  • coder04-mba-l-ca completed · 1w ago
    Wave-2 closeout: shipped/audited scope is live; remaining checks or separate decision items are tracked outside this item's shipped scope.
bug
2w ago by audit-mba-l-cc
1w ago
2026-10-05 18:45