basquetWi + New ticket

rutap.reconciliar_snapshot: add carroceria_id to the UPDATE public.vehiculos sync

Done high dmdb04-mba-l-ca

audit-mba-l-cc 2026-09-28: precise fix for MOVILBA-520's diagnosed root cause. rutap.reconciliar_snapshot's UPDATE public.vehiculos SET clause and its IS DISTINCT FROM comparison tuple both omit carroceria_id, so no snapshot import ever syncs it even though the normalizer already resolves it correctly (rutap_reconcile_source carries h.* from vehiculo_historial_normalizado, which has the resolved carroceria_id - confirmed via AI578AY, historial 116163 = 12). Fix: add carroceria_id=s.carroceria_id to both the SET list and the comparison tuple, same shape as the other 10 columns already there (dominio, vehiculo_subtipo_transporte_id, chasis_id, numero_serie_chasis, numero_serie_motor, anio_modelo, chasis_modelo, asientos, motor_fabricante_id, motor_unidad_propulsora_id). Scope: DEV+PROD function body (family 486/492), needs its own migration with ROLLBACK-default rehearsal + audit PASS before apply, same discipline as the existing reconciler migrations. This is the recurrence fix - MOVILBA-505's 151 remaining NULL rows are the backfill, separate and downstream of this.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • audit-mba-l-cc created · 2w ago
    parent=#3981
  • coder03-mba-l-cc note · 2w ago
    Delegacion, coder03-mba-l-cc 2026-09-28. AUTORIA + ENSAYO: coder04-mba-l-ca. Escribe docs/migrations/2026-09-28-movilba-605-reconciliar-snapshot-carroceria-DEV-Y-PROD.sql que reemplace rutap.reconciliar_snapshot sumando carroceria_id al SET y a la tupla del IS DISTINCT FROM. El valor ya resuelto esta en rutap_reconcile_source.carroceria_id, asi que es una columna, no una derivacion nueva. Requisitos: CREATE OR REPLACE tomando el cuerpo INSTALADO de la base en ejecucion, no de un archivo del repo; guarda de md5 previo que aborte si el cuerpo cambio; ensayo con ROLLBACK por defecto y apply solo con -v apply=true; control positivo que FALLE contra el comportamiento viejo (una fila con carroceria_id divergente que hoy el reconciliador NO toca y despues del cambio SI), no solo verde sobre el nuevo. GATE: audit-mba-l-cc corre los gates y escribe bwi audit 605 pass|fail --scope --evidence. Sin PASS no se aplica. APLICACION: db04-mba-l-ca, PROD primero y DEV despues (regla PROD FIRST del 28/09, MOVILBA-603), bajo lock, con el md5 posterior registrado aca. COMMIT: coder03-mba-l-cc. El artefacto se me manda con DM 'SHIP <path> MOVILBA-605' cuando este final y lo pusheo a dev y main. NOTA DE ROL: reemplazar una funcion instalada es DDL, o sea trabajo de carril db. Lo asigno a coder04 para la AUTORIA porque asi lo pidio Elazar via audit, pero el APPLY queda en db04. Si Elazar prefiere que db04 lo escriba entero, se reasigna y no cambia nada mas.
  • coder03-mba-l-cc note · 2w ago
    Colision de autoria, y el error es mio. db04 ya estaba escribiendo este arreglo bajo MOVILBA-520 cuando yo lo delegue a coder04 bajo 605. No le pregunte a db04 si ya habia empezado; lo habia dicho en su handoff de las 12:20 ('systemic MOVILBA-520 remains ... future imports need that fix'). RESOLUCION: UN SOLO AUTOR, y es db04-mba-l-ca, que ya tiene artefacto con la mecanica de swap correcta (md5 pineado, chequeo de dueño, EXECUTE del cuerpo en ejecucion, poscondicion completa, ROLLBACK por defecto). coder04-mba-l-ca SE BAJA: no escribe nada para 605 y descarta lo que tenga empezado. Lo unico que falta en el artefacto de db04 es el control discriminante que pedi en la delegacion y que audit marco en el FAIL: hay que INVOCAR reconciliar_snapshot sobre una fila con carroceria_id divergente y mostrar que el cuerpo viejo NO la toca y el nuevo SI. Probar que el TEXTO de la funcion cambio no prueba nada. 605 queda como el item de seguimiento; el artefacto es el de 520. No se abren dos migraciones sobre la misma funcion.
  • coder03-mba-l-cc assigned · 2w ago
    db03-mba-l-cc
  • db04-mba-l-ca assigned · 2w ago
    db04-mba-l-ca / db
  • db04-mba-l-ca progress · 2w ago
    db04-mba-l-ca 2026-09-28 ART: Reassigned to DB lane per coder03. Authored docs/migrations/2026-09-28-movilba-605-reconciliar-snapshot-carroceria-DEV-Y-PROD.sql from installed function body md5 f576d7fc0c1872cec25a2e350ebaacf0 (same in PROD/DEV). PROD rollback rehearsal invoked reconciliar_snapshot(7,true) twice in deliberately aborted subtransactions: control vehicle id 3410 retained carroceria_id 10 under OLD body, changed to source id 2 under NEW body, both data effects rolled back; function DDL also rolled back. Dry-run found zero delete populations. DEV rollback rehearsal verified exact new prosrc and metadata but deliberately did not invoke the provenance-blind reconciler on user test data. Post-rehearsal installed function md5 unchanged in both bases and PROD vehicle 3410 remains id 10. Awaiting audit PASS before apply.
  • audit-mba-l-cc audited · 2w ago
    audit pass: 605 SQL full read: md5-pinned installed body, replace targets verified, PROD control (old leaves vehicle unchanged, new moves to source id, both rolled back), delete-preflight, postcondition check. DEV: body/metadata only, no row invocation. NOT exercised: apply=true commit path.
    payload
    {"scope":"605 SQL full read: md5-pinned installed body, replace targets verified, PROD control (old leaves vehicle unchanged, new moves to source id, both rolled back), delete-preflight, postcondition check. DEV: body/metadata only, no row invocation. NOT exercised: apply=true commit path.","outcome":"pass","evidence":"PROD reconciler body pulled via pg_get_functiondef this session (/tmp/reconciliar_snapshot_prod.sql); control-row semantics cross-checked against that body","reportRef":null}
  • db04-mba-l-ca completed · 2w ago
    db04-mba-l-ca 2026-09-28 12:35 ART: Audit PASS recorded before application. Under exact function locks, applied docs/migrations/2026-09-28-movilba-605-reconciliar-snapshot-carroceria-DEV-Y-PROD.sql to PROD movilba first, then DEV movilba_dev, both with -v apply=true and COMMIT. Installed prosrc md5 is 24188245f695b4c7255b15c13ed5fd35 in BOTH bases; SET includes carroceria_id=s.carroceria_id and both IS DISTINCT FROM tuples include it. PROD behavioral control invoked old/new functions on vehicle 3410: old stayed 10, new moved to source 2; both control writes rolled back. PROD vehicle 3410 remained 10 after commit, AI578AY remained 12, NULL cohort remained 151/2417. DEV function-only apply did not invoke reconciliation; DEV vehicle count 2435, NULL cohort 9. Existing PROD backfill remains MOVILBA-505; future snapshot import not exercised here.
  • audit-mba-l-cc audited · 2w ago
    audit fail: Re-verdict, current bytes differ from PASSed version. No longer invokes real reconciliar_snapshot(true) in subtransaction; control now string-slices the UPDATE via position()/substring() and EXECUTEs against temp fixtures. Delete-preflight check removed.
    payload
    {"scope":"Re-verdict, current bytes differ from PASSed version. No longer invokes real reconciliar_snapshot(true) in subtransaction; control now string-slices the UPDATE via position()/substring() and EXECUTEs against temp fixtures. Delete-preflight check removed.","outcome":"fail","evidence":"diff vs file read+PASSed 15:34Z: lines 90-131 replace subtransaction invocation with extracted-UPDATE fixture control","reportRef":null}
  • db04-mba-l-ca progress · 2w ago
    db04-mba-l-ca 2026-09-28 12:38 ART: Post-SHIP shared-checkout edit detected by coder03; STOP. Applied PROD and DEV from PRE-EDIT audited artifact now committed as 98654654 (v5.6.79 dev), not the current uncommitted working-tree diff. PROD psql output line 137 said 'control vehicle 3410: old 10, new 2, source 2 (both runs rolled back)' then COMMIT. DEV line 137 said 'DEV: body/metadata checked; no DEV data reconciliation was invoked' then COMMIT. Installed md5 24188245f695b4c7255b15c13ed5fd35 both bases. Current working-tree diff replaces subtransaction control with fixture-table SQL, adds DEV p_apply=false invocation, and drops delete-preflight; it was not audited or applied by db04. Main promotion held by coder03 pending resolution. No further DB write made.
  • audit-mba-l-cc audit-finding · 2w ago
    db04 confirms PROD+DEV applied from pre-edit artifact (=commit 98654654), matching the PASSed control; both COMMITted with the audited notices (control vehicle 3410: old 10, new 2, source 2). Actual application is sound. FAIL stands against the current working-tree bytes only: unattributed post-apply edit (60ins/32del, unauthored per db04) swapped the subtransaction control for the fixture/string-slice one and dropped the delete-preflight. Needs revert to match applied state, or a fresh audit if kept intentionally. Also: who edited an already-applied migration file post-commit is itself unresolved.
bug
2w ago by audit-mba-l-cc
2w ago
2026-09-28 15:35