docs: mark phase 1 complete

Production database migrated 0 -> 3 with row counts unchanged and both integrity
checks clean. Records the two problems found while building it: the newer-schema
guard was unreachable as first written, and create_control_plan -- the idempotency
gate for every write -- was check-then-insert, so a duplicate request surfaced as
an IntegrityError rather than as "already planned".
This commit is contained in:
Kai
2026-08-27 23:36:32 -07:00
parent ead5b38e17
commit 8e32f5d550
+19 -1
View File
@@ -232,7 +232,25 @@ commits`6df2f20` 解析器与意图分流 · `1580504` 适配器三态 · `07
「链接抽取」;`journalctl` 无新错误;`ps` 无孤儿 node;系统提示不含
`expert coding assistant`
### 阶段 1 · 契约与数据层(约 1.5 天)
### 阶段 1 · 契约与数据层 —— ✅ 已完成 2026-08-28
commits`e18f4de` 迁移框架 / 事务 / upsert / 索引 · `5de5933` `contracts.py`
测试 58 → 77。生产库已升级:`user_version` 0 → 3`integrity_check` ok
`foreign_key_check` ok,计数与迁移前一致,自动快照
`curator-v0-20260828T063553Z.sqlite3`
**顺带发现并修掉的两个问题**
1. 我最初把"库版本高于代码"的检查写在"无待办迁移则返回"之后 —— 那样它永远不会触发,
因为超前的库本就没有待办迁移,旧代码会继续往看不懂的 schema 里写。已调整顺序并加测试。
2. `create_control_plan` 是所有写操作的幂等闸门,却是 check-then-insert。
并发下两条 Telegram 消息可同时通过 SELECT,第二条撞 UNIQUE 抛 IntegrityError ——
于是"重复请求"表现为"失败"而不是"已计划"。已改为单语句,并加 6 线程栅栏测试。
**验证方式**:漂移守卫不是假设的 —— 给 `RECOMMENDATIONS` 加一个值而不改其它,
`test_exported_schemas_match_the_current_definitions` 确实失败。
### 阶段 1 原始清单(供对照)
1. `curator/contracts.py`dataclass + JSON Schema 定义 `ExtractionResult` /
`ReviewSynthesis` / `FactPack` / `WriteProposal` / `IntentPlan`**补 `external_ids`**)。