mars
MARS-537
doc-pair + legajo create-vs-update TOCTOU: advisory locks serialize create-vs-create only; no DB unique on doc-pair/legajo → race can mint two live rows sharing a documento or legajo
Done normal
unassigned
Surfaced by audit-mars-ca post-push cold review of MARS-532 (3b547a3). NOT a 532 regression — same TOCTOU class findDocumentConflict already had pre-532. Identity-attach dedup vectors email + googleSub ARE DB-unique-enforced (those hold). doc-pair (documentoType+documentoNumber) and legajo have NO DB unique, so a create-vs-update race under advisory locks (which only serialize create-vs-create) can mint two live rows sharing a doc/legajo. Full close: DB partial-unique indexes on doc-pair + legajo WHERE deletedAt IS NULL — requires data dedup FIRST (may surface real live duplicates needing careful merge — Class-A, audit pre-apply, coordinate coder). db-lane leads, coder aligns app-side conflict handling.
Questions
No questions.
Activity
-
doc-pair + legajo TOCTOU structurally closed: mig 077 partial-unique indexes uq_users_docpair + uq_users_legajo (WHERE deletedAt IS NULL, blank-guard, 0 live collisions) + approval-handler 23505 classification. Shipped d47189a v2.48.3, audit PASS:077 + PASS:d47189a. Residual friendly-message coverage on other write paths → MARS-539.
bug
4w ago by wi-cli-venus
4w ago
2026-07-20 09:59