feat: WEB-01 core Design interpreter over public Analysis 3

Implement the first real Design capability in the unique owner repository:
- src/analysis.rs runs the verified CLI check --emit with direct argv, validates
  Analysis 3 schema/source_digest, and snapshots one module without any implicit
  discovery or Markdown parser.
- src/document.rs selects the exact Knowledge H2 by anchor, direct retained H3
  sections, and the single GFM 组件 table from the analysis AST; cell text is
  read from the analysis-provided source by UTF-8 byte span.
- src/lib.rs binds design links by exact candidate_path + anchor (never label or
  filename guessing), validates rows/slots/widths, recursion, containment cycles
  and module/depth/byte limits, and builds deterministic component definitions,
  separate instances, source identities and a provisional handoff.
- Stable diagnostics separate Engine failures (exit 2) from author-contract
  errors (exit 1); no partial model on failure.
- tests/design_contract.rs exercises the real CLI for recursive layout,
  definition reuse, width forms and the main negative cases; scripts/ci.sh is the
  explicit entry (fmt/clippy/test) with a verified CLI.

Scenarios/input/event/dependency contracts and the full WEB-03 handoff remain
open and are recorded as unverified in the evidence document.

Refs cflmy/marqdo-web-design#1, cflmy/marqdo#6
This commit was merged in pull request #3.
This commit is contained in:
cflmy committed 2026-11-27 02:33:33 +08:00
1 parent 39c99e59d2
commit 75cd26ef89
13 files changed
+1649 -15

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
# WEB-01 Design 核心候选证据(布局 / 源身份 / 诊断)
日期:2026-11-27。责任仓:`marqdo-web-design`;工单:[marqdo-web-design#1](https://git.cflmy.cn/cflmy/marqdo-web-design/issues/1)(WEB-01);父工单:根 [marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6)。
本文件记录 WEB-01 的**核心候选**:Analysis 3 摄入、精确组件引用、递归布局、稳定诊断与源身份。场景/输入/事件/依赖与更完整 handoff 仍属 WEB-01/WEB-03 后续,未在本证据中声明完成。
## 输入身份
| 对象 | 身份 |
| --- | --- |
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e8bcfad3942573e68b5f54b2c5bc2866b37d102f63acd49a55cb212db` |
| 根组合 | `cflmy/marqdo@d4ccb77` |
| 合同 | `marqdo-ext-web` 的 `docs/WEB-DESIGN.md`(只读引用,不复制) |
| 平台 | Linux x86_64(本机验证) |
## 执行
```sh
MARQDO_BIN=<verified marqdo> scripts/ci.sh
# = cargo fmt --check; cargo clippy --all-targets --locked -D warnings; cargo test --locked
```
测试直接启动真实 CLI `check --emit` 生成 Analysis 3(无 mock),临时工程由测试写入。
## 已验证(8 个真实 CLI 契约测试)
- 正例:递归 `组件` 布局(index → nav → leaf、workspace 内容组件)、定义复用但实例独立(`root`/`root/left`/`root/right`)、内容-only 组件、宽度 `auto`/`1fr..12fr`/`120px..1200px`。
- 源身份:每个参与模块的 root-relative path、module id、`source_digest`、Unit path/anchor/UTF-8 span;两次加载的 handoff 逐字节一致。
- 负例(稳定诊断码):缺失/歧义 anchor、H2 非 Knowledge(Exec)、带 `#` 的 unit、表头/列数/非 Link 单元格/非法宽度/重复 slot/行号不连续、目标越界(Analysis 无可用 candidate)、目标 anchor 缺失、包含环、模块/深度/源字节上限、CLI 缺失、ENTRY 越出 root、ENTRY 不存在。
- 引擎失败与作者合同错误区分(`LoadError::Engine`/`Design`),宿主据此映射退出码 2/1;失败不产生部分模型。
- 不使用 `../design` 路径依赖,不复制 Markdown/语言解析器;只消费 Analysis 公开字段。
## 未实现 / 未验证(不隐藏)
- 保留 H3 的 `输入`/`事件`/`依赖`/`验收` 合同模型、`场景`/`交互`(有限状态)解释与校验尚未实现;
- handoff 当前为确定性组件树/来源摘要,WEB-03 的组件图、单组件切片与漂移标识未完成;
- 并发编辑/陈旧 Analysis 的二次一致性复核、资源上限的完整矩阵、symlink/双重编码等安全负例仅覆盖部分;
- 未配置组件 CI 服务(`scripts/ci.sh` 为显式入口,需 CI 传入固定 CLI 制品);领域/根接入(WEB-05)未开始。
因此 WEB-01 不关闭;后续在同一仓库按上述范围继续,不把本候选当作完整验收。