dsh-trajectory-traceview-plus 0.11.6 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.8 — 探针凭证与解耦(2026-11-28)
4
+
5
+ **运行时(`src/`、`lib/`)与 0.11.7 逐字节相同**,这一版改的是"怎么证明它没问题"。
6
+
7
+ - **"探针通过了"不能再是关于一段已经不存在的代码。** 浏览器探针跑不进 CI(需要真 Chrome),
8
+ 这一周因此出了两次事故:一次是探针撞 30 秒上限、返回"无法解析"被读成工具故障而不是红断言,
9
+ 一次是 `src/` 在探针跑过之后继续改动而无人提示。现在 `browser-check.mjs` 在 PASS 时写
10
+ `test/browser/probe-receipt.json`(源码摘要 + 组数 + 时间),`probe-receipt-check.mjs`
11
+ 重算摘要并对比,进了 `npm run check`(第 11 步)和 CI。**它证明探针在这个 src/ 上通过过,
12
+ 不证明它现在还会通过,也不证明有人看过结果**——是补一个缺失的信号,不是测试的替代品。
13
+ 局限写进 `DESIGN §13.69.9`。
14
+ - **探针各段不再靠"上一段留下的状态"启动。** `window.__detailBase` 那种交接不是声明过的契约,
15
+ 而是"上一个文件在 store 里留下的任何东西";某个组改了 store 又忘了还原,后面几段的起点就被
16
+ 悄悄挪走。现在 `__h.reset()` / `__h.seed()` 每次重新构造种子快照。
17
+ 验证方式是**单独 eval `probe-detail3.js`(前面一段都不跑)仍返回 `failures: []`**——
18
+ 解耦前做不到这件事。
19
+
20
+ 流程变化:改过 `src/` 就必须先跑探针,否则 `npm run check` 会红(只改文档/测试/脚本不受影响)。
21
+
22
+ ## 0.11.7 — 0.11.6 之后的检查(2026-11-28)
23
+
24
+ - **导出的表头少了「工具总耗时」。** 屏幕上的 KPI 条有五项:轮次 / 步骤 / 工具 / 出错步骤 /
25
+ 工具总耗时。导出的首行只抄了四项——你看着「900 ms 工具总耗时」,把导出粘进 issue,
26
+ 恰好丢的就是这个数。现在首行与屏幕逐项对齐。断言 `EXPORTKPI1` 与探针 23n
27
+ (23n 是把屏幕数字和导出数字真的比一遍,不是查字面);变异(删掉那一项)→ 两处同时红。
28
+ - **探针第三次拆分。** `probe-detail2.js` 已经涨到 37 秒,超过 `agent-browser eval` 的 30 秒上限;
29
+ 变异验证时它直接报「无法解析」而不是红断言——那等于没有验证。现在 `probe-detail3.js`
30
+ 单独承载 0.11.6 之后新增的 7 组。拆分时还撞到一个真问题:两个探针文件都在**顶层**写
31
+ `const healthySnap = …`,它落在页面全局作用域上,第二个文件一 eval 就
32
+ `Identifier 'healthySnap' has already been declared`。两边都改成 IIFE 内声明。
33
+ - **模型正在生成的那一步,被排到了本轮第一步的前面。** 流式 partial 的时间戳是
34
+ `轮次最早 seq + 0.5`,所以当本轮已经有步骤 1、2 时,进行中的步骤 3 排到了步骤 1 **之前**:
35
+ 实测顺序 `用户 → 步骤3(运行中) → 步骤1 → 步骤2`。正在跑的那张卡出现在已完成工作左边,
36
+ 时间顺序读起来是错的。现在取本轮**最大** seq + 0.5(`用户 → 步骤1 → 步骤2 → 步骤3`)。
37
+ 断言 `PARTIALORDER1`(含"第一步的 partial 仍要跟在用户消息后"这一反向用例);
38
+ 变异(退回 `轮次最早 + 0.5`)→ 红。
39
+
3
40
  ## 0.11.6 — 全维度审查后的修复(2026-11-28)
4
41
 
5
42
  四个只读审查(两个 Codex worker + 本项目自己的 subagent)在 0.11.5 上报了可复现的问题。
package/README.en.md CHANGED
@@ -123,7 +123,7 @@ dsh-trajectory-traceview-plus/ # repo root (directory name == npm package name
123
123
  ├── docs/ # DESIGN.md (why each change) / PROVENANCE.md (generated)
124
124
  ├── test/
125
125
  │ ├── smoke.test.cjs # helper unit tests (plain node)
126
- │ └── browser/ # fixture.js (host stub) / probe.js + probe-detail.js (interaction / state)
126
+ │ └── browser/ # fixture.js (host stub) / probe*.js in 4 parts + probe-en.js (English chrome)
127
127
  │ # probe-en.js (English UI)
128
128
  │ # harness.html is generated by browser-harness.mjs and not committed
129
129
  └── lib/
@@ -136,7 +136,7 @@ dsh-trajectory-traceview-plus/ # repo root (directory name == npm package name
136
136
  Install from npm (recommended — **pin the exact version**):
137
137
 
138
138
  ```powershell
139
- dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.6
139
+ dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.8
140
140
  ```
141
141
 
142
142
  > **Why not `@latest`**: `dsh plugin` forwards to pnpm, and **pnpm 12 ships a supply-chain delay** (`minimumReleaseAge`, default **1440 minutes = 24 hours**): a version published less than a day ago is not selected by `@latest`, and pnpm **silently falls back to the previous release** — no warning at all. Right after 0.11.0 was published, `pnpm add pkg@latest` installed 0.10.0, which the newer DSH hosts skip entirely. An exact version has no such ambiguity (verified with both cold and warm caches).
@@ -148,10 +148,10 @@ dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.6
148
148
  Install from GitHub (**always pin the tag**):
149
149
 
150
150
  ```powershell
151
- dsh plugin --profile web add "github:MisonL/dsh-trajectory-traceview-plus#v0.11.6"
151
+ dsh plugin --profile web add "github:MisonL/dsh-trajectory-traceview-plus#v0.11.8"
152
152
  ```
153
153
 
154
- > **Why the `#v0.11.6` matters**: a `github:` spec without a ref installs the **default branch HEAD**, not any released version. This repository keeps committing after a release (v0.11.0 was followed by five docs/scripts commits), so an unpinned install can hand you different code tomorrow while still reporting version 0.11.0. Pinning the tag is what makes "installed" and "released" the same code.
154
+ > **Why the `#v0.11.8` matters**: a `github:` spec without a ref installs the **default branch HEAD**, not any released version. This repository keeps committing after a release (v0.11.0 was followed by five docs/scripts commits), so an unpinned install can hand you different code tomorrow while still reporting version 0.11.0. Pinning the tag is what makes "installed" and "released" the same code.
155
155
 
156
156
  Then **restart `dsh web`** to take effect.
157
157
 
@@ -258,8 +258,8 @@ node scripts/provenance.mjs
258
258
  Editing `src/` without rebuilding makes `--check` fail and the smoke suite report `BUILD1`. `lib/index.js` (host half) is a no-op stub; `lib/client.js` is a classic script (`window.__ModuleLoader__.load`) served directly by the client module system.
259
259
 
260
260
  ```powershell
261
- npm run check # 10 steps: build --check / provenance --check / version-check / doc-ref-check
262
- # doc-heading-check / smoke / readme-numbers / shortcut-check / harness-stamp / path-leak-check
261
+ npm run check # 11 steps: build --check / provenance --check / version-check / doc-ref-check
262
+ # doc-heading-check / smoke / readme-numbers / shortcut-check / harness-stamp / path-leak-check / probe-receipt-check
263
263
  npm test # smoke only
264
264
  ```
265
265
 
@@ -268,8 +268,8 @@ The tests run the helper region against mock snapshots covering: tree building /
268
268
  **What needs a real browser** (`react-dom/server` cannot see scroll, focus, clipboard, intervals or layout):
269
269
 
270
270
  ```powershell
271
- node scripts/browser-check.mjs # builds the harness; 310 assertions over 47 recorded groups
272
- node scripts/browser-check.mjs --shots # saves screenshots and adds 1 more group / 3 assertions: 375px overflow (48 total)
271
+ node scripts/browser-check.mjs # builds the harness; 314 assertions over 48 recorded groups
272
+ node scripts/browser-check.mjs --shots # saves screenshots and adds 1 more group / 3 assertions: 375px overflow (49 total)
273
273
  ```
274
274
 
275
275
  It needs `agent-browser` (Chrome via CDP). **Deliberately not in CI**: adding a browser to the runner is more moving parts than the check is worth, and a flaky browser job trains people to ignore red builds. Run it locally before releasing.
@@ -328,17 +328,27 @@ Substantive changes versus upstream: stable anchors and deep-link parsing, orpha
328
328
  ```bash
329
329
  # 1-3 edit files: package.json version, CHANGELOG.md entry
330
330
  node scripts/provenance.mjs # 4. refresh the provenance list (rerun after any add/rename)
331
- npm run check # 5. the 7 local gates; all green before going further
331
+ node scripts/browser-check.mjs # 4.5 run the real browser probe (needs Chrome); writes a receipt
332
+ npm run check # 5. the 11 local gates; all green before going further
332
333
  git add -A; git commit -m "..." # 6.
333
334
  git push origin main # 7.
334
- git tag -a v0.11.6 -m "..." # 8.
335
- git push origin v0.11.6 # 9.
335
+ git tag -a v0.11.8 -m "..." # 8.
336
+ git push origin v0.11.8 # 9.
336
337
  npm publish # 10. runs prepublishOnly -> the whole check again
337
- gh release create v0.11.6 --notes-file … # 11. the badge reads the Release, not the tag
338
+ gh release create v0.11.8 --notes-file … # 11. the badge reads the Release, not the tag
338
339
 
339
340
  node scripts/release-status.mjs # 12. do all four agree? (tag / Release / npm metadata / tarball)
340
341
  ```
341
342
 
343
+ **Touch `src/` and you must rerun step 4.5**, or the receipt gate goes red:
344
+ `probe-receipt-check` compares the source digest inside `test/browser/probe-receipt.json`
345
+ against the current `src/` and fails with `STALE — src/ changed after the probe last
346
+ passed`. The reason is concrete: the browser probe cannot run in CI (it needs a real
347
+ Chrome), so "the probe passed" is one step away from being a claim about code that no
348
+ longer exists. It proves the probe passed **once, against this exact src/**; it does not
349
+ prove the probe would pass now, and it does not prove anyone read the result. It fills a
350
+ missing signal; it is not a substitute for a test.
351
+
342
352
  **Step 10 is the easiest to miss and it fails silently.** After `git push` and `git tag` the repo looks "released" — but the registry still serves the old version, so `npm i <name>@latest` hands people the old package. That happened here once: tag and Release both present, npm still on the previous release (§13.47).
343
353
 
344
354
  **Step 11 is not ceremony**: the version badge at the top of the page reads the GitHub **Release**, not the tag. Tagging without creating a Release makes the badge show a red `no releases`, which reads as an abandoned repo (§13.45).
@@ -349,6 +359,6 @@ Three things guard the release, and all live in CI (`.github/workflows/check.yml
349
359
  - version / tag disagreement — `node scripts/version-check.mjs` fails (`F1`)
350
360
  - a missing `CHANGELOG.md` entry for the version (`F2`), or a version that goes backwards relative to an existing tag (`F3`)
351
361
 
352
- CI runs those 9 gates plus an install step (`npm ci --include=dev`): `build-client --check`, `node --check lib/client.js`, `provenance --check`, `version-check`, `doc-ref-check`, `doc-heading-check`, smoke, readme-numbers, shortcut-check, harness-stamp. `npm run check` runs 10 of them locally (build, provenance, version-check, doc-ref-check, doc-heading-check, smoke, readme-numbers, shortcut-check, harness-stamp, path-leak-check) — everything but `node --check lib/client.js`; run `browser-check` too before releasing — see §11.
362
+ CI runs those 10 gates plus an install step (`npm ci --include=dev`): `build-client --check`, `node --check lib/client.js`, `provenance --check`, `version-check`, `doc-ref-check`, `doc-heading-check`, smoke, readme-numbers, shortcut-check, harness-stamp, probe-receipt-check. `npm run check` runs 11 of them locally (build, provenance, version-check, doc-ref-check, doc-heading-check, smoke, readme-numbers, shortcut-check, harness-stamp, path-leak-check, probe-receipt-check) — everything but `node --check lib/client.js`; run `browser-check` too before releasing — see §11.
353
363
 
354
364
  **Those numbers have a gate of their own**: `readme-numbers` derives the true values from `check.yml`, `package.json` and `test/browser/probe.js`, then checks both READMEs against them. A number written down twice will eventually disagree with itself (§13.37).
package/README.md CHANGED
@@ -109,7 +109,7 @@ dsh-trajectory-traceview-plus/ # 仓库根(目录名 = npm 包名)
109
109
  ├── CHANGELOG.md # 发布记录(version-check 会核对版本条目)
110
110
  ├── screenshot/ # 效果截图(README「效果预览」用)
111
111
  ├── .github/workflows/
112
- │ └── check.yml # CI:9 项门禁(本地命令的同序复现)
112
+ │ └── check.yml # CI:10 项门禁(本地命令的同序复现)
113
113
  ├── src/ # 浏览器端源码(lib/client.js 由它生成,不要手改产物)
114
114
  ├── scripts/
115
115
  │ ├── build-client.mjs # src/ -> lib/client.js
@@ -126,7 +126,7 @@ dsh-trajectory-traceview-plus/ # 仓库根(目录名 = npm 包名)
126
126
  ├── docs/ # DESIGN.md(每处改动的原因)/ PROVENANCE.md(自动生成)
127
127
  ├── test/
128
128
  │ ├── smoke.test.cjs # 纯 helpers 单测(node 直接跑)
129
- │ └── browser/ # fixture.js(宿主桩)/ probe.js + probe-detail.js(交互 / 状态)
129
+ │ └── browser/ # fixture.js(宿主桩)/ probe*.js 共 4 段 + probe-en.js(英文界面)
130
130
  │ # probe-en.js(英文界面)
131
131
  │ # harness.html 由 browser-harness.mjs 生成,不入库
132
132
  └── lib/
@@ -139,7 +139,7 @@ dsh-trajectory-traceview-plus/ # 仓库根(目录名 = npm 包名)
139
139
  从 npm 安装(推荐,**写死版本号**):
140
140
 
141
141
  ```powershell
142
- dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.6
142
+ dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.8
143
143
  ```
144
144
 
145
145
  > **为什么不用 `@latest`**:`dsh plugin` 底层是 pnpm,而 **pnpm 12 有供应链延迟保护**
@@ -160,10 +160,10 @@ dsh plugin --profile web add dsh-trajectory-traceview-plus@0.11.6
160
160
  从 GitHub 安装(**必须带 tag**):
161
161
 
162
162
  ```powershell
163
- dsh plugin --profile web add "github:MisonL/dsh-trajectory-traceview-plus#v0.11.6"
163
+ dsh plugin --profile web add "github:MisonL/dsh-trajectory-traceview-plus#v0.11.8"
164
164
  ```
165
165
 
166
- > **为什么必须带 `#v0.11.6`**:`github:` 规格不带 ref 时装的是**默认分支的 HEAD**,
166
+ > **为什么必须带 `#v0.11.8`**:`github:` 规格不带 ref 时装的是**默认分支的 HEAD**,
167
167
  > 不是任何发布版本。而这个仓库在发版后还会继续提交(本轮 v0.11.0 之后就有 5 个
168
168
  > 文档/脚本提交),所以"不带 ref"装到的东西**明天可能是另一个样子**,而版本号
169
169
  > 仍写着 0.11.0。带 tag 才能让"装到的"和"发布过的"是同一份代码。
@@ -276,8 +276,8 @@ node scripts/provenance.mjs
276
276
  改了 `src/`却忘了重建时,`--check`会失败,`test/smoke.test.cjs`也会报 `BUILD1`。`lib/index.js`(宿主半部)是无操作桩;`lib/client.js`是经典脚本(`window.__ModuleLoader__.load`),由客户端模块系统直接服务。
277
277
 
278
278
  ```powershell
279
- npm run check # 10 步:build --check / provenance --check / version-check / doc-ref-check
280
- # doc-heading-check / smoke / readme-numbers / shortcut-check / harness-stamp / path-leak-check
279
+ npm run check # 11 步:build --check / provenance --check / version-check / doc-ref-check
280
+ # doc-heading-check / smoke / readme-numbers / shortcut-check / harness-stamp / path-leak-check / probe-receipt-check
281
281
  npm test # 只跑 smoke
282
282
  ```
283
283
 
@@ -286,8 +286,8 @@ npm test # 只跑 smoke
286
286
  **需要真实浏览器的部分**(`react-dom/server` 测不到滚动、焦点、剪贴板、定时器、响应式):
287
287
 
288
288
  ```powershell
289
- node scripts/browser-check.mjs # 起 harness,跑 310 条断言 / 记录 47 组观测
290
- node scripts/browser-check.mjs --shots # 另存截图,并另加 1 组 / 3 条断言(375px 溢出,共 48 组)
289
+ node scripts/browser-check.mjs # 起 harness,跑 314 条断言 / 记录 48 组观测
290
+ node scripts/browser-check.mjs --shots # 另存截图,并另加 1 组 / 3 条断言(375px 溢出,共 49 组)
291
291
  ```
292
292
 
293
293
  它需要 `agent-browser`(Chrome via CDP)。**故意不进 CI**:把浏览器塞进 runner 的
@@ -353,17 +353,25 @@ MIT。原版 © [AFAP](https://github.com/AFAP/dsh-trajectory-traceview);本
353
353
  # 1-3 改内容
354
354
  # 改 package.json 的 version、补 CHANGELOG.md 的版本条目
355
355
  node scripts/provenance.mjs # 4. 刷新来源清单(新增/改名文件后必须重跑)
356
- npm run check # 5. 10 步门禁,全绿再往下
356
+ node scripts/browser-check.mjs # 4.5 跑真正的浏览器探针(需要 Chrome),并写下凭证
357
+ npm run check # 5. 11 步门禁,全绿再往下(含凭证校验)
357
358
  git add -A; git commit -m "..." # 6.
358
359
  git push origin main # 7.
359
- git tag -a v0.11.6 -m "..." # 8.
360
- git push origin v0.11.6 # 9.
360
+ git tag -a v0.11.8 -m "..." # 8.
361
+ git push origin v0.11.8 # 9.
361
362
  npm publish # 10. 触发 prepublishOnly → 再跑一遍 check
362
- gh release create v0.11.6 --notes-file … # 11. 徽章读的是 Release,不是 tag
363
+ gh release create v0.11.8 --notes-file … # 11. 徽章读的是 Release,不是 tag
363
364
 
364
365
  node scripts/release-status.mjs # 12. 四处对齐了吗?(tag / Release / npm 元数据 / tarball)
365
366
  ```
366
367
 
368
+ **改过 `src/` 就必须重跑步骤 4.5**,否则步骤 5 会红:`probe-receipt-check` 拿
369
+ `test/browser/probe-receipt.json` 里的源码摘要和当前 `src/` 对比,不一致就报
370
+ `STALE — src/ changed after the probe last passed`。这条守卫存在的原因很具体:浏览器探针
371
+ 跑不进 CI(需要真 Chrome),于是"探针通过了"很容易变成一句关于**已经不存在的代码**的话。
372
+ 它只证明"某个 src/ 摘要确切等于当前的树、探针在那上面通过过一次",**不证明探针现在还会通过**,
373
+ 也不证明有人看过结果——是补上一个缺失的信号,不是测试的替代品。
374
+
367
375
  **第 10 步最容易漏,而且不会有任何报错**:`git push` + `git tag` 之后仓库看起来"发布完了",但 registry 上还是旧版本。任何人 `npm i <包名>@latest` 拿到的都是旧包。这个仓就发生过一次——tag 和 Release 都在,npm 还停在上一版(§13.47)。
368
376
 
369
377
  **第 11 步不是仪式**:页面顶部的版本徽章读的是 GitHub **Release**,不是 tag。只打 tag 不建 Release 时徽章会显示红色的 `no releases`——看起来像这个仓已经废弃(§13.45)。
@@ -376,12 +384,12 @@ node scripts/release-status.mjs # 12. 四处对齐了吗?(tag / Rel
376
384
  - 版本号相对已有 tag 倒退 → 同上(`F3`)
377
385
 
378
386
  这些检查都在 CI 里跑(`.github/workflows/check.yml`),push 到 main 和提 PR 时自动执行。
379
- 门禁本身是 9 项:`build-client --check`、`node --check lib/client.js`、`provenance --check`、
380
- `version-check`、`doc-ref-check`、`doc-heading-check`、smoke、readme-numbers、shortcut-check
387
+ 门禁本身是 10 项:`build-client --check`、`node --check lib/client.js`、`provenance --check`、
388
+ `version-check`、`doc-ref-check`、`doc-heading-check`、smoke、readme-numbers、shortcut-check、probe-receipt-check
381
389
  (前面还有一步 `npm ci --include=dev` 装依赖)。
382
390
 
383
- 本地 `npm run check` 跑其中 10 步(`build-client --check`、`provenance --check`、`version-check`、
384
- `doc-ref-check`、`doc-heading-check`、smoke、readme-numbers、shortcut-check、harness-stamp、path-leak-check)
391
+ 本地 `npm run check` 跑其中 11 步(`build-client --check`、`provenance --check`、`version-check`、
392
+ `doc-ref-check`、`doc-heading-check`、smoke、readme-numbers、shortcut-check、harness-stamp、path-leak-check、probe-receipt-check)
385
393
  ——只差 CI 里的 `node --check lib/client.js`,够用于日常提交;发布前再按 §11 把 `browser-check`
386
394
  也跑一遍。其中 `harness-stamp` 确认手工打开 `harness.html` 前它没有内联旧 bundle,
387
395
  `path-leak-check` 确认随包发布的文件里没有本机绝对路径。
package/docs/DESIGN.md CHANGED
@@ -9701,6 +9701,61 @@ panel text: Trace ViewUserStepToolCompactionerror⏮⇤◀…
9701
9701
  3. 扫 UI 文案必须区分 **chrome 与 data**。站点标签里嵌着会话原文,那不是缺陷。
9702
9702
 
9703
9703
 
9704
+ ### 13.69.9 探针跑不进 CI,于是"探针通过了"可以是关于一段不再存在的代码
9705
+
9706
+ 浏览器探针(48 组 / 314 条断言)跑不进 CI,这是**有意的**:`.github/workflows/check.yml`
9707
+ 末尾写着理由——需要真 Chrome over CDP,而一个时红时绿的浏览器 job 会训练人忽略红构建。
9708
+
9709
+ 代价在 2026-11-28 这一周具体地暴露了两次:
9710
+
9711
+ 1. `probe-detail2.js` 涨到 37 秒,超过 `agent-browser eval` 的 30 秒上限。做变异验证时它返回
9712
+ `did not return a parsable result`——**读起来像工具出了问题,而不是断言失败**,于是那轮
9713
+ "变异验证"看起来是通过的。实际上它什么都没验证。
9714
+ 2. `src/` 在探针跑过之后继续改动,没有任何地方提示。提交说明里写着"探针全绿",
9715
+ 而那句话描述的是更早的树。
9716
+
9717
+ 两个事故的共同点是:**证据和它声称描述的对象脱钩了**,而从 CI 的角度看一切正常。
9718
+
9719
+ 修法不是把 Chrome 塞进 CI(那会制造上面说的时红时绿),而是让 `browser-check.mjs`
9720
+ 在 PASS 时写一份凭证 `test/browser/probe-receipt.json`:
9721
+
9722
+ ```json
9723
+ { "src_digest": "72f730910b0ee5aa…", "groups": 48, "ran_at": "2026-11-28T14:24:47.345Z" }
9724
+ ```
9725
+
9726
+ `probe-receipt-check.mjs` 重算 `src/*.js` 的摘要并对比,不一致就红,并直接告诉你该跑哪条命令。
9727
+ 它进了 `npm run check`(第 11 步)和 CI,所以 `prepublishOnly` 也覆盖到了。
9728
+
9729
+ **它证明什么、不证明什么**(写在这里,因为这类守卫最容易变成"有它就安心"):
9730
+
9731
+ - 证明:探针在某个 src/ 摘要上通过过,而那个摘要与当前的树相同。
9732
+ - 不证明:探针现在还会通过(只有真的跑才知道)。
9733
+ - 不证明:有人看过结果。凭证是机器写的,谁都能改文件——它是防遗忘,不是防伪造。
9734
+
9735
+ 首次接入时做过的验证:给 `src/00-locale.js` 追加一个换行 → `probe-receipt-check` 退出码 1,
9736
+ 打印 `STALE — src/ changed after the probe last passed`;恢复后退出码 0。
9737
+
9738
+ 这条守卫还带来一个必须明说的流程变化:**改过 `src/` 就必须先跑探针再 `npm run check`**。
9739
+ 只改文档、测试或脚本时凭证不受影响,不会打扰。
9740
+
9741
+ **同一套逻辑的下半截:探针文件之间也不该有隐式交接。** 上半段跑完把"健康快照"放在
9742
+ `window.__detailBase` 上交给下一段,注释写着"每个 eval 是自己的作用域"。问题不在作用域,
9743
+ 在于那不是一个**声明过的**契约:它是"上一个文件在 store 里留下的任何东西"。某个组改了
9744
+ store 又忘了还原,后面三段的起点就被悄悄挪走了;而它只会在某个后继组里表现为
9745
+ 一个看似无关的失败。
9746
+
9747
+ 现在 `fixture.js` 暴露 `__h.reset()` / `__h.seed()`,每次调用都**重新构造**种子快照
9748
+ (不是别名,构造器会被再调一遍,所以一段对自身副本的修改污染不到下一段)。
9749
+ `probe-detail2.js` / `probe-detail3.js` 开头各自 `reset()`,不再读 `__detailBase`。
9750
+
9751
+ 验证方式不是"跑全套还是绿的"——那是解耦前也能做到的事。真正能证明的是:
9752
+ **单独 eval `probe-detail3.js`(前面一段都不跑)返回 `failures: []`**;`probe-detail2.js` 同样。
9753
+ 两者都做到了。
9754
+
9755
+ (顺带记一笔:改这段时我自己先踩了一次 TDZ——`await tick(400)` 写在
9756
+ `const tick = …` 之前,报 `Cannot access 'tick' before initialization`。这正是 Z1/Z2
9757
+ 在 `src/` 里盯的那类错误,出现在测试代码里它们管不到。已按正确顺序修好。)
9758
+
9704
9759
  ### 13.70 流式快照从没被画出来过;修的时候撞上 30 秒上限,把探针拆成两半(2026-11-26)
9705
9760
 
9706
9761
  #### 现象
@@ -10718,6 +10773,9 @@ boundary: false ← 没有渲染失败卡
10718
10773
  | 24 | 锚点“向前翻页直到命中”无端到端覆盖 | 夹具 `loadOlder` 秒回且不加载,只能测两端点 | 探针 23k(变异 → 红) |
10719
10774
  | 25 | 压缩重放被标成“调用不在窗口内” | 真实会话 13 组重复 result,全部误标 | `REPLAY1` + 探针 23l(变异 → 红) |
10720
10775
  | 26 | 窗口外系统提示显示成“0 字” | 契约说该场景 `prompt.system` 为空,真文本在 `systemPrompts` | `SYSOUT1` + 探针 23m(变异 → 红) |
10776
+ | 27 | 生成中的步骤排到本轮第一步之前 | partial 时间戳用轮次最早 seq + 0.5 | `PARTIALORDER1`(变异 → 红) |
10777
+ | 28 | 导出表头少了「工具总耗时」 | 屏幕五项、导出四项 | `EXPORTKPI1` + 探针 23n(变异 → 红) |
10778
+ | 29 | 探针涨到 37 秒,变异验证变成「无法解析」 | `eval` 30 秒上限,超时不是失败 | 拆出 `probe-detail3.js`;`healthySnap` 移进 IIFE |
10721
10779
 
10722
10780
  ### 13.82.9 夹具与官方契约的一处偏差:`callSchemas` 是 Map,不是对象
10723
10781
 
@@ -39,6 +39,7 @@
39
39
  - `scripts/guard-check.mjs`
40
40
  - `scripts/harness-stamp.mjs`
41
41
  - `scripts/path-leak-check.mjs`
42
+ - `scripts/probe-receipt-check.mjs`
42
43
  - `scripts/provenance.mjs`
43
44
  - `scripts/readme-numbers.mjs`
44
45
  - `scripts/release-status.mjs`
@@ -53,7 +54,9 @@
53
54
  - `test/browser/fixture.js`
54
55
  - `test/browser/probe-detail.js`
55
56
  - `test/browser/probe-detail2.js`
57
+ - `test/browser/probe-detail3.js`
56
58
  - `test/browser/probe-en.js`
59
+ - `test/browser/probe-receipt.json`
57
60
  - `test/browser/probe.js`
58
61
 
59
62
  ## 二、`lib/client.js` 函数级
package/lib/client.js CHANGED
@@ -2259,7 +2259,22 @@ window.__ModuleLoader__.load({
2259
2259
  const p = snap?.partial;
2260
2260
  if (p != null && Array.isArray(p.blocks) && p.blocks.length > 0) {
2261
2261
  const turn = typeof p.turn === "number" ? p.turn : 0;
2262
- const seq = lastTurnEntry != null ? lastTurnEntry.seq + 0.5 : 0.5;
2262
+ // The in-flight step belongs at the END of its turn, not just after the turn's
2263
+ // first event. `+0.5` was added to the turn's EARLIEST seq, so a partial that
2264
+ // arrived while steps 1 and 2 already existed sorted BEFORE step 1: the
2265
+ // "running" card appeared to the left of finished work (measured order
2266
+ // user → step3(live) → step1 → step2). Take the turn's largest known seq.
2267
+ const seq = (() => {
2268
+ if (lastTurnEntry == null) return 0.5;
2269
+ let maxSeq = lastTurnEntry.seq;
2270
+ for (const st0 of lastTurnEntry.steps?.values() ?? []) {
2271
+ if (Number.isFinite(st0.seq) && st0.seq > maxSeq) maxSeq = st0.seq;
2272
+ }
2273
+ for (const s0 of lastTurnEntry.stations) {
2274
+ if (Number.isFinite(s0.seq) && s0.seq > maxSeq) maxSeq = s0.seq;
2275
+ }
2276
+ return maxSeq + 0.5;
2277
+ })();
2263
2278
  flushUser(turn, seq);
2264
2279
  const e = ensureTurn(turn, seq);
2265
2280
  const step = stepOf(p.step);
@@ -3503,7 +3518,11 @@ window.__ModuleLoader__.load({
3503
3518
  L.push(`# ${t("export.title")}`);
3504
3519
  L.push("");
3505
3520
  const s = tree.stats;
3506
- L.push(`> ${t("node.turn")} ${s.turns} · ${t("node.step")} ${s.steps} · ${t("node.tool")} ${s.tools} · ${t("kpi.errors")} ${s.errors} · ${t("kpi.tokensIn")} ${fmtTokens(s.tokensIn)} · ${t("kpi.tokensOut")} ${fmtTokens(s.tokensOut)}${s.lastModel ? ` · ${s.lastModel}` : ""}`);
3521
+ // The header KPI strip carries FIVE numbers, and the export carried four: a
3522
+ // reader who saw "900 ms 工具总耗时" on screen and pasted the export into a bug
3523
+ // report lost exactly that number. Same rule as the warning lines below — the
3524
+ // file states what the screen states.
3525
+ L.push(`> ${t("node.turn")} ${s.turns} · ${t("node.step")} ${s.steps} · ${t("node.tool")} ${s.tools} · ${t("kpi.errors")} ${s.errors} · ${t("kpi.toolTime")} ${fmtDur(s.toolMs)} · ${t("kpi.tokensIn")} ${fmtTokens(s.tokensIn)} · ${t("kpi.tokensOut")} ${fmtTokens(s.tokensOut)}${s.lastModel ? ` · ${s.lastModel}` : ""}`);
3507
3526
  // The panel warns about a damaged or drifting log in its header; the export used
3508
3527
  // to state only the totals, so a saved "study notes" file silently claimed a
3509
3528
  // clean read of a log the screen was actively flagging. Same rule as the error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-trajectory-traceview-plus",
3
- "version": "0.11.6",
3
+ "version": "0.11.8",
4
4
  "description": "轨迹视图增强版(Plus):在「轨迹」标签旁新增可回放的横向时间轴——minimap、窗口内检索(显式标注覆盖边界)、回放、轮次跳转、跟随模式、历史分页、步骤/子调用耗时与吞吐、时钟轴切换、稳定锚点复制与深链、孤立工具结果站点、提示词变更对比、原始请求分析与 Markdown 导出。基于 AFAP/dsh-trajectory-traceview (MIT) 改造。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "scripts": {
64
64
  "build": "node scripts/build-client.mjs",
65
- "check": "node scripts/build-client.mjs --check && node scripts/provenance.mjs --check && node scripts/version-check.mjs && node scripts/doc-ref-check.mjs && node scripts/doc-heading-check.mjs && node test/smoke.test.cjs && node scripts/readme-numbers.mjs && node scripts/shortcut-check.mjs && node scripts/harness-stamp.mjs && node scripts/path-leak-check.mjs",
65
+ "check": "node scripts/build-client.mjs --check && node scripts/provenance.mjs --check && node scripts/version-check.mjs && node scripts/doc-ref-check.mjs && node scripts/doc-heading-check.mjs && node test/smoke.test.cjs && node scripts/readme-numbers.mjs && node scripts/shortcut-check.mjs && node scripts/harness-stamp.mjs && node scripts/path-leak-check.mjs && node scripts/probe-receipt-check.mjs",
66
66
  "test": "node test/smoke.test.cjs",
67
67
  "prepublishOnly": "npm run check"
68
68
  }
@@ -11,6 +11,7 @@
11
11
  * suite: the smoke suite must stay runnable without a browser.
12
12
  */
13
13
  import { spawnSync } from "node:child_process";
14
+ import { createHash } from "node:crypto";
14
15
  import fs from "node:fs";
15
16
  import path from "node:path";
16
17
 
@@ -18,6 +19,9 @@ const root = path.resolve(import.meta.dirname, "..");
18
19
  const shots = process.argv.includes("--shots");
19
20
  const run = (cmd, args, input) => spawnSync(cmd, args, { cwd: root, input, encoding: "utf8", timeout: 180000 });
20
21
 
22
+ // Where the "the probe really ran against this src/" receipt lives. Kept in git: the
23
+ // point is that a reader of the repo can see it, not that a machine writes it.
24
+ const PROBE_RECEIPT = path.join(root, "test", "browser", "probe-receipt.json");
21
25
  const build = run("node", ["scripts/browser-harness.mjs"]);
22
26
  if (build.status !== 0) { console.log(build.stdout + build.stderr); process.exit(1); }
23
27
 
@@ -29,7 +33,7 @@ run("agent-browser", ["wait", "1200"]);
29
33
  // BOTH halves share one page: the browser is opened once and the evals run in order, so
30
34
  // `probe-detail.js` continues from the state `probe.js` leaves. Split because
31
35
  // `agent-browser eval` aborts at 30 s and the single file had reached 27.4 s (§13.70).
32
- const probeFiles = ["test/browser/probe.js", "test/browser/probe-detail.js", "test/browser/probe-detail2.js"];
36
+ const probeFiles = ["test/browser/probe.js", "test/browser/probe-detail.js", "test/browser/probe-detail2.js", "test/browser/probe-detail3.js"];
33
37
  const probe = fs.readFileSync(path.join(root, probeFiles[0]), "utf8");
34
38
  const out = run("agent-browser", ["eval", "--stdin"], probe);
35
39
  const raw = (out.stdout || "").trim();
@@ -103,7 +107,27 @@ if (parsed.failures.length === 0) {
103
107
  // README claim "13 项行为" for a file with 47 assertions, which undersold the
104
108
  // coverage by 3.5x. Say what it actually counts.
105
109
  const groups = Object.keys(parsed.info).length;
110
+ // Receipt: the probe cannot run in CI (needs a real Chrome over CDP, see the note
111
+ // at the bottom of .github/workflows/check.yml), so its ENTIRE value depends on
112
+ // someone having actually run it against this exact src/. Two things went wrong
113
+ // here recently and both looked green from CI's side:
114
+ // - a probe that hit the 30 s eval cap reported "unparsable", which reads like a
115
+ // tool failure rather than a red assertion, so a mutation run "passed";
116
+ // - a stale probe run was used to justify a commit while src/ had moved on.
117
+ // `npm run check` (and therefore `prepublishOnly`) now refuses to be green unless
118
+ // this receipt matches a digest of src/. It is not proof; it is the missing signal.
119
+ const srcDigest = createHash("sha256");
120
+ for (const f of fs.readdirSync(path.join(root, "src")).sort()) {
121
+ if (f.endsWith(".js")) srcDigest.update(f + "\u0000" + fs.readFileSync(path.join(root, "src", f)) + "\u0000");
122
+ }
123
+ const receipt = {
124
+ src_digest: srcDigest.digest("hex"),
125
+ groups,
126
+ ran_at: new Date().toISOString()
127
+ };
128
+ fs.writeFileSync(PROBE_RECEIPT, JSON.stringify(receipt, null, 2) + "\n");
106
129
  console.log("browser-check: PASS (" + groups + " observation groups recorded, 0 failures)");
130
+ console.log("browser-check: receipt written to " + PROBE_RECEIPT);
107
131
  process.exit(0);
108
132
  }
109
133
  console.log("browser-check: FAIL");
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Refuse to be green unless the browser probe actually ran against the current `src/`.
4
+ *
5
+ * WHY THIS IS NOT THE TEST ITSELF
6
+ * `scripts/browser-check.mjs` needs a real Chrome over CDP, and wiring that into the
7
+ * CI runner is deliberately not done (see the note at the bottom of
8
+ * `.github/workflows/check.yml`: a flaky browser job trains people to ignore red
9
+ * builds). So 48 observation groups / 314 assertions run on a maintainer machine only.
10
+ *
11
+ * That left a hole this script closes. Twice in one week a change was justified by a
12
+ * probe run that could not be trusted:
13
+ *
14
+ * 1. A probe that hit `agent-browser eval`'s 30 s cap reported "did not return a
15
+ * parsable result". Read quickly, that looks like a tool problem — not a red
16
+ * assertion — so a mutation run appeared to pass.
17
+ * 2. `src/` moved on after the probe ran, and nothing anywhere said so.
18
+ *
19
+ * `browser-check.mjs` now writes `test/browser/probe-receipt.json` on PASS, carrying a
20
+ * digest of `src/*.js`. This script recomputes the digest and fails on any mismatch.
21
+ *
22
+ * WHAT IT PROVES: the probe passed, on a tree whose src/ digest is this one.
23
+ * WHAT IT DOES NOT PROVE: that the probe would still pass right now (only running it
24
+ * proves that), or that anyone looked at the result. It is a signal, not a guarantee —
25
+ * and it is the signal that was missing, not a weaker substitute for a test that could
26
+ * exist.
27
+ *
28
+ * node scripts/probe-receipt-check.mjs # fail on mismatch
29
+ * node scripts/probe-receipt-check.mjs --explain # say what to run instead of failing
30
+ */
31
+ import { createHash } from 'node:crypto';
32
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
33
+ import { dirname, join } from 'node:path';
34
+ import { fileURLToPath } from 'node:url';
35
+
36
+ const ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
37
+ const RECEIPT = join(ROOT, 'test', 'browser', 'probe-receipt.json');
38
+ const explain = process.argv.includes('--explain');
39
+
40
+ const digestOfSrc = () => {
41
+ const hash = createHash('sha256');
42
+ const dir = join(ROOT, 'src');
43
+ for (const f of readdirSync(dir).sort()) {
44
+ if (!f.endsWith('.js')) continue;
45
+ hash.update(f + '\u0000');
46
+ hash.update(readFileSync(join(dir, f)));
47
+ hash.update('\u0000');
48
+ }
49
+ return hash.digest('hex');
50
+ };
51
+
52
+ if (!existsSync(RECEIPT)) {
53
+ console.error('probe-receipt: MISSING — the browser probe has never run against this tree.');
54
+ console.error(' run: node scripts/browser-check.mjs (needs agent-browser + Chrome)');
55
+ process.exit(explain ? 0 : 1);
56
+ }
57
+
58
+ let receipt;
59
+ try {
60
+ receipt = JSON.parse(readFileSync(RECEIPT, 'utf8'));
61
+ } catch (e) {
62
+ console.error('probe-receipt: unreadable (' + e.message + ')');
63
+ process.exit(explain ? 0 : 1);
64
+ }
65
+
66
+ const actual = digestOfSrc();
67
+ if (receipt.src_digest !== actual) {
68
+ console.error('probe-receipt: STALE — src/ changed after the probe last passed.');
69
+ console.error(' receipt: ' + String(receipt.src_digest).slice(0, 16) + '… (' + String(receipt.ran_at) + ')');
70
+ console.error(' actual: ' + actual.slice(0, 16) + '…');
71
+ console.error(' run: node scripts/browser-check.mjs');
72
+ process.exit(explain ? 0 : 1);
73
+ }
74
+
75
+ console.log('probe-receipt: OK — the probe passed against this exact src/ (' +
76
+ String(receipt.ran_at) + ', ' + String(receipt.groups) + ' observation groups)');
@@ -39,7 +39,7 @@ const localSteps = pkg.scripts.check.split('&&').map((s) => s.trim()).filter(Boo
39
39
  // aborts at 30 s and the language switch pushed the single file over it (§13.69) — and
40
40
  // leaving it out of this count is exactly the one-source-vs-two-sources blindness this
41
41
  // very block has already been fixed for once (§13.44).
42
- const PROBE_FILES = ['test/browser/probe.js', 'test/browser/probe-detail.js', 'test/browser/probe-detail2.js', 'test/browser/probe-en.js'];
42
+ const PROBE_FILES = ['test/browser/probe.js', 'test/browser/probe-detail.js', 'test/browser/probe-detail2.js', 'test/browser/probe-detail3.js', 'test/browser/probe-en.js'];
43
43
  const probes = PROBE_FILES.map((f) => read(f));
44
44
  const observedGroups = new Set();
45
45
  let assertions = 0;
package/src/30-helpers.js CHANGED
@@ -1498,7 +1498,22 @@
1498
1498
  const p = snap?.partial;
1499
1499
  if (p != null && Array.isArray(p.blocks) && p.blocks.length > 0) {
1500
1500
  const turn = typeof p.turn === "number" ? p.turn : 0;
1501
- const seq = lastTurnEntry != null ? lastTurnEntry.seq + 0.5 : 0.5;
1501
+ // The in-flight step belongs at the END of its turn, not just after the turn's
1502
+ // first event. `+0.5` was added to the turn's EARLIEST seq, so a partial that
1503
+ // arrived while steps 1 and 2 already existed sorted BEFORE step 1: the
1504
+ // "running" card appeared to the left of finished work (measured order
1505
+ // user → step3(live) → step1 → step2). Take the turn's largest known seq.
1506
+ const seq = (() => {
1507
+ if (lastTurnEntry == null) return 0.5;
1508
+ let maxSeq = lastTurnEntry.seq;
1509
+ for (const st0 of lastTurnEntry.steps?.values() ?? []) {
1510
+ if (Number.isFinite(st0.seq) && st0.seq > maxSeq) maxSeq = st0.seq;
1511
+ }
1512
+ for (const s0 of lastTurnEntry.stations) {
1513
+ if (Number.isFinite(s0.seq) && s0.seq > maxSeq) maxSeq = s0.seq;
1514
+ }
1515
+ return maxSeq + 0.5;
1516
+ })();
1502
1517
  flushUser(turn, seq);
1503
1518
  const e = ensureTurn(turn, seq);
1504
1519
  const step = stepOf(p.step);
@@ -2742,7 +2757,11 @@
2742
2757
  L.push(`# ${t("export.title")}`);
2743
2758
  L.push("");
2744
2759
  const s = tree.stats;
2745
- L.push(`> ${t("node.turn")} ${s.turns} · ${t("node.step")} ${s.steps} · ${t("node.tool")} ${s.tools} · ${t("kpi.errors")} ${s.errors} · ${t("kpi.tokensIn")} ${fmtTokens(s.tokensIn)} · ${t("kpi.tokensOut")} ${fmtTokens(s.tokensOut)}${s.lastModel ? ` · ${s.lastModel}` : ""}`);
2760
+ // The header KPI strip carries FIVE numbers, and the export carried four: a
2761
+ // reader who saw "900 ms 工具总耗时" on screen and pasted the export into a bug
2762
+ // report lost exactly that number. Same rule as the warning lines below — the
2763
+ // file states what the screen states.
2764
+ L.push(`> ${t("node.turn")} ${s.turns} · ${t("node.step")} ${s.steps} · ${t("node.tool")} ${s.tools} · ${t("kpi.errors")} ${s.errors} · ${t("kpi.toolTime")} ${fmtDur(s.toolMs)} · ${t("kpi.tokensIn")} ${fmtTokens(s.tokensIn)} · ${t("kpi.tokensOut")} ${fmtTokens(s.tokensOut)}${s.lastModel ? ` · ${s.lastModel}` : ""}`);
2746
2765
  // The panel warns about a damaged or drifting log in its header; the export used
2747
2766
  // to state only the totals, so a saved "study notes" file silently claimed a
2748
2767
  // clean read of a log the screen was actively flagging. Same rule as the error