basquetWi + New ticket
movilba MOVILBA-554

Se puede crear un vehiculo con un interno ya usado en la misma linea

Canceled high cmcoder03assistant-mba-l-ca

Reported by Eugenia, Para Elazar item 9, on 2026-09-21. Linea 34 interno 1 already existed on dominio AG986KJ and the form still accepted a new vehicle on the same linea with the same interno (dominio TT333AA). Needs a decision on scope before coding: whether interno is unique per linea only among live vehicles, or across closed periods too. A vehicle that was given a baja frees its interno in the real world, so a naive unique index would block legitimate reuse.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • wi-cli-venus created · 3w ago
  • wi-cli-venus note · 3w ago
    DB04 SELECT-only PROD 2026-09-23 14:01 ART: current ALTA via canonical estado label1599 vehicles, zero duplicate (numero_linea,interno). Independent current/open history and open source period checks also1599/zero. All current vehicle states2413:528 duplicate pairs (1196 vehicle-pair memberships). Current source snapshot5 history5528 rows:1665 repeated row pairs,631 pairs shared by distinct vehicles (1415 vehicle-pair memberships). No null keys. Historical line34 interno1 includes AE133ND/AG986KJ. Proposal for Elazar: current ALTA-only uniqueness preserving historical reuse. No current PROD active cleanup indicated, but line is in history while interno/state are in vdc: concurrency-safe enforcement design required after scope decision, not a ready single vdc index. No DDL. SQL plus full631 pair listing /data-lezama/movilba/evidencia/MOVILBA-554/2026-09-23-db04-pairs.sql and 2026-09-23-db04-PROD.txt.
  • wi-cli-venus questionAsked · 3w ago
    Not ours to decide - it is a business rule, so it went to Eugenia as question 84 in hoja 'Para Eugenia' of todo-rutap-importacion-prestaciones.xlsx. Checked first against hojas pase-de-dominio, Resueltos and Convenciones: interno reuse after a baja is not answered in any of them. The question carries db04's PROD measurement: zero duplicated (linea, interno) pairs among the 1599 live ALTA vehicles, but 631 pairs shared by DISTINCT dominios once closed periods are included. Implementation waits on her answer - live-only would be enforceable today at zero cleanup cost, history-wide would require reconciling those 631.
  • wi-cli-venus note · 3w ago
    Follow-up PROD SELECT-only 2026-09-23 14:16-14:18 ART, source snapshot5 (5528 periods), independently checked Python+SQL. The631 distinct-vehicle (linea,interno) collision groups split exclusively: A26 same-chassis-only; B549 different-chassis with no positive-duration overlap; C56 groups with different-chassis overlap, comprising57 period-pair cases. C is NOT ZERO. Priority C>B>A; same-chassis pairs occur in153 groups overall (mixed groups must not be subtracted wholesale). Exact chassis equality and upper(trim) yield same26/549/56 totals. Intervals [alta,baja), null baja=infinity; zero-duration and same-day touching not positive overlap.430 different-chassis period pairs touch at endpoints. No missing chassis/start or reversed dates. Full57-case list (both dominios/chassis/date ranges, linea,interno,history IDs): /data-lezama/movilba/evidencia/MOVILBA-554/2026-09-23-db04-overlap-report.md; raw SELECT CSV, classification JSON and independent SQL alongside. These measure recorded administrative date overlap, not independently proven simultaneous physical occupancy; clarify that semantics before calling each a source defect. No index design/DDL, workbook changes or DB writes. Send case list with question84; enforcement waits on Eugenia.
  • db03-mba-l-cc note · 3w ago
    db03-mba-l-cc 2026-09-24 07:43 -03 - Book vs Eugenia's rule (linea, interno unique). Read-only. Instrument: psql on PROD, current_database=movilba, current_user=elazar (superuser URL, SELECT only, BEGIN READ ONLY). Source: rutap.rutap_rows snapshot 6 (2026-09-24-0434 book, 5538 rows, 2414 dominios), NOT a derived app table. Period = [fecha_alta, fecha_baja or open), half-open; pair = (btrim linea, btrim nro_interno); no blank linea/interno. SQL+output: /data-lezama/movilba/evidencia/MOVILBA-554-interno-duplicado.sql/.out. 1. Pairs carrying more than one dominio at any time: 636 pairs (1425 dominios). Expected, buses are replaced on the same interno. 2. Pairs where two DIFFERENT dominios have overlapping periods: 56 pairs, 113 rows (57 dominio pairs). So the book DOES violate the rule as stated, historically. Sensitivity, closed intervals (a baja day touching the next alta day counts): 503 pairs, 1172 rows - most of that is same-day handover, and which reading is right is a question for her, not measured. 3. Currently open (latest row per dominio has no fecha_baja): 1599 of 2414 dominios; pairs with 2 or more open dominios: 0. Same result counting any open row: 0. So among the current state the book satisfies the rule; the create form would not have collided with the book's open state. 4. Examples: 12/1 AI009CM alta 2026-01-21 open vs PMJ020 2025-07-08..2026-02-12; 12/33 AD766RX 2025-07-08..2026-04-17 vs AI189FQ 2026-04-08 open; 102/30 AE352LC 2025-08-27..2025-11-17 vs LUY192 2025-07-08..2025-09-01; 106/4544 AE971FF 2025-07-08..2025-10-22 vs NPK888 2025-07-08..2025-07-11; 118/43 OIW804 2025-07-08..2025-12-29 vs PON385 2025-12-28..2026-03-04. Her example: 34/1 in the book is AE133ND (to 2026-02-23) then AG986KJ (2026-02-23, open); TT333AA is NOT in the book snapshot (created in the app 09/21, after the book). Reading: the rule is implementable against the current open state (0 collisions), but 56 pairs overlap in history, so a rule enforced over all periods contradicts the SSOT; it would have to be scoped to open periods or go back to Eugenia. Not measured: DEV or app-created rows, overlaps within one dominio, whether overlaps are book typos, which interval convention she means, the 1599 open count against estado_ciclo_actual in the app (used latest-row fecha_baja null in the book).
  • coder03-mba-l-cc decision · 3w ago
    coder03-mba-l-cc | 2026-09-24 - ALCANCE DECIDIDO contra el libro, no contra la app. Medicion de db03-mba-l-cc (nota propia en este item): el libro tiene 56 combinaciones (linea, interno) con periodos que se superponen entre dominios distintos, 113 renglones, y CERO combinaciones con dos dominios vigentes a la vez. Por lo tanto la regla que pidio Eugenia es implementable TAL CUAL mientras se acote a los periodos VIGENTES: rechazar un alta cuya (linea, interno) ya esta en uso por un vehiculo vigente no rechaza ningun caso del libro. Una regla sobre TODOS los periodos contradiria al libro en 113 renglones y NO se implementa - seria la aplicacion decidiendo que el SSOT esta mal. Lo que falta: el chequeo en el camino de alta de src/services/vehiculos.ts, con mensaje en castellano, y su test. El predicado se escribe contra el estado del ciclo VIGENTE, nunca contra la presencia de una fila de historial: la ultima baja registrada no prueba que el vehiculo este de baja hoy (MOVILBA-174). NO EJERCITADO: no hay codigo escrito todavia; lo unico medido es el reparto del libro citado arriba.
  • coder03-mba-l-cc statusChanged · 3w ago
    alcance confirmado contra el libro; falta el chequeo y su test
  • coder03-mba-l-cc assigned · 2w ago
    db03-mba-l-cc
  • coder03-mba-l-cc assigned · 2w ago
    coder03assistant-mba-l-ca
  • coder03-mba-l-cc statusChanged · 2w ago
  • coder03-mba-l-cc note · 2w ago
    2026-10-01 21:17 ART, coder03-mba-l-cc. Reassigned from the db lane to a coding lane and moved off inProgress. The remainder is the check in src/services/vehiculos.ts plus its test, per the 2026-09-24 note on this item, which is app code and out of the db lane. Parked as inProgress on db03 it looked worked while nobody who could finish it owned it.
  • coder03assistant-mba-l-ca canceled · 1w ago
    Superseded by MOVILBA-566. Eugenia/Elazar's 2026-10-05 answer is to allow duplicate vigente linea+interno on Alta and Modificacion; source and PROD/DEV census found no gate to remove.
bug
3w ago by wi-cli-venus
1w ago
2026-10-05 18:22