The dual-write window ends (dev_docs/dimensions_implementation_plan.md PR9):
journal_entry_lines.cost_center/project are now GENERATED ALWAYS AS
(NULLIF(dimensions->>'1'/'6','')) STORED — divergence from the bag is
impossible by construction instead of by convention.
- migration 20260702230000: drift pre-flight (refuses cutover on
inconsistent data; prod verified 0 drift across 593k rows), column swap
(DROP metadata-only + one-rewrite ADD pair), and atomic redefinition of
the two SQL writers — retag_line_dimensions (SET dimensions only) and
bulk_book_transactions (INSERT names the bag only)
- TS writers stripped of the mirror spread: engine buildLineInserts
(covers create/update/reversal), storno-service (reversal + correction),
SIE import bulk insert, sandbox seed
- lineDimensionColumns() removed from dimension-resolver — nothing derives
mirrors in TypeScript anymore; normalizeLineDimensions + the deprecated
cost_center/project INPUT aliases stay (API contract, they normalize
into the bag); JournalEntryLine ROW type keeps the fields (generated
columns still SELECT)
- immutability carve-out unchanged BY DESIGN: its whole-row diff already
subtracts dimensions/cost_center/project on both sides, which is exactly
what makes it correct with generated columns (BEFORE-trigger NEW carries
not-yet-recomputed mirror values)
- audited every reader (v1 journal-entries, MCP query_journal filters +
group_by, rc-basis-gaps) — reads are untouched; no index, view, or
constraint referenced the TEXT columns, so DROP COLUMN cascades nothing
- new pg suite: generated derivation, explicit-mirror-write rejection,
draft-update recompute; existing retag/substrate/bulk-book suites
updated to bag-only writes (their mirror assertions now exercise the
generation expression)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>