chore(task): archive 09-17-junction-exclusion-routing

This commit is contained in:
que01 committed 2026-09-17 11:15:23 +08:00
1 parent 818d91d8b5
commit 512333375e
11 files changed
+11 -6

No files matched your search

@@ -0,0 +1,2 @@
{"file": ".trellis/spec/backend/junction-layer-seams.md", "reason": "接缝 1 cm 与拒绝契约"}
{"file": ".trellis/tasks/09-17-junction-exclusion-routing/research.md", "reason": "排除区反例与支持矩阵"}
@@ -0,0 +1,15 @@
# Phase 3.4 提交批次(用户已确认)
2026-09-17:用户回复“结束吧”,授权提交并归档本专项。
1. `fix: preserve exclusions in complex junction pavement`
- `src/compile/junction-pavement-region.js`
- `src/compile/complex-junction-surfaces.js`
- `test/junction-pavement-region.js`
- `.trellis/spec/backend/junction-layer-seams.md`
- `.trellis/tasks/09-17-junction-exclusion-routing/`(研究、方案、探针、验收证据)
没有未识别的脏文件;不更新 fixture 快照,不推送远端。
确认后提交、归档本专项并写入会话记录。自动绕障和车辆路径规划不在本批次。
确认要求来源:`.trellis/workflow.md` Phase 3.4 第 5 步,要求一次性展示提交计划并取得确认。
@@ -0,0 +1,23 @@
# 下一实现单元:最终铺装保留排除区
目标:让最终权威铺装满足已知排除区域约束,修复实测 1 m² 孔洞被填平。
在 `junction-pavement-region.js` 的统一装配函数增加可选排除区参数,
默认空数组维持现有调用行为。保留施工空洞填补,再通过 polygon difference
扣除显式排除区;返回 holes、多区域或空集的真实结果。运算异常纳入原有
unsupported 失败路径,不静默回退为填满障碍的面。
`complex-junction-surfaces.js` 从当前 model 传递排除区域,校验最终面与
排除区无正面积交集、必要进口接边没有丢失。单个连通区可带孔洞;为空、
断开或必要接边失败则拒绝发布统一面并输出对应 cluster / exclusion 身份。
拒绝路径保留结构诊断,不能标记这些输入为成功统一铺装。
限定文件:上述两个生产模块、`test/junction-pavement-region.js` 及必要的
最终发布回归(可独立文件并接入 package.json)、规范和任务证据。
不修改轨迹规划、入口重排、车辆扫掠、设施编辑或前端交互。
必须同时验证:无排除区输出不变;施工假孔洞继续填平;显式孔洞保留;
多孔洞/边界相交/完全覆盖/切断区域都有可观察结果;最终发布面的正确性
独立测量,不能只测核心面。接缝专项 1 cm 门槛不放宽。
2026-09-17 用户已确认本方案;实施仅限最终铺装排除区保留。
@@ -0,0 +1,32 @@
# 最终铺装排除区保留:验收证据
2026-09-17。完成已确认的最小修复:不实现自动绕障或车辆路径规划。
此前最终统一铺装在 union 后丢弃所有内环。因此中心 1 m² 已知孔洞虽然
从 `complex-core` 扣除,仍被 `complex-pavement-region` 全部填平。现在先填补
施工输入之间的假孔洞,随后对显式排除区执行 difference;真实孔洞作为最终
MultiPolygon 的内环保留。
最终面必须为一个连通区域,并完整覆盖每个仍有效进口的内外断面。空集、
分裂区域、正面积侵占或必要接边丢失时,不发布统一面。诊断附带 cluster、
排除区域 ID 和丢失车行道键。边界仅接触不算侵占。
验证结果:
- 真实 OSM 四臂中心 1 m² 孔洞,最终铺装交集从 `1.00000000018 m²` 降至 `0 m²`。
- 多孔洞、重叠孔洞、完全覆盖、中心切断、入口阻断及内部缺口均有回归。
- 无排除区的四臂、四臂加 T 组合完整输出与修复前基线逐字一致。
- 铺装、区域 solver、构建反例、岛体位移和 13 场景 / 1,446 接缝回归通过;
TypeScript 检查与变更文件格式检查通过。
- `npm test` 在最后仍因既有 `test/fixtures.js` 快照差异失败;此前所有专项与
Workbench 导入测试通过,未刷新快照。
可复现命令:
```sh
node .trellis/tasks/09-17-junction-exclusion-routing/probe.cjs
node test/junction-pavement-region.js
```
入口重排绕障、多区域车辆可达性、车辆宽度、扫掠包络和最小转弯半径仍未
实现;遇到这些布局时当前版本拒绝统一铺装,不能将面裁切宣称为可驾驶路径。
@@ -0,0 +1,2 @@
{"file": ".trellis/spec/backend/junction-layer-seams.md", "reason": "接缝 1 cm 与拒绝契约"}
{"file": ".trellis/tasks/09-17-junction-exclusion-routing/research.md", "reason": "排除区反例与支持矩阵"}
@@ -0,0 +1,21 @@
# 推进清单
- [x] 保存真实 OSM 孔洞、入口阻断、中心切断与双区域 solver 探针。
- [x] 记录当前支持/拒绝矩阵及最终铺装孔洞丢失的实测面积。
- [x] 确定下一最小实现单元及后续产品决策边界。
- [x] 用户确认最终铺装排除区保留方案,已启动实施。
- [x] 补失败回归,再实现装配后的显式排除与连通/接边检查。
- [x] 验证无排除区兼容性、施工空洞填补、合法孔洞、拒绝路径与诊断身份。
- [x] 运行铺装、区域 solver、构建反例、全图层接缝、岛体位移及 npm test。
- [x] 检查变更文件格式、类型和 git diff;更新规范及证据后走提交归档。
- [x] 按 Phase 3.4 确认提交批次。
- [x] 代码、回归和任务证据提交为 `818d91d`。
- [x] 按用户确认完成专项归档(随归档记录保存本清单)。
## 验证记录(2026-09-17)
- `node test/junction-pavement-region.js` 通过:真实 OSM 的 1 m²、双孔洞和重叠孔洞最终发布面交集均小于 `0.000001 m²`;完全覆盖、切断和入口阻断都拒绝统一面并提供排除区身份。
- `node test/junction-region-solver.js`、`node test/junction-build-plan-counterexamples.js`、`node test/junction-island-offset.js` 和 `node test/junction-layer-seams.js` 通过;接缝为 13 个场景、1,446 处测量。
- `npm run test:client` 与变更文件的 Prettier 检查通过。`npm test` 仅在既有 `test/fixtures.js:18` 快照不匹配处失败;没有刷新该基线。全仓 `npm run format:check` 仍仅报告既有 `src/compile/junction-facility-composition.js` 格式问题。
既有 fixture 快照差异、全仓设施文件格式问题单列,不能通过刷新基线隐藏。
@@ -0,0 +1,35 @@
# 复杂排除区绕行与多通行区求解范围研究
## Goal
承接已归档父任务的区域求解遗留;先确定来源通行关系和安全可行域,不将多边形裁切等同于路径规划。
## Requirements
- 审计来源通行关系、排除区与必要入口连接,区分面裁切、连通区域和车辆绕障路径。
- 比较支持边界、失败诊断与可行方案,明确是否需要车辆尺寸及转弯半径等输入。
- junction-layer-seams 已完成归档;2026-09-17 用户确认实施最终铺装排除区保留,不恢复已归档父任务。
## Acceptance Criteria
- [x] 为接缝被阻断、核心内部障碍和多个隔离通行区提供可重复反例。
- [x] 给出当前求解器的支持/拒绝矩阵和下一实现单元的可观察验收条件。
- [x] 明确需要用户决定的通行语义与安全约束,实施前完成设计和实施计划。
## 已确认的实现单元
最终统一铺装必须保留显式排除区,不得将合法核心孔洞当成施工空洞填平。
无排除区行为不变,施工空洞仍填补;扣除排除区后为空、断开或损坏必要
接边时明确拒绝统一面。以最终发布面交集面积与完整接边验证,不只测核心。
验收:1 m² 孔洞最终铺装交集小于 0.000001 m²;多个合法孔洞保留;
阻断布局明确诊断而非制造连接;无排除区原场景与 1 cm 接缝回归保持通过。
不含自动绕障、入口重排、车辆扫掠或新设施语义;这些另需产品决策。
- [x] 合法孔洞与多个排除区域在最终发布面保留,交集面积 < 0.000001 m²。
- [x] 空集、断开和必要接边受损明确拒绝统一面,诊断保留身份。
- [x] 无排除区输出兼容;施工空洞继续填补;既有接缝回归通过。
## Notes
src/compile/junction-region-solver.js 当前是多边形 difference,不提供绕障路径规划。不能仅凭区域相连推断合法机动车转向。此前“可以直接完成”的估计过于宽泛,本专项先研究边界,不承诺任意障碍布局或车辆扫掠规划。
@@ -0,0 +1,169 @@
{
"cases": [
{
"name": "interior-hole",
"surfaces": [
{
"kind": "complex-core",
"rings": [
2
],
"overlapSquareMeters": 0
},
{
"kind": "complex-pavement-region",
"rings": [
2
],
"overlapSquareMeters": 0
}
],
"approachCount": 8,
"diagnostics": [
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-hole,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-hole,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-hole,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-hole,已省略,避免覆盖已知不可通行空间。"
}
]
},
{
"name": "interior-obstacle",
"surfaces": [
{
"kind": "complex-pavement-region",
"rings": [
1
],
"overlapSquareMeters": 0
}
],
"approachCount": 8,
"diagnostics": [
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-obstacle,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-obstacle,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-obstacle,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 protected-obstacle,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-core-closure-unsupported",
"subjectId": "junction-cluster:exclusion-probe",
"message": "路口中心区域缺少可验证的闭合边(known-exclusion-region),已保留各进口道路面。"
}
]
},
{
"name": "blocked-entry",
"surfaces": [],
"approachCount": 6,
"diagnostics": [
{
"rule": "complex-junction-entry-overlaps-known-region",
"subjectId": "carriageway:cluster:exclusion-probe:carriageway:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward",
"message": "该进口过渡区域侵入已知排除区域,已省略该进口面以保留来源区域。"
},
{
"rule": "complex-junction-entry-overlaps-known-region",
"subjectId": "carriageway:cluster:exclusion-probe:carriageway:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward",
"message": "该进口过渡区域侵入已知排除区域,已省略该进口面以保留来源区域。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 blocked-entry,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-core-closure-unsupported",
"subjectId": "junction-cluster:exclusion-probe",
"message": "路口中心区域缺少可验证的闭合边(known-exclusion-region),已保留各进口道路面。"
},
{
"rule": "complex-junction-pavement-region-required-seam-lost",
"subjectId": "junction-cluster:exclusion-probe",
"message": "统一铺装区域不满足连续通行约束(required-seam-lost),保留结构输入面并拒绝发布统一铺装面。"
}
]
},
{
"name": "split-core",
"surfaces": [],
"approachCount": 6,
"diagnostics": [
{
"rule": "complex-junction-entry-overlaps-known-region",
"subjectId": "carriageway:cluster:exclusion-probe:carriageway:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward",
"message": "该进口过渡区域侵入已知排除区域,已省略该进口面以保留来源区域。"
},
{
"rule": "complex-junction-entry-overlaps-known-region",
"subjectId": "carriageway:cluster:exclusion-probe:carriageway:8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward",
"message": "该进口过渡区域侵入已知排除区域,已省略该进口面以保留来源区域。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 split-core,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512135/segment%3Away%2F851989492%2F1/road%3Away%2F851989492%3Asegment%2F1%3Aforward|8024512147/segment%3Away%2F858770822%2F2/road%3Away%2F858770822%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward",
"message": "该角部道路补面侵入已知排除区域 split-core,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8024512145/segment%3Away%2F858770821%2F2/road%3Away%2F858770821%3Asegment%2F2%3Aforward|8024512147/segment%3Away%2F99505317%2F0/road%3Away%2F99505317%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 split-core,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-corner-exclusion-overlap",
"subjectId": "corner:corner:cluster:exclusion-probe:arm:8005332807/segment%3Away%2F253970456%2F1/road%3Away%2F253970456%3Asegment%2F1%3Aforward|8024512145/segment%3Away%2F851986783%2F2/road%3Away%2F851986783%3Asegment%2F2%3Aforward>cluster:exclusion-probe:arm:8005332807/segment%3Away%2F859509947%2F5/road%3Away%2F859509947%3Asegment%2F5%3Aforward|8024512135/segment%3Away%2F858770823%2F2/road%3Away%2F858770823%3Asegment%2F2%3Aforward",
"message": "该角部道路补面侵入已知排除区域 split-core,已省略,避免覆盖已知不可通行空间。"
},
{
"rule": "complex-junction-core-closure-unsupported",
"subjectId": "junction-cluster:exclusion-probe",
"message": "路口中心区域缺少可验证的闭合边(known-exclusion-region),已保留各进口道路面。"
},
{
"rule": "complex-junction-pavement-region-disconnected",
"subjectId": "junction-cluster:exclusion-probe",
"message": "统一铺装区域不满足连续通行约束(disconnected),保留结构输入面并拒绝发布统一铺装面。"
}
]
}
],
"splitSolver": {
"components": 2,
"assemblyStatus": "disconnected"
}
}
@@ -0,0 +1,55 @@
'use strict';
// Research probe: --expect-bug reproduces the recorded pre-fix behavior.
// Without that flag, verifies the corrected final-pavement contract.
// Run from the repository root: node .trellis/tasks/09-17-junction-exclusion-routing/probe.cjs
const fs = require('fs');
const path = require('path');
const assert = require('assert/strict');
const root = process.cwd();
const { compileRoadModel, compileGeometry } = require(path.join(root, 'src/compile/native-road'));
const { solvePavedRegion } = require(path.join(root, 'src/compile/junction-region-solver'));
const { solveComplexPavementRegion } = require(path.join(root, 'src/compile/junction-pavement-region'));
const clipping = require(path.join(root, 'node_modules/polygon-clipping'));
const model = compileRoadModel(fs.readFileSync(path.join(root, 'inputs/osm/枫树二路.osm'), 'utf8'), { overrides: [] });
const cluster = { id: 'exclusion-probe', template: 'complex-junction-v1', coreRadiusMeters: 21, nodeIds: ['8005332807', '8024512135', '8024512145', '8024512147'] };
const options = { junctionTemplates: { enabled: true, clusters: [cluster] } };
const compile = (exclusionRegions = []) => compileGeometry({ ...model, exclusionRegions }, { overrides: [] }, options);
const base = compile();
const core = base.roadSurface.features.find((f) => f.properties.kind === 'complex-core');
assert.ok(core);
const origin = core.properties.center;
const scale = 111320 * Math.cos(origin[1] * Math.PI / 180);
const xy = (p) => [(p[0] - origin[0]) * scale, (p[1] - origin[1]) * 111320];
const ll = (p) => [origin[0] + p[0] / scale, origin[1] + p[1] / 111320];
const rectangle = (x1, y1, x2, y2) => [[x1, y1], [x2, y1], [x2, y2], [x1, y2], [x1, y1]];
const area = (regions) => regions.reduce((sum, polygon) => sum + polygon.reduce((sum, ring, index) => sum + (index ? -1 : 1) * Math.abs(ring.slice(1).reduce((sum, q, i) => sum + ring[i][0] * q[1] - q[0] * ring[i][1], 0)) / 2, 0), 0);
const regions = (feature) => (feature.geometry.type === 'Polygon' ? [feature.geometry.coordinates] : feature.geometry.coordinates).map((p) => p.map((r) => r.map(xy)));
const hole = rectangle(-0.5, -0.5, 0.5, 0.5).map(ll);
const approach = base.roadSurface.features.find((f) => f.properties.kind === 'complex-approach');
const cases = [
{ name: 'interior-hole', exclusion: { id: 'protected-hole', isHole: true, ring: hole } },
{ name: 'interior-obstacle', exclusion: { id: 'protected-obstacle', ring: hole } },
{ name: 'blocked-entry', exclusion: { id: 'blocked-entry', ring: approach.geometry.coordinates[0] } },
{ name: 'split-core', exclusion: { id: 'split-core', ring: rectangle(-0.5, -100, 0.5, 100).map(ll) } },
];
const results = cases.map(({ name, exclusion }) => {
const geometry = compile([exclusion]);
const surfaces = geometry.roadSurface.features.filter((f) => ['complex-core', 'complex-pavement-region'].includes(f.properties.kind)).map((f) => ({
kind: f.properties.kind,
rings: regions(f).map((p) => p.length),
overlapSquareMeters: area(clipping.intersection(regions(f), [[exclusion.ring.map(xy)]])),
}));
return { name, surfaces, approachCount: geometry.roadSurface.features.filter((f) => f.properties.kind === 'complex-approach').length, diagnostics: geometry.diagnostics.filter((d) => /exclusion|known-region|closure|pavement-region/.test(d.rule)).map(({ rule, subjectId, message }) => ({ rule, subjectId, message })) };
});
const holeResult = results[0];
assert.equal(holeResult.surfaces.find((f) => f.kind === 'complex-core').overlapSquareMeters, 0);
const finalOverlap = holeResult.surfaces.find((f) => f.kind === 'complex-pavement-region').overlapSquareMeters;
if (process.argv.includes('--expect-bug')) assert.ok(finalOverlap > 0.99, 'Expected original hole-filling defect');
else assert.ok(finalOverlap < 0.000001, 'Final pavement must preserve the explicit hole');
const shell = rectangle(-10, -10, 10, 10);
const divided = solvePavedRegion(shell, [rectangle(-1, -11, 1, 11)]);
assert.equal(divided.length, 2);
const assembled = solveComplexPavementRegion(divided.map((p) => p[0]));
assert.equal(assembled.status, 'disconnected');
console.log(JSON.stringify({ cases: results, splitSolver: { components: divided.length, assemblyStatus: assembled.status } }, null, 2));
@@ -0,0 +1,36 @@
# 区域求解边界初审
2026-09-17,只读审计;本专项仍为 planning,不在接缝专项内更换区域算法。
| 场景 | 当前路径 | 限制 |
| --- | --- | --- |
| 入口与排除区域相交 | junction-boundary-graph.js:99 检测相交并标记 overlaps-known-region,设施生成省略入口 | 没有重新布置入口绕障 |
| 核心内部已知安全孔洞 | buildCoreClosure 按 isHole、包含关系、入口避让发布 holes | 只能保证该结构核心面保留孔洞 |
| 障碍穿过核心边界或切断必需接口 | buildCoreClosure 返回 known-exclusion-region | 不重求连通区域 |
| 多个断开的铺装区域 | solveComplexPavementRegion 返回 disconnected | 不生成跨区连接,不等同于多通行区规划 |
需要优先澄清的实现风险:complex-junction-surfaces.js 的 appendPavementRegion 只取各面 coordinates[0];junction-pavement-region.js 又以 polygon[0] 填掉所有合并结果孔洞。因而不能由 buildCoreClosure 的孔洞单测推断最终权威铺装保留已知排除区域。后续应先添加最终发布面的排除区反例,区分构建缝隙与已知孔洞,再考虑绕障。当前未声称运行了该最终反例,也未改产品行为。
建议的实施顺序:最终铺装保留排除区 → 对象级连接/拒绝契约 → 有限障碍布局的区域求解 → 需要来源与车辆约束的路径规划。不能只对凹多边形做裁切后宣称已提供合法车辆绕行。
## 运行复现(2026-09-17)
已运行 `node .trellis/tasks/09-17-junction-exclusion-routing/probe.cjs`,结果保存在
`probe-results.json`。输入为当前真实 OSM 四臂路口,加可控排除区域。
脚本断言当前缺陷仍存在,是研究探针,不得作为修复后的通过回归。
| 反例 | 核心/最终发布结果 | 结论 |
| --- | --- | --- |
| 中心 1 m² 的 isHole 孔洞 | 核心 2 个 ring,交集 0;最终铺装 1 个 ring,交集 1.00000000018 m² | 确认孔洞被填平;有角部避障诊断,但没有最终铺装侵占诊断 |
| 同位置非 isHole 障碍 | 核心 known-exclusion-region 拒绝;此样本最终面交集 0 | 普通障碍与声明安全孔洞走不同路径,不能由本例推断任意障碍安全 |
| 整个入口作为障碍 | 进口从 8 减到 6;核心拒绝,最终面与障碍交集 0 | 省略冲突进口,不自动绕行 |
| 贯穿中心的窄障碍 | 核心拒绝,最终面 disconnected 并不发布 | 维持拒绝;没有跨障碍连接能力 |
| 纯 solver 矩形被障碍切开 | difference 返回 2 区域,铺装装配返回 disconnected | 面裁切可输出多区域,但未提供车辆通行规划 |
下一实现单元应只修复最终铺装的排除区保留:先填补施工产生的假孔洞,
再显式扣除来源排除区。不可简单取消所有填洞,否则会恢复此前修复的
中心铺装空洞;也不能只保留核心 holes,因为过街扫掠和其他补面仍可能
覆盖排除区。若扣除后为空、多区域或损坏必要接边,拒绝统一面并说明原因。
更后续需要产品决定:是否允许重排入口绕障、多区域之间的合法转向关系、
车辆宽度/最小转弯半径/扫掠约束。当前局部修复不依赖这些决策。
@@ -0,0 +1,30 @@
{
"id": "junction-exclusion-routing",
"name": "junction-exclusion-routing",
"title": "复杂排除区绕行与多通行区求解范围研究",
"description": "承接已归档父任务的区域求解遗留;先确定来源通行关系和安全可行域,不将多边形裁切等同于路径规划。",
"status": "completed",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "dingkang",
"assignee": "dingkang",
"createdAt": "2026-09-17",
"completedAt": "2026-09-17",
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": "818d91d",
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [
"src/compile/junction-pavement-region.js",
"src/compile/complex-junction-surfaces.js",
"test/junction-pavement-region.js"
],
"notes": "最终铺装排除区保留已实现并通过专项回归;详情见 evidence.md。自动绕障与车辆路径规划仍明确不在本任务范围。用户已确认 Phase 3.4 提交及归档。",
"meta": {}
}