Problem
lnk_persist_init is overcomplicated because it defends against a broken cypher snapshot (rtj issue [linked]). Specifically:
force_recreate = TRUE flag is misleadingly named — it doesn't actually force-recreate, it only DROPs tables with unexpected GENERATED ALWAYS columns
- DDL-drift detection only catches ONE specific drift pattern (GENERATED columns from a prior
frs_col_generate() run baked into snapshot)
- No "wipe data" concept — the function only thinks about DDL, not data state
- Conflates "ensure tables exist with right shape" (setup) with "ensure tables are empty" (clean-slate run)
Most of this complexity exists to compensate for the rtj-side snapshot that ships with stale fresh.streams data. Once that's fixed, this function can be ~20 lines simpler.
Proposed: simplify after rtj snapshot fix
When the clean-snapshot rtj issue lands:
- Drop
force_recreate flag — no longer needed
- Drop DDL-drift detection (the
.lnk_validate_persist_table helper + GENERATED-column check)
- Function becomes:
CREATE SCHEMA IF NOT EXISTS + CREATE TABLE IF NOT EXISTS for each expected table. That's it.
- Update tests to reflect simpler contract (drop the DDL-drift test cases — they become obsolete)
Why not now?
The rtj snapshot rebuild isn't done yet. Until it ships, lnk_persist_init's defensive logic IS load-bearing — without it, cypher dispatch fails with "cannot insert non-DEFAULT value into column gradient" (the bug it was added to fix in Phase 7).
So this issue waits for the rtj-side fix to land first, then this becomes a pure simplification PR. Cross-ref blocking.
Acceptance
lnk_persist_init has no force_recreate arg
- No DDL-drift detection logic
- Tests cover only "creates tables if missing, no-op if present"
- Function body < 50 lines (currently ~80)
Cross-ref
Problem
lnk_persist_initis overcomplicated because it defends against a broken cypher snapshot (rtj issue [linked]). Specifically:force_recreate = TRUEflag is misleadingly named — it doesn't actually force-recreate, it only DROPs tables with unexpected GENERATED ALWAYS columnsfrs_col_generate()run baked into snapshot)Most of this complexity exists to compensate for the rtj-side snapshot that ships with stale fresh.streams data. Once that's fixed, this function can be ~20 lines simpler.
Proposed: simplify after rtj snapshot fix
When the clean-snapshot rtj issue lands:
force_recreateflag — no longer needed.lnk_validate_persist_tablehelper + GENERATED-column check)CREATE SCHEMA IF NOT EXISTS+CREATE TABLE IF NOT EXISTSfor each expected table. That's it.Why not now?
The rtj snapshot rebuild isn't done yet. Until it ships,
lnk_persist_init's defensive logic IS load-bearing — without it, cypher dispatch fails with "cannot insert non-DEFAULT value into column gradient" (the bug it was added to fix in Phase 7).So this issue waits for the rtj-side fix to land first, then this becomes a pure simplification PR. Cross-ref blocking.
Acceptance
lnk_persist_inithas noforce_recreateargCross-ref