basquetWi + New ticket
venus VENUS-215

init-db.sh: reduce to file-creation + PRAGMAs + seeds, delete duplicate schema (hub self-bootstraps)

Done normal clcoder-llmmsgsrv-cc

scripts/init-db.sh (the 'authoritative' fresh-schema / disaster-recovery rebuild script) has diverged from the schema the hub actually runs on, to the point a from-scratch DB is DEAD ON ARRIVAL: booting the hub against a fresh init-db.sh DB throws SqliteError: cannot INSERT into generated column 'tag'. init-db.sh declares tag as GENERATED ALWAYS AS (sender||'-'||id) VIRTUAL; the LIVE DB has tag as a normal STORED column and stmtInsertMsg inserts into it explicitly. Column counts also differ: live=14, init-db fresh=16 (2 extra cols in init-db that live lacks — reconciliation must determine whether those are cruft or a live gap). Impact: any DR rebuild / tests / tooling depending on init-db.sh does not work today; a real rebuild would discover this DURING the disaster. NOT caused by VENUS-210/214; found by coder-llmmsgsrv-cc while verifying the init-db action_required MED fix. Fix (PM ruling: option a): treat the LIVE schema as source of truth — dump live schema, regenerate init-db.sh from it so a fresh DB matches live exactly (tag STORED not generated, includes action_required, correct 14-col set), then boot-test the hub against a fresh DB to prove writability. Do NOT mark it decorative (option b rejected — dead DR that reads as coverage is worse than none). My maintenance boundary (scripts/init-db.sh); audit-review + no live-hub impact so no bounce coupling.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Questions

No questions.

Activity

  • wi-cli-venus created · 5w ago
  • wi-cli-venus titleChanged · 5w ago
    init-db.sh: reduce to file-creation + PRAGMAs + seeds, delete duplicate schema (hub self-bootstraps)
  • wi-cli-venus commented · 5w ago
    APPROACH CHANGED (coder read-only evidence + PM ruling): NOT regenerate-to-match-live. coder proved the hub self-creates its full schema via CREATE TABLE IF NOT EXISTS — booted against a COMPLETELY EMPTY FILE: 29 tables + 42 views, zero errors, /register + /send ok, action_required inferred (blocked->1). So init-db.sh's 697-line schema is a v1 DUPLICATE = the drift class itself; regenerating it resets the rot clock, deleting it kills the class (single SSOT = hub code, boot-tested every restart). 16-vs-14 delta resolved: initdb-only origin_tag/request_tag/retracted_by + tables hub_log/opinion_replies/opinion_requests/outbox/reply_nudges/thread_map = v1 cruft 0 refs; live-only created_at = dead column 0 refs. RULING: reduce init-db.sh to DB-file creation + PRAGMAs + seeds; hub boot owns schema. GUARDRAILS: (1) preserve all seeds/PRAGMAs hub doesn't self-create; (2) prove elazar_questions absence (hub.mjs:244 skip) leaves hub functional or create just that table; (3) scope=init-db.sh only, do NOT touch live DB cruft; (4) boot-test transcript (fresh reduced DB -> hub -> /send -> action_required) into the WI as DR-works proof.
  • wi-cli-venus commented · 5w ago
    SHIPPED + PM-verified, NO bounce (running hub never reads init-db.sh; hub.mjs diff 27a9aef..636b4d0 = EMPTY, confirmed running hub unaffected). Commits: 2be103d (v2.38.0, init-db.sh -685/+34, schema DDL deleted -> creates empty WAL file only) + 636b4d0 (v2.38.1, audit fixes). All 4 guardrails proven: (1) seeds preserved — all 3 are hub-side INSERT OR IGNORE (reject_bare_dm=1, guide v4.19, blocked_agent_names 9 rows), hub adds foreign_keys=ON the old script lacked; (2) elazar_questions hard-410 not tolerated-absence (0 runtime refs); (3) live DB untouched (created_at + 6 cruft tables stay); (4) DR boot-test green: reduced init-db.sh -> empty WAL -> hub boot 29 tables/42 views/0 errors, /register x2 /send x5 ok, action_required inference correct incl case-fold. Audit HIGH (real, dangerous): DR line defaulted to v1 LLMMSG_SRV_DB/llmmsg.sqlite the hub never opens + exists-guard on 0-byte leftover -> DR broken before AND after; fixed DB=LLMMSG_DB default + -e guard. Docs drift fixed (CLAUDE.md/AGENTS.md now name hub.mjs boot block as sole schema authority). FOLLOW-UP: hub.mjs:129/:488 false 'init-db.sh is schema authority' comments delegated to coder (comment-only, no bounce, rides next real bounce).
  • wi-cli-venus completed · 5w ago
    init-db.sh reduced to DB-file creation only; duplicate schema deleted, drift class killed permanently (single SSOT = hub boot block, boot-tested every restart). DR now works (was dead on arrival). No bounce needed. hub.mjs:129/488 comment cleanup delegated to coder as comment-only follow-up.
bug
5w ago by wi-cli-venus
5w ago
2026-07-12 09:21