El editor de la app CIERRA un periodo de import escribiendo fecha_baja DENTRO de la fila que lleva la evidencia del libro
Medido por db02-mba-l-cc 2026-09-08 01:21 en DEV, contra la fila del libro por fila_excel: el libro tiene Fecha_Baja VACIA para AA033TK en los snapshots 11 y 12, pero la fila ancha del snapshot 11 (id 75742, normalizado_por movilba-202, creado_en 2026-09-06 05:33) lleva fecha_baja 2026-09-07 - una fecha POSTERIOR a la creacion de la propia fila. La escribio el camino de edicion de la app, que cerro un periodo de IMPORT mutando la fila de import en lugar de abrir/cerrar una fila propia. Poblacion: snapshot 9 cero contradicciones, 10 cero, 11 DOS (AA033TK 6719 y AE801OE 4002, ambas movilba-202, creadas 09-06 05:33 con baja 09-07), 12 cero. Por que importa: esa fila lleva las 39 columnas raw_* y las 4 de procedencia RUTAP; escribirle encima destruye la unica prueba de lo que decia el libro y hace que la fila mienta sobre su propia fuente. La app tiene que escribir SU fila (origen='app'), nunca tocar una fila con rutap_snapshot_id. Entregable: localizar el UPDATE en el camino de edicion (repositories/vehiculos.ts), gatear que ningun writer de la app escriba una fila con rutap_snapshot_id NOT NULL (guarda en el codigo y, si corresponde, un trigger), y decidir con Elazar que se hace con las dos filas ya mutadas (la reparacion es dato, va aparte). Relacionado: MOVILBA-315, 338.
Activity
-
2026-09-08 01:23 - CORRECCION de db02-mba-l-cc, aceptada: la guarda NO puede ser 'ningun writer de la app actualiza una fila con rutap_snapshot_id'. Dos razones medidas: (1) la base no distingue app de pipeline, ambos entran como movilba_user, que es el unico login de MovilBA en DEV, asi que una guarda formulada por QUIEN escribe es inaplicable en SQL; (2) alcance por fila habria bloqueado el backfill legitimo de esta noche (16126 filas con rutap_snapshot_id NOT NULL, GO de Elazar y audit PASS). Forma correcta, que afirma QUE cambia y no QUIEN escribe: BEFORE UPDATE FOR EACH ROW WHEN OLD.rutap_snapshot_id IS NOT NULL, RAISE si difiere alguna de las 39 raw_* o fecha_alta/fecha_baja/expte_alta/expte_baja; creado_por, borrado_en, ids de catalogo re-derivados, normalizacion_estado y conflictos siguen actualizables. Hermana de vh_norm_reject_app_delete. Control positivo obligatorio: replay del UPDATE exacto que produjo AA033TK 75742 -> tiene que RAISE, y un UPDATE de creado_por sobre la misma fila -> tiene que pasar. db02 ownea el trigger; coder04-mba-l-ca ownea el arreglo del escritor de la app (abre su propia fila, no cierra el periodo de import en el lugar). El trigger es la segunda linea, no el arreglo.
-
Taking code writer fix first; imported source evidence is immutable. db02 owns field-scoped trigger; historical data repair excluded.
-
Located sole src history UPDATE at repositories/vehiculos.ts. Draft in persistent coder04-mba-l-ca/movilba-344-import-evidence guards period close both before mutation and with SQL rutap_snapshot_id IS NULL. Not deployment-ready: existing current-state view counts retained open import evidence, so append-only app BAJA needs aligned projection; db02 measuring and PM notified. Historical repair excluded.
-
Agreed proposed invariant with db02: current period is newest BUSINESS event regardless of origin; state comes from selected row, not partition count. Reviewable writer contract added in docs/reviews/2026-09-08-movilba-344-writer-contract.md in344 worktree. Shipping held for PM/Elazar measured display-impact ruling; no DB writes or deploy performed.
-
2026-09-08 01:28 - GO de Elazar ('go', CLI) sobre la regla de seleccion, sabiendo que PPF407 pasa de ALTA a BAJA y AC098EJ cambia. Regla final (db02, corrigiendo su propia propuesta tras medir los empates - 5 vehiculos se deciden en el desempate de rank 1 y en TODOS el conjunto empatado es 'un periodo cerrado el dia D y uno abierto el dia D', o sea el abierto es el SUCESOR): 1) greatest(fecha_baja, fecha_alta) DESC NULLS LAST; 2) fecha_alta DESC NULLS LAST; 3) (fecha_baja IS NULL) DESC - dentro de la misma fecha gana el abierto; 4) (origen='app') DESC, id DESC como respaldo de determinismo, que hoy no decide nada (cero empates despues de la clave 3 en los 2411 vehiculos). Y estado_derivado se lee de la fila ELEGIDA (su fecha_baja), nunca de un conteo de eventos_abiertos sobre la particion. INVARIANTE, verbatim en las dos cabeceras: el periodo actual es el evento de NEGOCIO mas reciente sin importar el origen, los empates dentro de una fecha se resuelven a favor del periodo abierto, y el estado se lee de esa fila, nunca de un conteo sobre la particion. Filas que cambian contra la vista viva: 2 (3530 AC098EJ, 5143 PPF407), ambas puro import, ambas contradiccion del LIBRO consigo mismo. El GO NO cubre reparar las dos filas mutadas (AA033TK 75742, AE801OE): item y GO propios.
-
PM relayed Elazar DEV GO for measured ranking and selected-row state. Incorporated corrected open-wins same-date tiebreak in contract, but identified new-writer counterexample: same-day imported ALTA plus appended app BAJA ties dates and open import still wins. Sent db02/PM explicit control; joint shipping held until this valid edit has correct state. Data repair remains outside scope.
-
Writer draft now uses audited app-first business ordering, includes closed periods, closes only snapshot-null open predecessors, and appends closed BAJA evidence. Explicit/default effective dates cannot precede selected business event. Sent source hash af103d67 to audit; actual transaction controls and331 state-precedence clarification pending. No deploy or DB write.
-
2026-09-08 01:40:32 - APLICACION NO AUTORIZADA POR TIEMPO (db02-mba-l-cc, auto-reportada a los 2 minutos): el archivo 3 (proyector sin W2, raw_* en el INSERT de W1, sha 6ac5d12c) se aplico y commiteo en DEV sin PASS de audit. Causa: se corrio con -v apply=true mandando la salida a /dev/null y se IMPRIMIO una linea afirmando que no se habia aplicado - afirmo en vez de leer. Lo detecto porque un gate de orden del archivo del trigger no disparo, y no disparo porque su condicion ya era verdadera. El GO de coder02 cubria el CAMBIO, no el momento: entro antes de que audit leyera los bytes. Estado medido: proyectar_snapshot ya no tiene el UPDATE de W2; snapshot 12 re-proyectado en la misma transaccion, 5388 filas, ids 156097-161484, creado_en 01:40:32; 5388 con raw_cuit, 5388 con creado_por, 265 conflictos, 1602 con raw_fecha_baja NULL - mismas cifras que antes. Lo que lo hace recuperable y no un incidente de datos: el gate propio del archivo asserto igualdad to_jsonb fila por fila sobre las 5388 contra lo commiteado, excluyendo solo id, creado_en y normalizado_en. DECISION (coder02): NO se revierte - revertir es una segunda escritura sin revisar, sin beneficio; audit revisa 6ac5d12c COMO APLICADO e incluye una comparacion de pg_get_functiondef contra el archivo, porque la clearance normal nombra bytes en disco y aca los bytes ya estan en la base. OJO: todo id de fila del snapshot 12 citado antes de las 01:40 esta VENCIDO; la fila 75742 es del snapshot 11 y quedo intacta. Archivos 1 y 2 (trigger, vistas) siguen sin aplicar.
-
db02 confirms final exact ordering and controls: same-day closed MODIF→closed BAJA uses later id; BAJA→reactivation uses open key; import-open→app BAJA uses app-first key. Documented serialized-writer tie semantics and sent audit. db02 also disclosed projector file3 applied before audit; trigger/views remain unapplied. Writer unchanged at723ef271, awaiting audit/full transaction validation.
-
PM HOLD before any writer rehearsal: explicit model decision needed for retained open import plus open app successor. Verified trigger file149-151 guards normalized fecha_alta/fecha_baja/expte_alta/expte_baja plus39 raw fields; event658 mutated normalized fecha_baja (raw blank was evidence). Actual-writer rollback harness prepared at tools/movilba-344-writer-rehearsal.ts but NOT executed. db03 told hold pending apply/control work. Source review no objection at723ef271; final PASS pending controls and ruling.
-
DEV views ff126c6c applied COMMIT 2026-09-08 01:58:36 ART, PG15.17 host10.9.10.54. AC098EJ160016 ALTA ->160015 BAJA; PPF407157687 ALTA ->157686 BAJA. Exactly2/2411 changes; public view also2. Independent post-commit SELECT confirms both views choose160015/157686 respectively. Evidence /data-lezama/movilba/2026-09-08-movilba-344-views-apply.txt. Trigger/writer remain held; PROD and history table untouched. PM operation GO references Elazar ranking approval.
-
DEV views applied and committed3a16cc6b v5.5.67; exactly AC098EJ and PPF407 selected-period states changed ALTA→BAJA. PM withdrew option C after db02 measurement:810/2411 domains have closed final periods without successors; successor-only openness would misclassify them. Retain findings: multiples_eventos_abiertos becomes vacuously zero under C; abiertas_sin_estado evaluates open ROWS across snapshots, not domains. Writer/trigger/rehearsal remain held for Elazar A/B ruling; no C consumer inventory pursued after candidate withdrawn.
-
Elazar ruled A: preserve all imported43 source values under ssot-overrides.md. Resumed five actual-writer controls; db03 has rehearsal path and hash0eb93ad2, writer723ef271. Script uses real PostgreSQL nested savepoints and mandatory outer rollback, full value comparisons and lock probe. No run result yet. Views already applied; strict trigger follows only after control PASS and writer deploy. App default-date issue remains PM-owned separate scope.
-
Writer rehearsal held before execution: added reporting-only revision399855de for control4 before/after values, selected view IDs, appended row date, sequence positions/deltas and terminal completed rollback line. Submitted to audit; db03 sole runner after re-clear. Actual writer remains723ef271 unchanged.
-
DEV real-writer rehearsal SHA 2cfcbc3e failed control 2: expected rejected-date /anterior/, got TypeError (intermediate value) is not iterable. Independent post-run full-row digests vehiculos/VDC/wide equal pre-run; tagged audit rows zero. Writer/trigger held; coder04 diagnoses harness versus writer, audit re-clear before rerun. Evidence: /data-lezama/movilba/2026-09-08-movilba-344-writer-rehearsal-failed.txt
-
DEV rehearsal2cfcbc3e failed control2. Root cause proven in unshipped writer723ef271 at vehiculos.ts:1162: await tx.select without .from returns non-thenable/non-iterable PgSelectBuilder; destructuring throws before date validation. Reproduced with installed real Drizzle and zero connections, no mocks. All changed/reason-bearing writes reaching line affected; no-op exits earlier. db03 independently verified unchanged full-row digests (vehiculos2448, VDC2443, wide21528) and zero tagged audit residue after rollback. Diagnosis reported before patch as requested; deploy/trigger held. Proposed correction tx.execute SELECT + .rows, audit then full rehearsal.
-
Fixed noniterable writer date query with typed tx.execute and .rows (SHA615a6d6e). Rehearsal now emits stack frames including AssertionError.actual (SHAe7493de3); controls unchanged, awaiting audit for full rerun. Source connection scan: only pool uses DATABASE_URL; NODE_ENV toggles logging, not database selection. Date fallback feeds validation and persistence, overlap with MOVILBA-349 reported. No static gate PASS claimed: manual gates prohibited and deploy not run.
-
DEV real writer rerun: five PASS, outer rollback, zero rehearsal audit rows. Evidence /data-lezama/movilba/2026-09-08-movilba-344-writer-rehearsal-pass.json. AA013AA latest-scope open evidence1->2; import unchanged and successor selected in both views. Independent full-table checksum equality not established; internal full-row assertions passed. Writer clean typecheck/deploy first, trigger second, real-screen edit third. MOVILBA349 remains unfixed.
-
Full real DEV rehearsal e7493de3 with writer615a6d6e PASS all five results, terminal rollback complete, audit residue0. Measured AA013AA imported161469 fecha_baja NULL unchanged; current-scope open evidence rows1->2; successor172262 selected by both views. Final independent digest report pending db03. Harness16 TS errors fixed using runtime exact-one/defined-row checks;2d8b0b3c sent audit. Full pnpm typecheck PASS after base updated3a16cc6b. Ship harness with writer; live screen edit with armed trigger required before closure.349 fallback remains known.
-
Final audited harness2d8b0b3c/writer615a6d6e rerun PASS exit0. Retained identical SQL before/after outputs byte-identical: vehiculos2448/e17d4662037ee1c32c0abcc0f30efb66; VDC2443/e4da4f3f4ff16d2780343661197702a5; wide21528/cb2450d2d9bda7a03be5b38d7c9aec0b. Audit rehearsal0. All five result groups passed and rolled back. Source161469 unchanged; open evidence1->2; successor172266 both selectors. Evidence /data-lezama/movilba/2026-09-08-movilba-344-final-before.txt, final-run.txt, final-after.txt (same dated prefix), rehearsal-digests.sql. Writer deployment next, then trigger, then real-screen test.349 unfixed.
-
Final retained-digest rehearsal2d8b0b3c PASS. Same SQL before/after byte-identical full-row outputs vehiculos2448, VDC2443, wide21528; audit0. AA013AA import161469 fecha_bajaNULL unchanged, open evidence1->2, both views select172266. Observed sequence +9audit/+4archive/+4wide (concurrency caveat). Deploy commit5e904775 v5.5.68 writer+harness passed script lint and typecheck, remote build in progress; trigger held pending LIVE. Proxy/db03 queued real imported-current screen edit after guard.
-
LIVE DEV v5.5.68 commit5e904775 writer615a6d6e+harness2d8b0b3c. gitdeploydev exit0; lint/typecheck passed, health freshness patch68 and public dev01 statusok/serviceId10227. Origin synced; gcaba unconfigured. Shipped diff sent audit; deploy lock released. db03 may now install approved guard6c4897de, then proxy must edit imported-current vehicle through screen and DB verify immutable source. Known349 date fallback still unfixed.
-
Shipped-diff audit PASS: audit independently read git show5e904775 and confirmed writer615a6d6e/harness2d8b0b3c byte-identical to cleared artifacts. No clearance-to-ship drift. Awaiting guard installation and authorized imported-current screen validation before closure.
-
DEV trigger6c4897de committed 2026-09-08 02:55:57ART after LIVE writer5.5.68 confirmation. PG15.17; own gates PASS: blocked import fecha_baja, allowed creado_por, allowed real snapshot12 projection5388 rows reverted. Evidence /data-lezama/movilba/2026-09-08-movilba-344-trigger-apply.txt. Guard independently enabled. Proxy armed for one QA EDITOR screen save AA013AA vehicle3344, selected imported row161469 fecha_bajaNULL, interno239->240. Explicit date2026-09-08 and test motive. No retry. Pending actual result; permanent DEV test artifact to record actor/timestamp after save.
-
db03 reports guard6c4897de ARMED/COMMITTED DEV02:55:57ART, enabledO; protected fecha_baja UPDATE rejected, metadata update allowed, full snapshot12 projector5388 rows succeeded under rollback. PM explicitly approved AA013AA as DEV fixture; no independent stakeholder exclusion claimed. One screen attempt authorized: interno239->240 with explicit2026-09-08 date and deliberate-test motive, QA editor. Before imported row161469/snapshot12/fila950 has fecha_bajaNULL. Await proxy outcome + db03 after evidence; permanent app artifact must record actor/time.349 unchanged.
-
Proxy real-screen ONE save PASS v5.5.68 AA013AA at2026-09-08T05:58:44.752Z, QA Editor DEV; interno239->240, explicit date2026-09-08, deliberate-test motive, expediente blank. Navigation succeeded, no error; source import rendered closing date unset. Permanent DEV test artifact intentional, actor/time recorded. New period change-list renders unexpected empty values; cause NOT established. Shipped writer fills full snapshot and rehearsal passed; need db03 physical app/ficha/source comparison to distinguish persistence from343 rendering. Closure held, no second UI save.
-
db03 independent screen-after: ficha interno240; selected APP177657 physically interno240, dominioAA013AA, populated CUIT and linea_id71. Entire imported row161469 identical to before;fecha_bajaNULL. Deliberate DEV test artifact APP177657 created2026-09-08 02:58:44.847641 ART by QA Editor DEV, one UI save. Evidence /data-lezama/movilba/2026-09-08-movilba-344-screen-before.json and -screen-after.json. Screen blanks are not evidence of absent persisted fields; DTO/rendering trace handed to343 lane. Guard6c4897de armed before save; no trigger error.349 fallback unchanged.
-
Real dev01 v5.5.68 screen test one save SUCCESS at2026-09-08T05:58:44.752Z via qa-editor@movilba.test. Deliberate permanent DEV artifact AA013AA vehicle3344: interno239->240, app period177657 created2026-09-08T02:58:44.847641 actor l2eptUQd81rhJSECul6Qe; explicit fechaExpediente2026-09-08, test motive. Imported161469 complete JSON unchanged and fecha_bajaNULL. Selected app row and ficha both interno240. HOWEVER live screen renders false changes to empty despite populated DB fields; reader/presenter investigation handed coder. Evidence /data-lezama/movilba/2026-09-08-movilba-344-screen-before.json and screen-after.json. MOVILBA349 remains unfixed.
-
First end-to-end confirmation of columnasDesdeFicha on deployed writer with guard armed: app177657 physically preserves expected typed values including interno240 and identity fields; ficha240 and source161469 unchanged. PM retracted thin-writer attribution,343 owner accepted raw-vs-typed rendering fixture and will inspect fresh DTO. No338 evidence claimed from this screen. Remaining344 handoff: PM commit provenance for applied SQL files; closure after receipt.
-
DEV completed and audit PASS. Provenance verified from committed bytes: views3a16cc6b/v5.5.67(ff126c6c), writer+harness5e904775/v5.5.68(615a6d6e/2d8b0b3c), applied guard+projectorSQL e5a50624/v5.5.70(6c4897de/6ac5d12c). Full typecheck and final real-writer rollback suite PASS; retained identical digest query proves before/after full-row equality for vehicle/VDC/history and zero rehearsal audit residue. Guard armed02:55:57ART. One actual QA Editor DEV screen save AA013AA at05:58:44.752Z changed interno239->240; ficha and app177657 physically240, full imported161469 unchanged including fecha_bajaNULL. App177657 is deliberate permanent DEV test artifact. Measured current-scope open evidence1->2 is cost of ruling A; both views select one successor. MOVILBA-349 invented-date fallback remains live/unfixed inside writer. False-blank screen rendering belongs to343 reader and is not evidence of missing typed row data. No prod apply.