basquetWi + New ticket
movilba MOVILBA-436

Preserve legacy colectivo subtype on edit after MOVILBA-360

Done normal cmcoder04-mba-l-ca

DEV and PROD retain 26 live legacy vehicles with non-numeric colectivo subtype codes (25 ELECTRICO, 1 METROBUS). MOVILBA-360 deliberately filters selectable subtypes to exact SSOT 1–4, so the required colectivo edit select has no matching option for these stored IDs. Preserve the current subtype when editing another field, without making legacy values selectable for new records or migrating data by inference; add regression coverage and verify against the legacy records.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • wi-cli-venus created · 4w ago
  • coder03-mba-l-cc assigned · 2w ago
    coder04-mba-l-ca
  • coder04-mba-l-ca statusChanged · 1w ago
    Taking MOVILBA-436 after MOVILBA-782 closed. Scope: preserve the stored legacy colectivo subtype during edits to other fields; legacy subtype values must remain unavailable for new records, with no inferred data migration. First locating the edit select/state and existing tests.
  • coder04-mba-l-ca progress · 1w ago
    Read-only trace confirmed the edit form submits its full payload and the service rejects unchanged legacy IDs. Candidate preserves only the current stored code in the edit dropdown, omits that unchanged noncanonical ID from the update payload, and resolves its display code from the stored subtype row; create dropdown and server-side canonical validation remain unchanged. Pins: page d5844dd28d5288b41a376afe05aef054db728db65525437835301014add1bf95; repository 1914ffdbc78d072499fa14447107590261e67f0424a616d3b6b0b1265a82f98a; source test 5fad261b4dec1fbcffb2a0d43163d54775d7b5817f3b11462cfa42728324e900. No tests/gates or live legacy-record edits run; awaiting audit.
  • audit-mba-l-cc audit-finding · 1w ago
    audit-mba-l-cc 2026-10-09. FAIL, not PASS. pnpm typecheck: rc=0, clean. pnpm test:source: rc=1, 1 fail: src/app/api/dropdowns/vehicle-subtypes-edit-source.test.ts. Cause: the test's regex at line 32 asserts a variable literally named subtipoCodigo (assert.match(repository, /subtipoCodigo = result\.subtipoCodigo;.../)) but src/repositories/vehiculos.ts:528 names it subtipoTransporteCodigo, consistent with the field name used elsewhere in the same file (line 438's response key, line 572's return). Not a flake - deterministic string mismatch. The code's naming looks correct and consistent; the test regex looks wrong, written against an earlier draft variable name. Pins confirmed exact: page.tsx d5844dd2, vehiculos.ts 1914ffdb, test file 5fad261b. Did not run test:tools - stopped at test:source since it already fails. Returning for a fix: either the test regex or the variable name, whichever the real intent was, then re-request review.
  • audit-mba-l-cc audited · 1w ago
    audit fail: typecheck+test:source run fresh, stopped at first gate failure
    payload
    {"scope":"typecheck+test:source run fresh, stopped at first gate failure","outcome":"fail","evidence":"test:source rc=1, vehicle-subtypes-edit-source.test.ts:32 regex expects var name subtipoCodigo, code has subtipoTransporteCodigo at vehiculos.ts:528","reportRef":null}
  • coder04-mba-l-ca progress · 1w ago
    Audit FAIL was limited to stale source-test regex expecting a draft variable name. Corrected the assertion to match the implementation's subtipoTransporteCodigo; implementation and page bytes are unchanged. New test SHA-256 3e61f48bcd256a12b3fd29dd6cb4ec3666d9599bdb827e14693873f41f6006d1. git diff --check clean; no tests/gates run. Re-requesting audit on exact pins.
  • audit-mba-l-cc audit-finding · 1w ago
    # MOVILBA-436 - audit verdict: PASS. Author coder04-mba-l-ca. audit-mba-l-cc, 2026-10-09 Re-review after the first FAIL (stale test regex, fixed). Pins confirmed exact: page.tsx d5844dd2 (unchanged from first review), vehiculos.ts 1914ffdb (unchanged from first review), test 3e61f48b (corrected). ## Gates, run fresh typecheck rc=0. test:source 68/0 (the fix landed here, now passes). test:tools 121/0 (unchanged, this test lives in src/ not tools/). ## Diff read src/repositories/vehiculos.ts:528 - falls back to a direct FK lookup on vehiculosSubtiposTransporte only when the canonical view's vehiculoSubtipoLabel() returns null, so the display code is still canonical-first. src/app/vehiculos/[dominio]/editar/colectivo/page.tsx - reuses the existing conValorGuardado() helper (already used for chasis and carrocerias, same file) to append the current stored subtipo to the edit select only when it is absent from the canonical dropdown list; the helper is a no-op for any vehicle whose subtipo is already canonical, so no behavior change for the common case. Submit-time guard deletes submitData.vehiculoSubtipoTransporteId only when the stored value is non-canonical AND the submitted value is unchanged from it - a genuinely new or changed value (canonical or not) still goes through full server-side validation, matching the claimed scope exactly. Create form and create dropdown/query untouched, confirmed by diff scope (only the edit page and the repository touched). ## Correction - the claimed impact census does not hold today coder04 cited "26 live legacy vehicles (25 ELECTRICO, 1 METROBUS)" as this item's existing population. Measured independently, both bases, live vehicles only: every single one resolves to subtipo id 17/18/6/3 (codigo 3/2/1/4, the RUTAP-eligible numeric set) - PROD 1562+767+90+5=2424, DEV 1581+780+98+10=2469, each sum exactly equal to that base's total live vehicle count. Zero live vehicles anywhere reference the legacy word-coded subtipos (id 1 ELECTRICO, 2 DOBLE_PISO, 4 METROBUS, 5 MINIBUS). Not a blocker - the code is still correct defensive handling for whenever such a row exists (e.g. a DEV test fixture, or a future import edge case), and the submit-time guard and edit-only append are both inert, not wrong, against today's all-canonical population. Flagging because the stated urgency/population was wrong and nothing in this item's current measurement supports "26 affected vehicles" existing in PROD or DEV right now. ## NOT EXERCISED No live request through the edit form - the append/omit logic cannot be exercised against today's data (zero vehicles with a non-canonical subtipo in either base, per the correction above). No DB object touched, no migration. route.ts's vehicleSubtypesForEdit query and the create form were read only as cited context in the test file, not independently re-verified by me beyond confirming the diff excludes them.
  • audit-mba-l-cc audited · 1w ago
    audit pass: Re-review post-fix, gates fresh (typecheck/68-0/121-0), diff read, impact census independently re-measured
    payload
    {"scope":"Re-review post-fix, gates fresh (typecheck/68-0/121-0), diff read, impact census independently re-measured","outcome":"pass","evidence":"diff logic correct per scope; census contradicted - 0 live legacy-subtipo vehicles either base today, PROD/DEV sums equal totals exactly","reportRef":null}
  • coder03-mba-l-cc completed · 1w ago
    Shipped dev 5063d5eb + prod 7f4615ef, patch 235. Audit PASS (2nd pass after test-regex fix), gates green.
bug
4w ago by wi-cli-venus
1w ago
2026-10-09 04:19