chore(task): archive 08-25-rc-p0-contract-baseline

This commit is contained in:
2026-08-25 16:53:04 +08:00
parent e7bc7f82b1
commit d7c2e13124
26 changed files with 792 additions and 3 deletions

View File

@@ -0,0 +1 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}

View File

@@ -0,0 +1 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}

View File

@@ -0,0 +1,74 @@
# Phase 2 执行计划
## Step 1 — 前置
- [ ] Phase 1 的 AC1.1AC1.8 全绿
- [ ] 定档 §「待决策」四项(仓库名 / 托管 / 分发 / 过渡期策略)
## Step 2 — 拆出仓库(保历史)
```bash
# 方案 Asubtree split
git subtree split --prefix=packages/road-compiler -b road-compiler-export
# 在新目录初始化并拉入该分支
# 方案 Bfilter-repo更彻底推荐
git clone --no-local . /tmp/road-compiler-split
cd /tmp/road-compiler-split
git filter-repo --path packages/road-compiler/ --path-rename packages/road-compiler/:
```
⚠️ 注意Phase 1 的搬迁若用了 `git mv`,历史可 `--follow` 追溯;
若用了删除+新建,`filter-repo` 只能追到 Phase 1。
**Phase 1 搬迁时必须用 `git mv`** —— 这条已在 Phase 1 implement Step 3 隐含,
此处显式记录依赖。
- [ ] 拆出后验证:`git log --follow src/compile/native-road.js | tail -20`
能看到 08-13 native-road-compiler 的提交
## Step 3 — 新仓库自持化
- [ ] `package.json` 补全依赖(含 K4 的 OpenLayers
- [ ] `npm install && npm test` 在新仓库独立通过
- [ ] 基线 JSON 迁入 `test/baseline/`
- [ ] 契约文档迁入 `docs/`
- [ ] README契约摘要 + 与宿主项目关系说明
## Step 4 — 宿主改造
- [ ] `package.json` 依赖指向新仓库(开发期 `file:`
- [ ] `build-area.js` 改子进程调用 + 解析 `NATIVE_ROAD_COMPILE_DONE`
- [ ] `area-config.js``toRoadCompilerInput()` 输出改为 CLI 参数或 input JSON 文件
- [ ] 删除 `packages/road-compiler/`(或按过渡期决策保留)
- [ ] `.trellis/spec/pipeline/` 加契约指针
## Step 5 — 验证
```bash
# 宿主端到端
npm run build:area -- --config config/areas/fengshu-er-road.json
# 三区域 parity
for a in fengshu-er-road hanyang-block nantaizi-lake-innovation-valley; do
node scripts/road-parity.js --config config/areas/$a.json \
--compare .trellis/tasks/08-25-road-compiler-extraction/baseline/$a.json || echo "FAIL $a"
done
# 反向依赖为 0在新仓库内跑
grep -rn "osm2streets-qgis-workflow\|area-config" . --exclude-dir=node_modules --exclude-dir=.git \
&& echo "VIOLATION"
# 锁版本检查
node -e 'const d=require("./package.json").dependencies;console.log(d)' | grep -i road
```
- [ ] 在一台未 clone 宿主的环境(或 `/tmp` 全新 clone验证 AC2.2
## Review Gate
AC2.1AC2.7 全绿。特别是 AC2.2(脱离宿主可自测)—— 这是"独立可维护"的实质。
## Rollback
- 宿主依赖改回 `file:packages/road-compiler`(若过渡期保留了该目录)
-`git revert` 宿主侧改造 commit新仓库留着不影响宿主

View File

@@ -0,0 +1,80 @@
# Phase 2拆仓库
父任务:`.trellis/tasks/08-25-road-compiler-extraction/`
技术设计:父任务 `design.md` §1.3消费方式、§2模块清单
## Goal
`packages/road-compiler/` 拆成保留 git 历史的独立仓库,
宿主改为锁版本依赖 + 子进程调用消费。
## Requirements
### R2.1 保留 git 历史 🔴
-`git subtree split``git filter-repo` 拆出,**不得**用 `cp` + `git init`
- 理由(父任务 R3.21695 行几何逻辑的 blame 是踩坑记录,
丢了以后没人敢改 `compileGeometry` 里任何一行
- 验证:新仓库内 `git log --follow src/compile/native-road.js` 能看到
08-13 native-road-compiler 以来的完整历史
### R2.2 子进程为主契约
- 宿主 `build-area.js` 改为 `execFileSync` 调编译器 CLI
解析 `NATIVE_ROAD_COMPILE_DONE` stdout 标记(父任务 design §1.3
- in-process `require` 可保留为可选优化路径,但不得是唯一路径
- 与既有 QGIS / GDAL / Blender 调用方式一致
(见 `.trellis/spec/pipeline/external-tools.md`
### R2.3 锁版本依赖
- 开发期:`file:` 或 workspace 依赖
- 稳定后git tag / 私有 npm宿主 `package.json` **锁具体版本,不用 `latest`**
- 契约版本 `native-road-package/v1` 与包版本分开演进:
包可以发 patch契约版本只在破坏性变更时升
### R2.4 K4workbench 依赖自持
- `road-workbench` 的 OpenLayers 从新仓库自己的 `node_modules` 提供
- import map 路径相应调整
### R2.5 基线迁移
- Phase 0 的三区域基线 JSON 搬进新仓库当测试语料(父任务 R4 第三条)
- 新仓库 CI/test 能独立跑 parity无需宿主在场
- **同时**宿主保留一份,用于验证升级编译器版本后产物未变
### R2.6 契约文档迁移
- `docs/native-road-package-v1.md` 搬进新仓库
- 宿主 `.trellis/spec/pipeline/` 留指针,说明契约由编译器仓库拥有
## Acceptance Criteria
- [ ] AC2.1 新仓库 `git log --follow` 能追到搬迁前的历史
- [ ] AC2.2 新仓库 `npm test` 在**未 clone 宿主**的机器上通过
- [ ] AC2.3 宿主从锁版本依赖构建,三区域 parity 对基线全绿
- [ ] AC2.4 `build-area.js` 走子进程路径,`NATIVE_ROAD_COMPILE_DONE` 被正确解析
- [ ] AC2.5 宿主 `package.json` 依赖为具体版本,非 `latest` / 非 `*`
- [ ] AC2.6 编译器仓库对宿主反向依赖数为 0父任务 AC8grep 验证)
- [ ] AC2.7 `npm run road:workbench` 在新仓库内独立可跑
## 依赖与顺序
- **前置**Phase 1 完成且 AC1.1AC1.8 全绿
- **阻塞**Phase 3、Phase 4
## 待决策(进入本阶段时定)
| 项 | 选项 |
|---|---|
| 仓库名 | `road-compiler` / `native-road-compiler` / `osm-road-compiler` |
| 托管 | GitHub 私有 / 公开 / 内部 git |
| 分发 | git tag 依赖 / 私有 npm registry |
| 宿主过渡期 | 是否保留 `packages/road-compiler/` 一段时间做双跑对照 |
## Out of Scope
- layer manifestPhase 3
- drawtonomy 扩展Phase 4
- 任何编译器内部逻辑改动 —— 本阶段代码内容不变,只换位置与消费方式

View File

@@ -0,0 +1,26 @@
{
"id": "rc-p2-repo-split",
"name": "rc-p2-repo-split",
"title": "Phase 2拆仓库",
"description": "保留 git 历史拆出独立仓库,宿主以锁版本依赖消费,子进程为主契约",
"status": "planning",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P1",
"creator": "dingkang",
"assignee": "dingkang",
"createdAt": "2026-08-25",
"completedAt": null,
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": "08-25-road-compiler-extraction",
"relatedFiles": [],
"notes": "",
"meta": {}
}