Hard refresh wiped cache/ready after a successful hydrate, then the unchanged fingerprint never re-ran the effect. Invalidate only via a planner that preserves list-sync hits and re-hydrates after post-task drops. Co-authored-by: Cursor <cursoragent@cursor.com>
4.7 KiB
4.7 KiB
title, status, created, updated, owner, branch, worktree, mutex
| title | status | created | updated | owner | branch | worktree | mutex |
|---|---|---|---|---|---|---|---|
| 受控正文 canonical hash 漂移与重复 hydration 实施 | done | 2026-09-14 | 2026-09-14 | implementer_cursor | fix/controlled-content-canonical-hash | .worktrees/fix-controlled-content-canonical-hash | docgov |
受控正文 canonical hash 漂移与重复 hydration 实施
目标
按整改计划 W1–W6 修复受控文档 canonical/raw 哈希漂移、错误语义与重复 hydration;工程门禁在 worktree 内通过。不操作 data/dev、共享 Docker,不合 dev。
范围
- W1 语义保持的 Markdown canonicalization + golden test
- W2 统一 bootstrap / PATCH / agent commit / backfill 的 hash、snapshot、DocGov、output.md bytes
- W3 已建账本以 head 为 SSOT;投影不一致不静默覆盖;结构化 error code
- W4 dry-run 默认 reconciler/CLI(项目 143 分类为
LEGACY_CANONICALIZATION_DRIFT);不在本 worktree 对真实数据 apply - W5 前端 lease no-op 保引用、hydrate fingerprint + 最小在途去重、解析结构化错误
- W6 Go 单测、PG 相关能力、前端 test/build
非目标
- W7 占集成槽合
dev/env-service.sh/ 共享容器 - W8 真实浏览器 / 真实 PI UI 验收
- 在 worktree 读写
data/dev或共享数据库
步骤
- cherry-pick
81288bd诊断文档 - 创建本任务并认领
docgov - W1–W6 实现与 focused/门禁测试
- 更新 audit/remediation/FEATURE-MATRIX/CURRENT
- 原子提交 + handoff
- 合入前审查 blockers:00032 / 修订号 / live CLI / HashUpdater 预加载 / 读路径 drift 冲突 / 隔离 PG 状态
- follow-up:旧 head 正文备份、备份不可覆盖、原子写目录 fsync;单提交后 done
- 终审 3 项:live 正向确认 :5433+agent_system_dev+data/dev;备份三件套+唯一目录/O_EXCL+全路径;rename 后目录 Sync 兼容处理
- UI clean run:doc-001 等本地 legacy 不发 content/revision;hydrate 资格对齐 toolbar server-backed
- UI 竞态:晚到 list sync 不得擦掉成功 hydrate;清空 ready/cache 必须重水合;编辑/PATCH 基线受保护
验收标准
CanonicalizeMarkdown保留双空格硬换行;golden test 覆盖- 写路径
file_sha == record_sha == head_sha(同一 canonical bytes) - 记录不存在才 404;missing/empty/mismatch 为结构化 error code
- reconciler 默认 dry-run;legacy drift 不把旧 head 覆盖回文件、不只改 DB hash
- lease 无变化返回原
deliverables引用;同文档 hydrate 去重 go vet ./...、go test -short ./...、web npm test、web npm run build真实通过后才勾选- 不宣称未执行的 UI / 容器 / 数据修复
- goose 00032 允许
migration_repair;repair 不递增head_revision_no/human_revision_count - CLI 默认仍拒绝共享库/路径;
--live --environment dev --doc-id --confirm REPAIR_SINGLE_DEV_DOC才允许单文档 apply MarkDocumentContentUpdated未预加载时从 DB 补偿;retry 仍同步- 投影 drift 返回
DOCUMENT_CONTENT_PROJECTION_DRIFT,不静默展示破坏性旧 head - 隔离
TEST_DATABASE_URL未配置:TestReconcile_LegacyRepair_PGskip,记为 blocker,未用 5433 业务库代替
相关链接
- Audit: ../../audit/2026-09-14-project143-controlled-content-404.md
- Remediation: ../../remediation/2026-09-14-controlled-content-canonical-hash-remediation.md
- Handoff: ../handoffs/2026-09-14-controlled-content-canonical-hash.md
- Test report: 本轮仅工程门禁;真实 UI 属 W8
证据 / 备注
- cherry-pick:
f80e7a1(81288bd) go vet ./...PASSgo test -short ./...PASS- focused:
TestCanonicalize*/TestClassify*/TestReconcile*/TestReadDocumentContent_Typed*/TestWriteControlledContentErrorPASS - 审查修补后再次
go vet ./...PASS、go test -short ./...PASS - focused:canonical/classify/reconcile/CLI live 门闩/path map/typed content/drift 冲突 PASS
- PG: 本机
TEST_DATABASE_URL未设置;TestReconcile_LegacyRepair_PGskip。已去掉-short无条件跳过,隔离库就绪后即使-short也会跑。禁止 5433/5434/5435 web npm testPASS(tsx 349 + vitest 30;含 controlledContentInvalidation 时序)web npm run buildPASS- follow-up:
*.head.md保存旧 head 正文;已有备份拒绝覆盖;WriteFileAtomicrename/link 后SyncDir - 未执行:
env-service.sh、共享 Docker、data/devapply、真实 UI、隔离 PG apply 验证