Files
Agent-System/.doc/ops/short-term/2026-09-14-controlled-content-canonical-hash.md
T
weichenandCursor 08bf615f95 fix(web): keep hydrated content across late list sync
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>
2026-09-14 03:33:37 +00:00

4.7 KiB
Raw Blame History

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 或共享数据库

步骤

  1. cherry-pick 81288bd 诊断文档
  2. 创建本任务并认领 docgov
  3. W1–W6 实现与 focused/门禁测试
  4. 更新 audit/remediation/FEATURE-MATRIX/CURRENT
  5. 原子提交 + handoff
  6. 合入前审查 blockers:00032 / 修订号 / live CLI / HashUpdater 预加载 / 读路径 drift 冲突 / 隔离 PG 状态
  7. follow-up:旧 head 正文备份、备份不可覆盖、原子写目录 fsync;单提交后 done
  8. 终审 3 项:live 正向确认 :5433+agent_system_dev+data/dev;备份三件套+唯一目录/O_EXCL+全路径;rename 后目录 Sync 兼容处理
  9. UI clean run:doc-001 等本地 legacy 不发 content/revision;hydrate 资格对齐 toolbar server-backed
  10. 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_PG skip,记为 blocker,未用 5433 业务库代替

相关链接

证据 / 备注

  • cherry-pick: f80e7a1 (81288bd)
  • go vet ./... PASS
  • go test -short ./... PASS
  • focused: TestCanonicalize* / TestClassify* / TestReconcile* / TestReadDocumentContent_Typed* / TestWriteControlledContentError PASS
  • 审查修补后再次 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_PG skip。已去掉 -short 无条件跳过,隔离库就绪后即使 -short 也会跑。禁止 5433/5434/5435
  • web npm test PASS(tsx 349 + vitest 30;含 controlledContentInvalidation 时序)
  • web npm run build PASS
  • follow-up:*.head.md 保存旧 head 正文;已有备份拒绝覆盖;WriteFileAtomic rename/link 后 SyncDir
  • 未执行:env-service.sh、共享 Docker、data/dev apply、真实 UI、隔离 PG apply 验证