El predicado de fabricante vive en dos objetos sin definicion compartida y cada copia se parchea a mano
Filed by audit-mba-l-cc on 2026-10-08 while verdicting MOVILBA-746 PASS. Not a blocker for 746: 746's hand-alignment is correct and should ship. This is the root cause 746's own title names, left standing by it. The manufacturer match predicate exists in TWO database objects with no shared definition, and each copy has to be patched by hand: 1. rutap.proyectar_snapshot, join patched by MOVILBA-722 (docs/migrations/2026-10-06-movilba-722-cummins-6-cil-alias-PROD-Y-DEV.sql:18): ON upper(mf.fabricante) = CASE WHEN upper(btrim(s.motor)) = 'CUMMINS 6 CIL' THEN 'CUMMINS' ELSE replace(upper(btrim(s.motor)),'MERCEDEZ','MERCEDES') END AND mf.borrado_en IS NULL. 2. rutap.v_snapshot_catalog_preflight, the diagnostic, which carried only the MERCEDEZ half until MOVILBA-746 copied the CUMMINS arm into it. Measured by audit in the installed PROD body: motor_n is upper(btrim(COALESCE(r.motor,''))) at :66 and the motor_fabricante branch tests upper(f.fabricante) = replace(s.motor_n,'MERCEDEZ','MERCEDES') AND f.borrado_en IS NULL at :162-164. After 746 the two predicates are term for term equal, so there is no live divergence today. The defect class is structural: two copies, two places to patch, and the failure is SILENT in one direction - the diagnostic over-reports a row the projector already resolves, which is exactly the false positive 746 was opened for. The next alias added to the projector reproduces it. This is the project's recurring shape, one field written or resolved by two functions. Proposal, not a decision: extract the normalization into one IMMUTABLE function (for example rutap.normalizar_clave_fabricante(text)) and have both the projector join and the diagnostic branch call it, so an alias is added in one place. Two constraints if that is taken up: rutap.proyectar_snapshot is text-pinned by several migrations and by MOVILBA-367's preflight, so its body digest changes and every pin that names it has to be re-pinned in the same change; and the diagnostic's own body md5 is pinned per base (PROD and DEV deparse differently, 17.6 vs 15.17), so the two pins are not interchangeable. Audit did NOT measure: whether any third object carries the same predicate. The census of copies is limited to these two.
Activity
-
researcher-mba-l-cc / coder
-
db04-mba-l-ca / db
-
researcher's census confirmed: no third copy, only historical migrations redefining the same two objects over time. Fix is DDL authoring on live function bodies (rutap.normalizar_clave_fabricante extraction + re-pin proyectar_snapshot/preflight digests) - reassigned to db lane.
-
Implementing a guarded PROD/DEV migration; exact bytes rehearsed under default ROLLBACK in both bases.
-
MOVILBA-766 migration candidate docs/migrations/2026-10-09-movilba-766-normalizar-clave-fabricante-PROD-Y-DEV.sql SHA256 d17e87cd72c861598c059b0bbe8cd18de974fe70ccca9b0c5bb75b0750c526d3. Read-only preflight pins before rewrite: projector md5(prosrc)=a7c701fd3ac3a18b62e1584b01b102d7 and md5(functiondef)=177038f472d409b3d848845746acc9ba in both bases; preflight md5(pg_get_viewdef)=0ba1205392b48fe0a5efd510174f35e9 PROD and f742cfe55f59298552d48a8e73d76a5b DEV. The installed preflight still had the single AH992CY / CUMMINS 6 CIL false positive in both; audited 746 SQL f21aaeac had not been installed, so this migration carries its alias arm into the shared IMMUTABLE STRICT PARALLEL SAFE rutap.normalizar_clave_fabricante(text), replacing one exact join in each object. Default-ROLLBACK rehearsals completed rc=0, PROD then DEV; each observed the witness 1/1 {AH992CY} before and 1->0 after. Result pins in both: projector md5(prosrc)=c08addc80323f8c4001e34a74a7bca03, md5(functiondef)=7d77f828d8c16fbc99be4444a59c859c; preflight viewdef md5=560ff1c8eb3525f45aad8f312836ce66 PROD and 689c636f5c1fa19056f3b5726faba193 DEV. Helper owner follows local projector owner (movilba_owner / movilba_user), PUBLIC EXECUTE; projector and preflight owners/ACL/signature/options/columns preserved. Independent post-rollback reads confirmed helper absent, projector pins restored and preflight witness 1/1 in both. No apply.
-
# MOVILBA-766 - audit verdict: PASS. Author db04-mba-l-ca. audit-mba-l-cc, 2026-10-09 docs/migrations/2026-10-09-movilba-766-normalizar-clave-fabricante-PROD-Y-DEV.sql, pin d17e87cd confirmed exact, full file read. Default ROLLBACK, -v movilba766_apply gate present and not used. ## Rehearsed myself, exact bytes, both bases, no apply PROD (SUPERUSER_ELAZAR_URL): rc=0. Preflight NOTICE: projector prosrc a7c701fd, functiondef 177038f4, viewdef 0ba12053, witness 1/1 {AH992CY} - matches db04's pre-pins exactly. Install NOTICE: projector prosrc c08addc8, functiondef 7d77f828, preflight viewdef 560ff1c8, alias 1->0, helper owner movilba_owner - matches db04's post-pins exactly. DEV (DEV_DATABASE_URL): rc=0. Preflight NOTICE viewdef f742cfe5, install NOTICE preflight viewdef 689c636f, helper owner movilba_user - matches db04's DEV pins exactly. Both bases took the same code path (ROLLBACK at the end), confirmed by output order (BEGIN...DO...DO...ROLLBACK). ## Post-rollback, read independently (not taken from db04's report) Both bases: to_regprocedure('rutap.normalizar_clave_fabricante(text)') IS NULL - helper gone. rutap.proyectar_snapshot prosrc/functiondef md5 back to a7c701fd/177038f4 - original pins restored. v_snapshot_catalog_preflight witness back to 1 row, {AH992CY} - false positive restored, confirming the rollback actually undid the view redefinition and not just the function. ## What the script's own asserts cover, read not just run Single-use guard (helper must not pre-exist), installed-pin drift guard before touching anything, exact-string-replace guard (exactly one join replaced, not zero not many), post-install re-read of the live catalog (not just local variables) for projector src/def and preflight def, truth-table control on the new helper (CUMMINS normalization, MERCEDEZ fix, empty string passthrough, NULL->NULL via STRICT), owner/ACL/security/volatility/parallel/config preserved on both existing objects, column signature preserved on the view. This is the same shape as the 709/722/746 migrations already PASSed this project - no new pattern to check for. ## NOT EXERCISED No apply - ROLLBACK only, both bases, by design. No live snapshot import run against the changed projector. No third-copy census redone (coder03's note cites researcher's census: no third copy, only historical migrations touching the same two objects over time) - I did not redo that search myself.
-
audit pass: Exact-byte migration (d17e87cd) rehearsed myself, default ROLLBACK, PROD then DEV. Read the full file. Independently re-read post-rollback state in both bases.
payload
{"scope":"Exact-byte migration (d17e87cd) rehearsed myself, default ROLLBACK, PROD then DEV. Read the full file. Independently re-read post-rollback state in both bases.","outcome":"pass","evidence":"All pre/post NOTICE pins match db04's report exactly both bases; post-rollback independent read confirms helper gone, projector pins restored, witness back to 1/1 both bases.","reportRef":null} -
Applied exact audited SHA256 d17e87cd72c861598c059b0bbe8cd18de974fe70ccca9b0c5bb75b0750c526d3 PROD first then DEV, both COMMIT rc=0. PROD notices: before pins projector prosrc a7c701fd3ac3a18b62e1584b01b102d7, functiondef 177038f472d409b3d848845746acc9ba, preflight viewdef 0ba1205392b48fe0a5efd510174f35e9; witness 1/1 {AH992CY}. Installed notice: prosrc c08addc80323f8c4001e34a74a7bca03, functiondef 7d77f828d8c16fbc99be4444a59c859c, viewdef 560ff1c8eb3525f45aad8f312836ce66, alias issue 0, helper owner movilba_owner. DEV notices: same projector pre/post pins; view before f742cfe55f59298552d48a8e73d76a5b and after 689c636f5c1fa19056f3b5726faba193; witness 1/1 {AH992CY}, issue 0, helper owner movilba_user. Independent post-COMMIT reads in both confirmed helper IMMUTABLE/STRICT/security invoker with PUBLIC EXECUTE, function/view owners and expected pins, all preflight rows 0, and one snapshot remains. Configured PROD and DEV health URLs both returned status=ok serviceId=32010; first DEV probe incorrectly appended /api/health and returned 404, corrected direct configured URL succeeded. No business rows changed; no real import executed under new helper. This applied replacement supplies the already-audited MOVILBA-746 CUMMINS alias correction; do not separately apply f21aaeac. Commit/ship of this migration file remains outstanding.
-
completed