Files
road-compiler/.trellis/tasks/08-26-direct-edit-documents/prd.md
que01 93f09e399e chore(road-editor): plan direct-edit task tree and add client test infra
Planning: parent design.md becomes the single authoritative contract
(constraint model with 6 kinds, handle manifest, coordinate/unit
layering, preview sequencing, storage layout and lazy migration, area
config snapshot, API contract). Work is split into four independently
verifiable child tasks with per-step gates and rollback points.

Test infra: pin vitest 4.1.11, add test:client:unit for client pure
logic, extend prettier globs to root *.ts so vitest.config.ts is checked.

Add .gitignore: the repo had none, so inputs/, outputs/, workbench-data/
and the client build output were untracked rather than ignored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 17:33:42 +08:00

2.3 KiB
Raw Blame History

直接编辑文档与 revision 基础

父任务:.trellis/tasks/08-26-direct-manipulation-road-editor。需求来源与权威合约在父任务的 prd.md / design.md

目标

建立 native-road-edits/v2 文档、活动工作副本、不可变 revision 与 area config 快照,使后续求解、预览和编辑能力有可复现的持久化基础。本子任务不含任何 UI也不含约束求解。

顺序依赖

无前置。是 direct-edit-solver-apidirect-edit-map-editordirect-edit-junction-tools 三者的前置:它们依赖本任务定义的文档 schema、documentVersion 与快照读取路径。

范围

  • vitest 依赖与 test:client:unit 脚本(后续子任务的验证基础)。
  • native-road-edits/v2 文档读写与 schema 校验6 个约束 kind、4 种锚点、anchorSnapshot、5 态 ConstraintStatusdocumentVersion
  • workbench-data/import-<id>/ 内的 active/revisions/、内容寻址 osm/<sha256>.osm 布局。
  • 既有 import 目录的惰性迁移:首次打开时冻结 rev-0001,不移动或重写既有文件。
  • area-config.snapshot.json 的写入与读取;编译与预览改读快照。
  • 命名检查点创建与 revision 恢复读取。

不做

  • resolveDirectEditConstraints 与任何几何求解(属 direct-edit-solver-api)。
  • 预览、保存、rebase 的 HTTP 端点(属 direct-edit-solver-api)。
  • 任何客户端改动。
  • v1 native-road-overrides.json 的迁移或格式变更。

验收标准

  • vitesttest:client:unit 可跑通空套件,且不影响既有 test / test:client / build
  • v2 文档往返读写无损schema 校验拒绝越界 boundaryIndex、非法 station 与未知 kind。
  • 每次成功写入使 documentVersion 递增 1。
  • 只含旧文件的既有 workbench-data/import-* 目录,在新代码下可正常打开且未被改写,并生成 rev-0001
  • 内容相同的 OSM 重复导入不产生第二份副本。
  • 冻结 revision 后修改外部 area config重新编译该 revision 结果不变。
  • 快照缺失时给出明确错误,不静默回退到读外部配置文件。
  • npm run format:checknpm run testnpm run test:clientnpm run build 全绿。