venus
VENUS-473
EVO-123: convert 3 UPDATE OF invariant guards to AFTER/no-column-list
Done normal
dvdb-venus-cc
EVO-123 / evolutiva-db.md R5. Convert each final-row-invariant UPDATE OF guard: no column list, OLD.x IS DISTINCT FROM NEW.x in body, AFTER (or constraint trigger), forced-red arm where a neighbouring BEFORE trigger does the rewrite. Write-shaping triggers keep UPDATE OF. Latent today (no rewriter found), hence p2; raise if a migration adds a BEFORE trigger that assigns a watched column. Done = every guard listed converted and its forced-red arm recorded. Guards (migration files, 3): cirugias modulo_consistency; practicaComplicacionesIntraOp compl_intraop_tipo; practicaComplicacionesPostOp compl_postop_tipo. The 6 confirm_* catalog-flag triggers are side-effect and keep UPDATE OF. Confirm against the live catalog.
Activity
-
Confirmed against live catalog (see EVO-123 note, same timestamp). The row's description names 3 guards assuming 2 separate tables (practicaComplicacionesIntraOp/PostOp) that do not exist in the live catalog - there is no such table. The actual live objects are 2 triggers, not 3: - cirugias.trg_cirugias_modulo_consistency, watches moduloId,subcategoriaId - practicas.trg_practicas_confirm_complicaciones, watches BOTH complicacionesIntraOp and complicacionesPostOp in one trigger (not two) Scope for this row is these 2 triggers. Still p2/backlog, latent (0 rewriters found live). Not started.
-
11778c930cd8237ff38fb4486f1aa97b710478b2 (Local-Author: db-venus-cc, not pushed - coder lane to push). Pending migration db/migrations/pending/venus95-invariant-guards-update-of-to-after.sql converts both live guards (cirugias.trg_cirugias_modulo_consistency BEFORE->AFTER+no-column-list; practicas.trg_practicas_confirm_complicaciones already-AFTER, column-list dropped) with OID-bound pre/postflight (house pattern, venus93/venus94 style) and exact function-source-diff postflight. FORCED-RED PROOF, scripted at db/migrations/pending/venus95-harness.sh (runs only against scripts/pg-harness.sh's throwaway loopback cluster, zero prod contact), ran clean 3/3: - OLD shape: a synthetic sibling BEFORE trigger (alphabetically after trg_cirugias_modulo_consistency) rewrites moduloId post-check. Guard passes, inconsistent row (moduloId=2, subcategoriaId chain expects 1) commits with no error. - NEW shape, same migration applied: identical sibling rewrite now raises 'cirugias.moduloId (2) does not match subcategoria chain moduloId (1)', statement aborts, nothing commits. This is the exact hazard R5 exists to close, demonstrated both open and closed. SHAs: migration 0d2623a8d1b4505e1c43cb9428da0521f650ecb637285a8571c0aac68793015f, harness b49805bbd838ec4867e22e522b5bcdb02ab30c7f3823c16435441dde953f9bc8. STILL UNAPPLIED, no apply GO sought - this is source + proof, latent/p2/prophylactic per the row. Ready for source review.
-
11778c9 source BLOCK, exact migration SHA-256 0d2623a8d1b4505e1c43cb9428da0521f650ecb637285a8571c0aac68793015f. General finding: a postflight expectation derived by replace() from the pre-image can equal that pre-image when the old anchor is absent; equality with post-image then does not prove conversion occurred. For cirugias, an already-converted function still attached to the old BEFORE/UPDATE OF trigger passes this no-op expected-source construction. Require old-anchor presence, expected_post distinct from pre_def, and forced-red partial-conversion fixture. Separate behavior regression: practicas is a write-shaping AFTER UPDATE OF trigger; replacing SET-list selection with OLD/NEW equality skips same-value assignment and can leave referenced complications unconfirmed. Keep practicas UPDATE OF. No apply GO sought.
-
audit fail: SOURCE review of unapplied 11778c930cd8237ff38fb4486f1aa97b710478b2, venus95 invariant trigger migration
payload
{"scope":"SOURCE review of unapplied 11778c930cd8237ff38fb4486f1aa97b710478b2, venus95 invariant trigger migration","outcome":"fail","evidence":"BLOCK: practicas OLD/NEW equality skip changes UPDATE OF assignment semantics and suppresses confirmation on same-value SET; cirugias replace()-derived expected function text can equal pre-image when old anchor is absent, so postflight passes partial prior conversion. Need split trigger roles and forced-red partial-conversion proof. SQL SHA-256 0d2623a8d1b4505e1c43cb9428da0521f650ecb637285a8571c0aac68793015f. Unapplied; no prod/harness write by audit.","reportRef":"audit-venus-ca-muwrg6j1tj4j"} -
THIS ROW'S PENDING MIGRATION IS ON origin/main WHILE THE ROW IS BLOCKED. Verified by support-evolutiva-cc at 14:20Z by reading the remote, not the local tree. `git log origin/main` places 11778c9 as the PARENT of 6964dbe (VENUS-344, live). `git show --stat 11778c9` is two files and nothing else, both under `db/migrations/pending/`: `venus95-invariant-guards-update-of-to-after.sql` (256 lines) and `venus95-harness.sh` (72 lines). No src/, no applied/, no catalog change - so PROD IS UNAFFECTED and nothing executed. WHY IT IS RECORDED ANYWAY. coder-venus-cc pushed all three handoff commits on pmmaster-evolutiva-cc's earlier explicit instruction (tag pmmaster-evolutiva-cc-muwrc9ps3go2, "THREE unpushed commits... push as-is, no amend"); the do-not-push ruling arrived AFTER the push. That sequence is correct conduct on both sides and the commit is NOT being reverted - reverting a landed push is itself destructive and is not the remedy. THE ACTUAL HAZARD IS A READER, NOT THE BYTES. A file in `db/migrations/pending/` on main looks exactly like a queued, cleared migration, and this row is BLOCKED on two named defects - the practicas write-shaping regression and the `replace()`-derived postflight that cannot fail on an already-converted body. **Presence on main is NOT an approval signal for VENUS-473 and must not be read as one.** The collision risk is immediate and numeric: db-venus-cc is applying venus94 for VENUS-344 right now, and this is venus95 in the same directory. THE DISCRIMINATOR FOR WHOEVER PICKS UP THE DIRECTORY NEXT: venus94 is authorized (VENUS-344, caller half live on 6964dbe, re-hash against 9c9de8a0 before applying). venus95 is NOT (this row, blocked, both defects open). The approval lives on the row and in a digest-bound GO, never in the file's location.
-
Corrective commit 1a46b48 (after blocked 11778c93): split migration to cirugias only, practicas changes fully removed (write-shaping, stays on UPDATE OF, one-line WHY in file). Postflight strengthened: old-anchor-presence preflight assertion, new-trigger-OID-vs-preflight-OID assertion, exact tgtype=21 pin, expected_post IS DISTINCT FROM pre_def non-vacuity assertion. venus95-harness.sh gained arm 3: forced-red partial-conversion fixture, reproduces the old vacuous pass then shows fixed preflight aborting. 5/5 pass. Still UNAPPLIED/UNPUSHED - awaiting re-review.
-
audit pass: SOURCE re-review of corrective 1a46b48afee991e06a49073926ea1c36fb7032cd, cirugias-only unapplied migration
payload
{"scope":"SOURCE re-review of corrective 1a46b48afee991e06a49073926ea1c36fb7032cd, cirugias-only unapplied migration","outcome":"pass","evidence":"Migration SHA-256 eca664e8902777531f60afa423463ce8385b25341e52bbcc2da6174659769603. practicas write-shaping AFTER UPDATE OF trigger removed from scope, preserving same-value SET re-confirmation. cirugias preflight pins old function anchor and old trigger shape; postflight pins changed trigger OID, exact tgtype 21, no UPDATE OF, non-vacuous expected source and exact function diff. Forced-red partial-conversion fixture source reviewed; db lane reports 5/5 pass, not independently run by audit. Unapplied: SOURCE PASS only, NOT APPLY GO; no live behavior proof.","reportRef":"audit-venus-ca-muwry8hizd95"} -
PUSH BINDING / PTD LIMIT (audit-venus-ca, 2026-10-06): coder-venus-cc re-read PUSHED blobs at origin/main 1a46b48afee991e06a49073926ea1c36fb7032cd. cirugias-only SQL = 12,387 bytes, SHA-256 eca664e8902777531f60afa423463ce8385b25341e52bbcc2da6174659769603 (matches PM's exact-byte apply GO); venus95-harness.sh = 7,336 bytes, SHA-256 90cca2f5e30ff5fb56f5ef19ca2445579b5322f1387391bd4b89e5d5a12b6f81. This was a .sql/.sh-only push: no app artifact deployed, so no version bump or deploymentId exists to bind; that is NOT a skipped Vercel PTD. SOURCE PASS already recorded, apply remains db-venus-cc's action under PM GO. Pushed blob identity does not itself prove applied catalog state.
-
Applied to prod via DATABASE_URL_DIRECT, psql -v ON_ERROR_STOP=1, tee'd to scratchpad log (empty = silent clean run, no NOTICE/ERROR). Readback in-session: - cirugias trigger OID 29638 (new, DROP+CREATE confirmed), tgtype=21 (AFTER, ROW+INSERT+UPDATE, no BEFORE bit), updof_cols=0 (UPDATE OF list gone). - fn_cirugias_modulo_consistency() body confirmed in converted shape: TG_OP='UPDATE' AND OLD/NEW moduloId+subcategoriaId NOT DISTINCT guard present, RETURN NULL throughout. - practicas.trg_practicas_confirm_complicaciones UNTOUCHED: tgtype=21, updof_cols=2 - migration file grepped, contains zero DDL against practicas (comment-only references). practicas KEEPS UPDATE OF deliberately: its trigger is write-SHAPING, the SET list is its input, and UPDATE practicas SET complicacionesIntraOp = complicacionesIntraOp must still set isConfirmedByClient. Not an unfinished half of this migration; next sweep must not finish the job on practicas. CLOSE RECORD (three-field): 12,387 B / sha256 eca664e8902777531f60afa423463ce8385b25341e52bbcc2da6174659769603 / commit 1a46b48afee991e06a49073926ea1c36fb7032cd (venus95-invariant-guards-update-of-to-after.sql). Harness file: 7,336 B / sha256 90cca2f5e30ff5fb56f5ef19ca2445579b5322f1387391bd4b89e5d5a12b6f81 / same commit (venus95-harness.sh). Both digests re-read from the PUSHED blob by coder-venus-cc, matching pmmaster's GO digest exactly. SCOPE: cirugias only. Harness arm 3 (forced-red partial-conversion fixture, proving the OLD vacuous postflight pass and the NEW fixed preflight abort) was RUN BY db-venus-cc (5/5 pass) and SOURCE-REVIEWED ONLY by audit-venus-ca - audit did not execute the harness. Not phrased as independently verified. NOT EXERCISED: no live end-to-end UPDATE against a real cirugias row with a sibling-trigger rewrite was run against PROD (that scenario was only exercised in the harness, by design - prod has no fixture-grade sibling trigger to force it). Prod readback is limited to object-identity/shape confirmation, not a forced-red repro against live data.
-
completed
-
audit pass: POST-APPLY independent SELECT-only production catalog readback for cirugias-only 1a46b48 / eca664e8
payload
{"scope":"POST-APPLY independent SELECT-only production catalog readback for cirugias-only 1a46b48 / eca664e8","outcome":"pass","evidence":"With default_transaction_read_only=on, public.cirugias.trg_cirugias_modulo_consistency exists at OID 29638, enabled O, tgtype=21 (AFTER INSERT OR UPDATE ROW), zero UPDATE OF columns, and binds fn_cirugias_modulo_consistency(). The function is invoker (prosecdef=false), proconfig={search_path=public}, has OLD/NEW moduloId distinctness guard and RETURN NULL. public.practicas.trg_practicas_confirm_complicaciones remains enabled O, tgtype=21, UPDATE OF two complication columns, bound to original function. This matches db lane's close and source PASS. LIMIT: I did not independently know pre-apply OID, execute the migration, or run a live sibling-rewrite/complication row; forced-red 5/5 remains db-run harness evidence reviewed only as source by audit. No synthetic production write.","reportRef":"audit-venus-ca-muwry8hizd95"} -
db handoff a3bd9dc (pending->applied + schema.md regen) pushed to main by coder-venus-cc in 7536dae push, 1.17.43.
bug
1w ago by coder-mars-cc
1w ago
2026-10-06 14:41