Files
road-compiler/.trellis/tasks/08-26-direct-edit-junction-tools/design.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

1.8 KiB
Raw Permalink Blame History

设计

技术合约不在本文重复定义。权威定义见父任务 .trellis/tasks/08-26-direct-manipulation-road-editor/design.md 的以下小节:

  • 「约束模型」— junction-approach-widthjunction-cutbackjunction-corner-radius 三个 kind 与其锚点。
  • 「编辑所有权」— junction reserve 独占、junction-approach-width 优先于道路 profile、单 JunctionRef 会话。
  • 「Handle manifest」— 手柄字段与 reserves
  • 「预览时序与延迟预算」— 防抖、previewSeq 仲裁、degraded
  • 「上线与回滚形态」— directEdit 开关。

会话状态、四态语义与所有权边界的完整推导见父任务 research/junction-tools.md

本子任务的局部决定

  • 工作区是独立路由,不是主地图上的浮层面板:路口编辑是高密度局部操作,叠在主地图上会与道路手柄争夺命中区。
  • 复用 direct-edit-map-editorEditSession、ghost/preview source 与命令栈,不新建第二套编辑基础设施。差异只在加载的上下文范围与可用 kind。
  • 草稿属于活动工作副本的 session不是独立导出文件。因此「取消」只需丢弃 session不涉及文件回滚。
  • 「应用到工作区」不写盘:合并后的约束是活动副本的未保存状态,交给主地图的普通 undo/redo 管理。这样保存路径只有一条。
  • 会话互斥用显式守卫实现:存在未处理草稿时切换 JunctionRef 直接拒绝并提示,不做自动应用或自动丢弃——两者都会让用户丢失意图。
  • 本期只实现 JunctionRef.type === 'node'cluster 分支保留类型但入口置灰,避免把 cluster 降级成多个互相冲突的普通路口编辑。
  • 单个角部圆角:本期只允许编辑一个 corner多角部批量编辑属后续任务。