Skip to content

Commit 5aa14a6

Browse files
committed
docs: apply R1 where it actually applies, and correct the measurement that said seven
The design's §1.1 reported testing as a section in seven chapters and concluded that seven chapters explain it. The criterion was a substring search over heading text -- the exact shape this repository's style skill forbids, used in the document that states the rule. Read properly, the seven are: two about mcpp's OWN test suite (a contributor's subject), one that owns the JSON schema, one that owns the `[dev-dependencies]` table, two legitimate mentions inside a tutorial and a workspace section, one heading that says "testing" over a section about path overrides, and one worked example. Exactly ONE is a second explanation of how a test runs: 40-baremetal. So R1 is applied where it applies. 40-baremetal now defers the model to 07 and keeps what is specific to a board -- one image per test file, and semihosting carrying `main`'s return value into the emulator's exit code, which is why the model is identical to a hosted run rather than merely similar. 01 and 06 gain a line naming 07 as the chapter that owns the topic. The conclusion the measurement was drawn for survives: before 07 existed, no chapter answered "how do I test". A topic can be unowned without being duplicated, and that one was. The correction is kept in the design document rather than quietly replaced, because the wrong criterion is more transferable than the right count.
1 parent 6624d00 commit 5aa14a6

4 files changed

Lines changed: 45 additions & 23 deletions

File tree

.agents/docs/2026-09-08-the-documentation-as-a-book.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,37 @@ gives it one.
2424

2525
### 1.1 No topic has an owner
2626

27-
A topic is *owned* by the chapter that carries it as a `##` section. Measured
28-
2026-09-08 across the 24 chapters:
27+
A topic is *owned* by the chapter that carries it as a `##` section.
2928

30-
| topic | chapters carrying it as a section |
31-
|---|---|
32-
| testing (`mcpp test`) | **7** |
33-
| dependency resolution and versions | **7** |
34-
| C++ modules themselves | **7** |
35-
| diagnosis and troubleshooting | 4 |
36-
| caching and incrementality | 4 |
37-
| **what mcpp is — the model** | **0** |
38-
39-
Seven chapters explain testing because seven mechanisms each needed to mention
40-
it. None of them is where a reader goes to learn how to test. The reader who
41-
asks a *task* question — "how do I test", "what happens when two packages want
42-
different versions", "why did this rebuild" — has no chapter to open, and the
43-
seven partial answers do not compose.
29+
The first measurement counted headings whose text contained the topic's name,
30+
and **that criterion was wrong in exactly the way this repository's own style
31+
skill forbids** — a substring search standing in for a question about meaning.
32+
It reported testing as a section in seven chapters. Reading those seven:
33+
34+
| chapter | what its "test" section is actually about | verdict |
35+
|---|---|---|
36+
| `90-build-from-source` ×2 | **mcpp's own** test suite, for a contributor | a different subject |
37+
| `50-machine-output` | the `--message-format json` schema | it owns that |
38+
| `04-dependencies` | the `[dev-dependencies]` table | it owns that |
39+
| `01-getting-started` | one step of a tutorial | legitimate; should link |
40+
| `06-workspace` | the workspace fan-out | legitimate; should link |
41+
| `11-publishing-a-library` | path overrides, under a heading that says "testing" | a naming defect |
42+
| `03-mcpp-toml` | a worked example that happens to have tests | worked examples leave `03` |
43+
| **`40-baremetal`** | **how a test runs, restated** | **the one real duplicate** |
44+
45+
So the corrected reading: **one** duplicated explanation, one misnamed heading,
46+
and a worked example that a separate decision moves anyway.
47+
48+
**The conclusion survives the correction, and it is the part that mattered.**
49+
Before `07` existed, no chapter answered "how do I test" — the seven partial
50+
mentions each assumed a reader who already knew, and none of them was the place
51+
to learn it. A topic can be unowned without being duplicated, and this one was.
52+
53+
The same caution applies to the other rows of the first measurement, which are
54+
kept here as what they are — a count of headings, not of explanations:
55+
dependency resolution 7, C++ modules 7, diagnosis 4, caching 4, and **the model
56+
0**. The last is the one that needs no re-reading: a section that does not exist
57+
cannot be miscounted.
4458

4559
### 1.2 There is no model to hang anything on
4660

docs/40-baremetal.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,13 @@ picolibc present: a cold build links, and `nm` finds one definition.
515515

516516
### Running tests on the target
517517

518-
`mcpp test` builds one image per `tests/*.cpp`, runs each under the emulator
519-
the board-support package supplies, and reads the exit code as the verdict.
520-
Semihosting propagates the firmware's `main` return value to the emulator's
521-
exit code, so the model is identical to a hosted test run.
518+
Testing works here exactly as [07 — Testing](07-testing.md) describes it, and
519+
this section adds only what is specific to a board: each `tests/*.cpp` becomes
520+
its own image, and the runner the board-support package supplies executes it.
521+
522+
What makes the verdict work is semihosting, which propagates the firmware's
523+
`main` return value to the emulator's exit code. That is why the model is
524+
identical to a hosted run rather than merely similar to one.
522525

523526
```bash
524527
mcpp test

docs/zh/01-getting-started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ workspace 中运行。插件稳定依赖进程退出码和生成的 `compile_com
127127

128128
## 增量编译与测试
129129

130+
[07 —— 测试](07-testing.md) 是拥有这个主题的章节;下面只是本教程需要的那一步。
131+
130132
```bash
131133
mcpp build # 增量构建
132134
mcpp clean # 清理 target/

docs/zh/40-baremetal.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,12 @@ C 库经过优化的那份,且没有任何提示。实测(picolibc 在场):冷
450450

451451
### 在目标上运行测试
452452

453-
`mcpp test` 为每个 `tests/*.cpp` 构建一个独立镜像,在板级支持包提供的模拟器里运行,
454-
并以退出码为判据。semihosting 把固件 `main` 的返回值传递到模拟器的退出码,因此其
455-
心智模型与宿主上的测试运行完全一致。
453+
测试在这里的运作方式与 [07 —— 测试](07-testing.md) 所述完全一致,本节只补充板子
454+
特有的部分:每个 `tests/*.cpp` 成为它自己的一个镜像,由板级支持包提供的 runner
455+
执行它。
456+
457+
让判据成立的是 semihosting —— 它把固件 `main` 的返回值传递到模拟器的退出码。这正是
458+
这个模型与宿主上的运行**完全一致**而不只是相似的原因。
456459

457460
```bash
458461
mcpp test

0 commit comments

Comments
 (0)