## What to build 实现 ADR-0041 的 profile-scoped BotHarness operational database owner,为后续 Session ownership、Messaging、Attention、Outbox 与 export metadata 提供一个可靠的物理事务宿主,同时保持各 deep module 的 table/interface ownership。 ## Interface and invariants - 一个 `$DSH_HOME/botharness/botharness.db`,一个 Host-lifetime owner、connection 与 post-commit notification seam。 - OS-backed exclusive Profile Writer Lease;第二 Host fail closed,可提供只读 diagnostics。 - 一个 monotonic Schema Generation;modules 只贡献内部 migration steps。 - migration 在 isolated temporary copy 中完成并校验,成功后 atomic replace;失败不触碰 active DB。 - SQLite open/migrate/commit 失败进入 recovery mode;不回退 NDJSON、storage domain 或内存写入。 - transaction scope 只能由 owning modules 使用,不暴露 generic repository。 ## Acceptance criteria - [ ] lease、mount、close、recovery-mode interface 与 stable errors。 - [ ] schema plan、temporary-copy migration、integrity validation、atomic activation tests。 - [ ] concurrent writer、crash-before/after-publish、unknown-newer-generation tests。 - [ ] existing roster/session operational records 的 forward migration plan;本地开发无 production data 时不造复杂 legacy fallback。 - [ ] NFR evidence:代表性 transaction/lookup 基准、DB/WAL 可观测指标、fault-injection cases。 ## Dependencies - Architecture decisions: #71 ## Blocks - Session ownership/activity projection implementation - #46 Messaging deep module - #47 Inbox/Orchestrator operational facts
Activity