basquetWi + New ticket
terra TERRA-101

Stage 0: snapshot paciente nombre/apellido onto terraPracticas - a practica's name silently re-renders when the shared registry row is corrected

Done high ctcoder-terra-cc

terraPracticas ALREADY snapshots pacienteDocumentoNumber/Dob/Sexo/HistoriaClinica and the writer's own comment says a practica 'must not drift if the shared pacientes row is corrected later' - but nombre and apellido are LIVE JOINS at practica-detail.ts:137 and practicas/page.tsx:113. Correct a surname in enamel and every terra practica ever recorded re-renders under the new name while the documento beside it stays pinned. The record is half-frozen and nothing says which half. DECISIONS (audit-terra-ca mt4jd9kgsy1t): do NOT backfill - pre-change rows keep a PERMANENT COALESCE fallback documented as predating snapshotting, because backfilling from the live row asserts today's name was the name at the time, which is the exact claim this fixes. Proof is source-parsed read-site arms plus a db-terra-cc rollback-scoped rename; terra has no Postgres harness and must not create fixtures in enamel's shared clinical registry. Include a census arm over ALL pacientes joins so a future third read site cannot reintroduce the drift (TERRA-63 shape). Migration comment must state pacienteSexo and pacienteHistoriaClinica are UNWRITTEN PLACEHOLDERS - no writer in src, 0 populated - so their emptiness has a stated cause. Terra-local and reversible; independent of the cross-app catalog contract, which authorizes nothing beyond this stage.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • wi-cli-venus created · 7w ago
  • wi-cli-venus completed · 7w ago
    Stage 0 shipped and live-verified in v0.24.37 (dpl_2LZGqDvbcmoHDCkeJRJexiVwcAx5). terra_40 added two nullable columns and replaced vTerraPracticas (append-only; 42P16 forced the two columns to positions 26/27, predicate byte-identical). Both read sites COALESCE snapshot-first; writer feeds the INSERT from storedPaciente, never from input. NO BACKFILL, permanent fallback for pre-terra_40 rows: backfilling from the current registry value would manufacture the evidence. Bidirectional fixture proof on ea19312a, rolled back: snapshot-first did NOT move on base table AND view, join-only DID move. Stages 1-3 remain unauthorized - they need the cross-app data contract.
  • wi-cli-venus commented · 7w ago
    SUPERSEDED DECISION, recorded because the reasoning in the terra_40 commit now reads as more cautious than the policy warrants. Elazar 2026-08-22: test practicas are disposable, there will be hundreds over the coming weeks, they get deleted every time the app improves, and development is NEVER held on them. The single práctica ea19312a is fully documented in pm/2026-08-22-test-practica-ea19312a-recreation.md so it can be dropped without losing anything. What does NOT change: the no-backfill ruling. That was never about preserving the test row - it is about not writing today's registry name into a column whose meaning is what the name was on the day of the práctica. What DOES change: the permanent COALESCE fallback stops being permanent. Once the pre-terra_40 rows are gone, both snapshot columns can go NOT NULL and the fallback branch deletes from both read sites. Gated only on TERRA-7 now, not on the row.
bug
7w ago by wi-cli-venus
7w ago
2026-08-22 15:43