feat(checker): cph-model — structured export-target build config (WU-B, ADR-0009)

manifest.toml [targets.*] upgraded from bare names to structured build configs.
Lesson.targets: Vec<String> → Vec<TargetConfig> { name, artifact, numbering }.
ArtifactKind { SingleFile, FileTree } mirrors Spec.Courseware.Artifact.
NumberingConfig.heading: Option<Vec<String>> — None means "use framework
default" (render package owns it), so absence is distinguishable from a value.
Empty [targets.x] body = all defaults, no diagnostics. Malformed config (bad
artifact value, non-array numbering.heading) → non-fatal SchemaViolation, target
kept with defaults. Enabled toml `preserve_order` so target declaration order is
real (the old Vec<String> never actually preserved order). target_names() helper
for call sites that only want names. 8 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-22 08:42:15 +08:00
parent 09b026f598
commit b5bf9d60d1
6 changed files with 372 additions and 11 deletions
@@ -0,0 +1,16 @@
[project]
id = "fixture-bad-target-config"
name = "bad-target-config"
[info]
title = "测试课:非法导出目标配置"
# Invalid artifact value → SchemaViolation, falls back to default (single-file).
[targets.student]
artifact = "pdf-thing"
# numbering.heading is not an array of strings → SchemaViolation, heading None.
[targets.teacher]
artifact = "file-tree"
[targets.teacher.numbering]
heading = "not-an-array"
@@ -0,0 +1,19 @@
[project]
id = "fixture-target-configs"
name = "target-configs"
[info]
title = "测试课:导出目标的结构化 build 配置"
# Full config: explicit artifact + numbering.heading override.
[targets.student]
artifact = "single-file"
[targets.student.numbering]
heading = ["{1:一}、", "{1:1}.{2:1}", "{1:1}.{2:1}.{3:1}"]
# file-tree artifact, no presentation override.
[targets.archive]
artifact = "file-tree"
# Empty body → all defaults.
[targets.teacher]