Spec母本噪音清理 + 一处 spec↔impl 对齐 + 一处契约自洽修正。 Part A — spec doc 瘦身:每条 doc 收到"语义点 + 标签 + ADR ref + 承载性 why", 把跨文件复读的方法论(element-kind 开放性对比、likec4 画不出、分歧点测试)上移到 module header。OPEN 框架保持清晰(RunState/Capability 完整性仍明示须 surface)。 Part B — Courseware/ 由 10 文件平铺重组为 Model/ Export/ Check/ Open/ 四子命名空间 (namespace Spec.Courseware 不变,零引用改动)+ 四个子 aggregator。lake build 绿(24 jobs)。 Part C — 渲染覆盖落为数据(ADR-0011 对齐):去掉 cph-check 里硬编码的 COVERED_TARGETS,改读 TargetConfig.covers。cph-model 新增 covers: Option<Vec<String>> (None=未声明,由 cph-check 默认为全部 known kinds;显式 [] 表示不覆盖任何 kind)。 新增 3 个覆盖行为测试。 ADR-0012 — DanglingReference 退役(诊断 7→6 类):其两种情形(未解析 @ref、越界/缺失 相对 import)都是 typst 编译期失败,归 typstCompile。同步移除 Oracle.refsResolve (被 compiles 蕴含),Legal 少一个合取项。impl 删去从未被发射的 DiagCode::DanglingReference, 闭合 named-but-unemitted 的 spec↔impl 缝。ADR-0010 加修订指针。 OPEN 点(RunState/Capability 完整性、QuestionBank、Course)按既定纪律保持 OPEN,本次 只改善其框架措辞,不决策。 验证:spec lake build 绿;cargo test 全绿(含新增覆盖测试);clippy 静默; TH-141 check 0 errors/0 warnings 无回归。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
crates/
These crates implement the rule-based lesson checker that aligns to the
semantic master in spec/: it reads an engineering-file (one lesson, ADR-0005)
laid out per ADR-0008 (declarative manifest.toml + per-element
element.toml), validates structure and content, and emits diagnostics.
cph-diag (the shared diagnostic vocabulary), cph-model (the ADR-0008 loader),
and cph-typst (the typst World / compile / span-mapping layer) are
deliberately reusable by future components such as an exporter, which is why
they live in this repo-wide crates/ directory rather than under any single
component; cph-schema (kind JSON Schemas + validation), cph-check
(orchestration + render-coverage) and cph-cli (the cph command-line
entrypoint) are the checker proper.
Crate map
| crate | owner | role |
|---|---|---|
cph-diag |
WU-1 | shared diagnostic vocabulary (Severity, DiagCode, Diagnostic, SourceSpan) — reusable |
cph-model |
WU-1 | parses the ADR-0008 layout into an in-memory ordered Lesson — reusable |
cph-schema |
WU-3 | the 4 stdlib kind JSON Schemas + structural validation |
cph-typst |
WU-4 | typst World, driver generation, compile, PDF, span mapping — reusable |
cph-check |
WU-5 | orchestration: render-coverage and the full check pipeline |
cph-cli |
WU-5 | the cph command-line entrypoint |
Build
# from the repository root (the cargo workspace root)
cargo build # all crates
cargo test # cph-diag + cph-model unit/integration tests
cargo clippy --all-targets -- -D warnings
cargo fmt --check