Files
osmWorkflow/.trellis/tasks/archive/2026-08/08-04-add-osm-area-preflight/design.md

31 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# OSM area preflight design
## Boundaries
`scripts/lib/area-diagnostics.js` 保持 OSM 解析和预检分类的唯一事实源。新增 `scripts/preflight-area.js` 只负责 CLI 参数、报告和退出码;它不读取产物,也不调起外部工具。现有 `diagnose-area.js``check-area.js` 不复制预检逻辑。
## Data Flow
```text
area config + OSM XML
-> analyzeOsmPreflight()/shared parseOsm()
-> { summary, errors, warnings }
-> preflight-area CLI report + exit code
-> successful preflight.manifest.json
-> diagnose/check manifest freshness reporting
```
预检 manifest 是一次成功验证的记录,不是输入所有权或构建依赖。它记录 config/OSM 文件摘要、错误/警告、统计和耗时;预检失败时不写入,也不删除旧 manifest以保留最后一次成功记录。
## Classification
Blocking error 仅限肯定会使场景几何或范围不可靠的 OSM 结构错误:无效 bounds、任意 way 的缺失 node 引用、破损的建筑 way / building multipolygon。没有 `height` / levels 不是错误(渲染已有默认值);填写但不可解析的显式 `height` 是错误。`building:levels` 的非正值或不可解析值将作为 warning除非现有 Blender 行为表明它会产生错误几何。
## Compatibility
现有 `diagnose:area` 保持全量只读报告;它添加 preflight manifest 一行。`check:area` 仅在 manifest 存在时才要求其有效和 fresh确保现有历史构建仍可通过。新命令的默认配置规则与其他 area CLI 一致。
## Rollback
删除 `preflight:area` CLI、预检 manifest 定义和 diagnostics 展示即可回到当前行为。预检 manifest 是可再生文件,保留或删除均不影响构建。