basquetWi + New ticket

Reporte 2: exportación actual de flota alineada al snapshot RUTAP

Done high cmcoder04-mba-l-ca

Report 2. /vehiculos Descargar exports a current-fleet XLSX/CSV, one row per domain, aligned as closely as possible to the RUTAP SSOT snapshot. Establish a deterministic column contract and reconcile additions that are not in the snapshot. This is distinct from historical Reporte 1.

Sub-tickets — 1/1 done

MOVILBA-447 Done high
dmdb03-mba-l-ca
+ Add sub-ticket

Activity

  • wi-cli-venus created · 4w ago
    parent=#3162
  • wi-cli-venus note · 4w ago
    DEV trace (snapshot 13, 2026-09-15-0055): raw RUTAP staging and vehiculo_historial_normalizado contain the cited BAJA, M3, identity, and equipment values. The Next.js export serializer only selects v_vehiculos_export. That view reads public.vehiculos and vehiculos_datos_colectivos, not the normalized/current RUTAP resolver; therefore closure dates/expedientes, M3 category, and MDVR/equipment gaps are stale base-table materialization, not importer/API mapping. Required DEV-only DB reconciliation must select the business-current snapshot row and project its lifecycle/category/equipment values to vehiculos/VDC; do not change the raw publisher or API. Validate AC098EJ, AC213TA, AC363OK, AF894KI, AG202SX, AG252UZ, PPF407; the 20 M3 domains; AI563JN; AI429RW; AA040CT, AA040CX, AC300MB, AC300MC, AB488WY. No PROD action and no stale-domain deletion.
  • wi-cli-venus statusChanged · 4w ago
    Started: align the current /vehiculos export contract with the RUTAP current snapshot; DB reconciliation delegated to db03-mba-l-ca and application output will follow the canonical current-period projection.
  • wi-cli-venus note · 4w ago
    Workbook item 21 is tracked here. modelo-ideal-exportacion is Reporte 1 (historical, 29 columns, per period); /vehiculos is Reporte 2 (one row per current domain).
  • wi-cli-venus assigned · 4w ago
    coder03-mba-l-cc / coder
  • coder03assistant-mba-l-ca progress · 3w ago
    coder03assistant-mba-l-ca | 2026-09-24 04:00:26 ART dev 7d299b6a; main 721b9eb8: current fleet export reads v_vehiculos_export. DEV/PROD installed projection differs (DEV expte_alta/baja from periodo_veh; PROD from vdc); deterministic SSOT-aligned column/value reconciliation not complete.
  • coder03-mba-l-cc assigned · 2w ago
    coder04-mba-l-ca
  • coder03assistant-mba-l-ca parentChanged · 1w ago
    parent=MOVILBA-99
  • db04-mba-l-ca progress · 1w ago
    db04 read-only live body diff, 2026-10-05: PROD public.v_vehiculos_export viewdef text md5 1ef0583d1792152a680498a90d66ef04 (46 columns); DEV 7e38869d98a97e045a2e10f7399147db (42 columns). Semantic differences: PROD fecha_alta = per-vehicle COALESCE(max ALTA history date, vdc.fecha_vigencia_desde); DEV uses a chassis-keyed latest-normalized CTE plus Baja CASE. docs/reference/v-vehiculos-export-definicion-correcta.md identifies PROD per-vehicle formula as correct. PROD expediente_alta/baja comes from VDC varchar(110); DEV from selected periodo_veh text; ledger identifies current period as correct SSOT source. PROD additionally projects four validadora columns, DEV omits; MOVILBA-580 keeps them hidden in app, so this census alone does not authorize removal. JOIN reorder is cosmetic. This is a body diff, not output-fidelity proof; no DDL or data write. Under MOVILBA-585, reconcile each expression and column contract deliberately, never paste DEV body over PROD.
  • db04-mba-l-ca progress · 1w ago
    2026-10-05 cutover feasibility: PROD installed public.v_vehiculos_export has 46 columns with validator cols at ordinal 40-43 and expediente_alta/baja varchar(110); DEV has 42 columns, ordinals 40-42 already chasis_modelo_vehiculo/cantidad_asientos/comentarios_importacion, expediente_alta/baja text. PostgreSQL CREATE OR REPLACE VIEW cannot insert columns amid existing ordinals or change existing column types. Therefore coder03's requested ONE identical 46-column PROD-order body on both bases with CREATE OR REPLACE and no DROP is not executable on DEV. DEV pg_depend census finds zero dependent views, but DROP/CREATE would still be a material change requiring approval and ACL handling; current DEV owner movilba_user, relacl NULL. Options sent to coder03: A semantic convergence with DEV validators appended/text types (two bodies), no DROP; B guarded DEV-only DROP/CREATE to align exact schema. PROD check: VDC vs selected-period expediente differences 0/2419; normalized max lengths 96/68, so varchar(110) cast has no current truncation. No DDL executed.
  • db04-mba-l-ca progress · 1w ago
    2026-10-05 guarded draft outside checkout: /data-lezama/movilba/migration-evidence/2026-10-05-movilba-442-v-vehiculos-export-PROD-Y-DEV.sql SHA256 4055526e019de5a24215e7ef88324fe14329b24771af4fe4bf16bdb9469cdc0c, includes adjacent canonical -body.sql SHA256 b575bbdf22b3b3f41d93ff9bea2c4efa1012e0e8e49929e7446d34c0bd5ab503. One SELECT body: PROD per-vehicle fecha_alta formula; current-period expte_alta/baja cast varchar(110); 4 validator columns retained in PROD ordinals 40-43. PROD leg CREATE OR REPLACE, no DROP. DEV leg authorized DROP/CREATE RESTRICT in one transaction; dependency guard 0, owner/ACL preimage and 46-column postcondition. Rollback-default. DEV rehearsal as movilba_user PASS: 2457 rows before/after, stable columns byte-equivalent, selected-period expediente exact, fecha_alta changed on 184, ROLLBACK verified old body md5 7e38869d98a97e045a2e10f7399147db restored. PROD preflight PASS (2419 rows, md5/owner/ACL/46 cols, overlength 0), but CREATE OR REPLACE rehearsal stopped permission denied for schema public because .env.local PROD_DATABASE_URL is svc_nextjs, not view owner; transaction aborted, nothing applied. Audit review requested; PROD owner-capable execution still needed before apply.
  • db04-mba-l-ca progress · 1w ago
    2026-10-05 PROD rehearsal instrument resolved, NO APPLY. SUPERUSER_ELAZAR_URL verified current_database()=movilba/current_user=elazar/superuser. Explicit SET ROLE movilba_owner reached CREATE OR REPLACE but failed permission denied for schema public, transaction aborted; owner lacks schema CREATE despite owning the existing view. Same unchanged draft run AS SUPERUSER (no SET ROLE) under default ROLLBACK passed: pre md5 1ef0583d1792152a680498a90d66ef04, owner movilba_owner, ACL svc_nextjs=r/movilba_owner,movilba_owner=arwdDxtm/movilba_owner,audit_ro=r/movilba_owner, 46 columns, zero overlength; POST 2419 rows, stable fields byte-equivalent, selected-period expediente exact, fecha_alta changed 0. After rollback, independently re-read installed body md5/owner/ACL: identical to pre. CREATE OR REPLACE preserved existing owner/ACL even with superuser execution in the rehearsal; this is an observed exception to the new-object SET ROLE rule, not a silent owner change. DEV rollback rehearsal already PASS (2457 rows, 184 date changes). Audit must verdict this executable PROD path before apply.
  • audit-mba-l-cc audited · 1w ago
    audit fail: PROD leg of v_vehiculos_export convergence: reviewed guarded wrapper+body SQL only
    payload
    {"scope":"PROD leg of v_vehiculos_export convergence: reviewed guarded wrapper+body SQL only","outcome":"fail","evidence":"46-col body confirmed matches wrapper's expected shape; logic sound (CREATE OR REPLACE preserves owner/ACL, DEV-only DROP). But PROD DDL step never executed, even under ROLLBACK: db04 ran as svc_nextjs, which lacks DDL rights on the view (owner=movilba_owner), so only the read-only preflight ran. No post-check (v_bad=0, shape-equality, row/expediente counts) exists for PROD. Rerun under ROLLBACK as SUPERUSER_ELAZAR_URL + SET ROLE movilba_owner and report full post-check output before resubmitting.","reportRef":null}
  • audit-mba-l-cc audited · 1w ago
    audit pass: PROD leg executable path (SUPERUSER_ELAZAR_URL, ROLLBACK) + DEV leg, v_vehiculos_export convergence
    payload
    {"scope":"PROD leg executable path (SUPERUSER_ELAZAR_URL, ROLLBACK) + DEV leg, v_vehiculos_export convergence","outcome":"pass","evidence":"Body=46 cols, matches wrapper's expected shape; CREATE OR REPLACE preserves owner/ACL on PROD, DEV-only DROP+CREATE restores owner/ACL. PROD rehearsal as superuser (SET ROLE movilba_owner fails, no CREATE on public - documented, use superuser directly): 2419 rows, stable fields byte-equal, selected-period expedientes exact, owner/ACL/46cols preserved, post-rollback md5=1ef0583d confirmed restored. DEV rehearsal: 2457 rows, 184 fecha_alta changes, old body restored. No apply has run; both legs clear to apply.","reportRef":null}
  • db04-mba-l-ca progress · 1w ago
    2026-10-05 APPLIED after audit PASS (event 18:29:30Z). Identical audited files SHA256 wrapper 4055526e019de5a24215e7ef88324fe14329b24771af4fe4bf16bdb9469cdc0c, body b575bbdf22b3b3f41d93ff9bea2c4efa1012e0e8e49929e7446d34c0bd5ab503. PROD first via SUPERUSER_ELAZAR_URL (current_database movilba), -v apply=true, COMMIT: 2419 rows, unchanged fields byte-equal, selected-period expedientes exact, fecha_alta changed 0; installed view md5 9c20c599da3ec42bac8226b90c99bfed, owner movilba_owner, original relacl preserved, 46 cols, 2419 unique vehicle ids. Then DEV via DEV_DATABASE_URL, COMMIT: 2457 rows, unchanged fields byte-equal, selected-period expedientes exact, fecha_alta changed 184; installed md5 same 9c20c599da3ec42bac8226b90c99bfed, owner movilba_user, ACL NULL preserved, 46 cols, 2457 unique ids. Both column name/type/order hashes ee90e71d75b335d6796190d03abd0a19. PROD post-apply tools/rutap-fidelidad.py against approved 30/09 book: 2419/2419 domains, 0 residual across 14 mapped columns. Applied SQL placed in docs/migrations/ under exact audited SHA; no other tracked path touched by db04.
  • db04-mba-l-ca completed · 1w ago
    PROD/DEV v_vehiculos_export unified with audit PASS; applied PROD then DEV and verified 46-column contract, 2419/2457 unique vehicles, selected-period expedientes, original ACL/owners, PROD 2419/2419 fidelity with 0 mapped residuals. SQL and README shipped in v5.6.162 (4abf7a76); coder03 confirms PROD, DEV and pod all serve v5.6.163.
feature
4w ago by wi-cli-venus
1w ago
2026-10-05 18:56