Skip to content

Commit 250df40

Browse files
committed
docs(33): the record's reason key, in both languages
A reader who finds `{"members": 0, "walked": 0, "findings": [], "reason": ...}` has to be told what it means, and told to treat it as "not measured" rather than as a clean result. Four reasons are published; a target that is not Linux publishes no record at all, because the record is ELF-shaped and an empty answer about a format the build never produces is its own confusion.
1 parent 24ce563 commit 250df40

4 files changed

Lines changed: 42 additions & 8 deletions

File tree

‎.agents/docs/2026-09-09-dlopen-surface-and-two-unwinders.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,10 @@ not captured while the failing run was in front of us.
670670

671671
What the failure did expose, by sending us to read the code, is a path that can
672672
produce exactly that reading and should not exist regardless. `check_dlopen_surface`
673-
returned without writing in four cases: not Linux, a non-hermetic binding or
674-
`allow_host_libs`, a plan producing no program, a plan producing no artifact.
675-
Omitting a record makes "did not apply" and "was never run" the same reading,
673+
returned without writing in four cases: a non-hermetic binding, `allow_host_libs`,
674+
a plan producing no program, a plan producing no artifact. (A target that is not
675+
Linux still publishes nothing, and should: the record is ELF-shaped.) Omitting a
676+
record makes "did not apply" and "was never run" the same reading,
676677
which is the failure this repository names most often. And it does more than
677678
omit a sentence, because the two copies of the record have opposite lifetimes:
678679
the sidecar survives an invocation, while `resolution.json` is regenerated from

‎CHANGELOG.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99

1010
### dlopen 面检查:不适用的那一趟也会发布记录,并且不会盖掉已经量出来的答案
1111

12-
`check_dlopen_surface` 有四条提前返回:非 Linux、绑定非 hermetic 或
13-
`allow_host_libs`、本次构建不产出程序、本次构建没有链接产物。它们都直接返回、
14-
什么都不写,于是「没适用」与「没检查过」读成同一个——这正是本仓库记下次数最多的
15-
那种失败,而它出现在一条为消除这种失败而写的检查里。
12+
`check_dlopen_surface` 有多条提前返回:绑定非 hermetic、设置了 `allow_host_libs`、
13+
本次构建不产出程序、本次构建没有链接产物。它们都直接返回、什么都不写,于是「没适用」
14+
与「没检查过」读成同一个——这正是本仓库记下次数最多的那种失败,而它出现在一条为消除
15+
这种失败而写的检查里。(非 Linux 目标仍然不发布记录:这条记录是 ELF 形状的,对一个
16+
本次构建根本不产出的格式给出空答案是另一种混淆。)
1617

1718
它不止是少一句话。记录有两份副本,寿命相反:sidecar 跨调用存活,而
1819
`resolution.json` 由 `prepare_build` 在每次调用开头从空对象重写。后端按「趟」运行,
1920
一次调用可以驱动它不止一次(`mcpp test` 先构建库、再链接测试程序),只链接依赖的
2021
共享库的那一趟没有程序,这个问题本就不归它答——而它同样决定了**文档指定的查看
2122
位置**里最后剩下什么。
2223

23-
现在每条提前返回都发布一条带 `reason` 的记录;并且当同一 key 下已经有一次真实读数
24+
现在这四条提前返回都发布一条带 `reason` 的记录;并且当同一 key 下已经有一次真实读数
2425
时,不适用的那一趟把它**重新发布**,而不是用空白覆盖。key 由契约哈希、SubOS 戳记
2526
与 host-libs 策略构成,不含链接单元,所以同 key 的读数仍然是关于这个 farm 和这个
2627
策略的;key 变了本来就会先清空记录。

‎docs/33-authoring-an-adapter.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ The full result, including both denominators, is published as
120120
failed to build enumerates nothing, and "no findings" would otherwise be
121121
indistinguishable from "nothing was examined".
122122

123+
A build the check does not apply to publishes the same record with a `reason`
124+
and no reading:
125+
126+
```json
127+
{ "members": 0, "walked": 0, "findings": [],
128+
"reason": "this build produces no program; the surface is reached from a process and belongs to whatever runs" }
129+
```
130+
131+
The four reasons are: the runtime binding is not hermetic, `allow_host_libs` is
132+
set, the build produces no program, and the build produced no linked artifact.
133+
A target that is not Linux publishes no record at all, because the record is
134+
ELF-shaped and an empty answer about a format the build never produces would be
135+
its own confusion.
136+
137+
A test that reads this record should treat a `reason` as "not measured" rather
138+
than as a clean result -- "did not apply" and "was never run" are the pair this
139+
record exists to keep apart.
140+
123141
## Current limitations
124142

125143
- **Linux only, by construction.** macOS's dyld and the Windows PE loader have

‎docs/zh/33-authoring-an-adapter.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ on this artifact's search path:
101101
即使没有任何发现,`members` 与 `walked` 也会被发布。一个构建失败的农场枚举出零个成员,
102102
否则「没有发现」与「什么都没检查」就读起来一模一样。
103103

104+
这条检查不适用的构建,发布同一条记录,但只带 `reason`、不带读数:
105+
106+
```json
107+
{ "members": 0, "walked": 0, "findings": [],
108+
"reason": "this build produces no program; the surface is reached from a process and belongs to whatever runs" }
109+
```
110+
111+
四种理由是:运行时绑定非 hermetic;设置了 `allow_host_libs`;本次构建不产出程序;本次构建
112+
没有链接产物。目标不是 Linux 时不发布任何记录 —— 这条记录是 ELF 形状的,对一个本次构建
113+
根本不产出的格式给出「空答案」本身就是另一种混淆。
114+
115+
读这条记录的测试应当把 `reason` 当作「没有测到」而不是「测了,结果干净」—— 「没适用」与
116+
「没检查过」正是这条记录存在的意义所在。
117+
104118
## 当前边界
105119

106120
- **按构造只适用于 Linux。** macOS 的 dyld 与 Windows 的 PE 加载器没有对应的这一层,

0 commit comments

Comments
 (0)