feat(PR-05): Trace provenance annotations, grouped chips and stale semantics

- mark static anchors data-annotation-source=analysis and observed run chips
  data-annotation-source=trace with run seq/kind; group events per source anchor
  into one chip (>3 events collapse to ×N with a truthful title)
- add controller tests for source edits during a run (stale=true and all
  anchors/source ids null), mismatched Trace digest (run succeeds,
  trace.status=invalid, no events) and truncated Trace (event_budget preserved)
- ADR-0010 records the annotation/staleness strategy and the allowed inline-chip
  degradation instead of SVG curves
- extend browser suite with provenance/grouping assertions and dark-theme run
  screenshot; record PR-05 evidence (real Chromium, RFC width matrix)
- unit 63 + contract 41 + integration 43 + security 11 pass; clippy clean
This commit is contained in:
cflmy committed 2026-11-22 14:36:09 +08:00
1 parent 046834bcb6
commit 807c24b952
14 files changed
+462 -18

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
# PR-05 证据:Trace v2 绑定、原文标注与浏览器回归
- 日期:2026-11-22
- 范围:`src/execution/controller.rs`(Trace 摘要/`source_id`/stale)、
`assets/reader.js`(Observed chip 分组)、`src/reader/render.rs`
(`data-annotation-source`)、浏览器套件与视觉证据
- 冻结 CLI:`marqdo 3.0.0-beta.1`(`062cb56e…`),浏览器测试前后 SHA 不变
- 规范:RFC-VIEW-0002 §4.4、§7.3、§7.4;ADR-0010
## 1. 绑定与降级(测试)
| 场景 | 断言 | 测试 |
|---|---|---|
| 正常运行 | Trace `status=verified`、事件 `source_id` 可锚定、`stale=false` | `explicit_entry_run_streams_...` |
| 源在运行中被编辑 | `result.stale=true`、`trace.stale=true`、所有 `anchor/source_id=null` | `source_edit_during_a_run_marks_the_result_stale_and_drops_anchor_ids` |
| Trace digest 不符 | 运行仍 `succeeded`,`trace.status=invalid`,无事件/无锚点 | `trace_with_a_mismatched_digest_is_reported_invalid_but_the_run_still_succeeds` |
| Trace 截断 | `trace.truncated.reason=event_budget`,结果保留,不声称完整 | `truncated_trace_is_marked_without_claiming_complete_coverage` |
| Trace 缺失 | `trace=null`、`trace_status=unavailable`,不伪造 | `run_without_a_trace_file_succeeds_but_reports_unavailable_trace` |
| 非入口模块事件 | 不映射到入口正文(`source_id=null`),保留模块 id | Controller Trace 摘要/`trace_contract` 校验 |
| UTF-8/span/越界 | 既有 Analysis/Trace 校验测试保持通过 | `tests/contract/trace_contract.rs`、`integration/unicode_spans.rs` |
## 2. 浏览器回归(真实 Chromium 131)
`browser.log`:三个项目全部 PASS。关键断言:
- `observed chips carry trace provenance`:chip 带
`data-annotation-source="trace"`;
- `static statement anchors carry analysis provenance`:静态锚点带
`data-annotation-source="analysis"`;
- `at most one grouped chip per anchor`:同锚点多事件合并为单个 chip(>3 条显示
`×N` 与真实 `title`),不压过正文;
- run 终态/运行区/Trace 列表/stdout/清理与既有检查;
- 2048×1133、1664×920、1440×900、1024×768、768×1024、390×844:无横向溢出、
Dock 在视口、无外部请求、无 console error;
- 无 JS 可读、打印保持正文、深色/暖纸主题切换与持久化。
截图:`control-flow-run.png`、`control-flow-run-dark.png`、
`welcome-2048x1133.png`、`control-flow-390x844.png`。
## 3. 测试计数
```
unit 63 + contract 41 + integration 43 + security 11 = 158 passed / 0 failed
```
## 4. 未做/偏差
- 未实现 SVG 弯曲连接线;按 RFC §4.4 允许的降级采用内联分组 chip(ADR-0010),
不画无来源/错位曲线。
- 逐语句变量值/参数值/内存快照:Trace v2 不提供,保持 UNSUPPORTED。
- 人工像素级比对与完整 screen-reader 走查仍为 `UNVERIFIED`。
+146
View File
@@ -0,0 +1,146 @@
==> browser suite: examples/welcome
ok reader root rendered
ok document title has Marqdo
ok one stylesheet
ok one script
ok no external requests
ok no browser console errors
ok dock has all actions
ok dock run control present
ok interactive controls have accessible names
ok Tab reaches named controls
ok more dialog opens
ok source mode attribute
ok source pane visible
ok document hidden in source mode
ok document mode restored
ok search dialog opens
ok search returns local results
ok text size toggled
ok annotations toggled
ok welcome hero only on configured page
ok grammar statement is a real element
ok GFM table rendered
ok dark theme applied
ok theme preference persisted
ok paper theme restored
ok no horizontal overflow at 2048
ok dock inside viewport at 2048
ok no horizontal overflow at 1664
ok dock inside viewport at 1664
ok no horizontal overflow at 1440
ok dock inside viewport at 1440
ok no horizontal overflow at 1024
ok dock inside viewport at 1024
ok no horizontal overflow at 768
ok dock inside viewport at 768
ok no horizontal overflow at 390
ok dock inside viewport at 390
ok no-JS document remains readable
ok no-JS exposes no active run UI
ok print hides dock
ok print keeps prose
browser: PASS
==> browser suite: examples/control-flow
ok reader root rendered
ok document title has Marqdo
ok one stylesheet
ok one script
ok no external requests
ok no browser console errors
ok dock has all actions
ok dock run control present
ok interactive controls have accessible names
ok Tab reaches named controls
ok more dialog opens
ok source mode attribute
ok source pane visible
ok document hidden in source mode
ok document mode restored
ok search dialog opens
ok search returns local results
ok text size toggled
ok annotations toggled
ok dark theme applied
ok theme preference persisted
ok paper theme restored
ok no horizontal overflow at 2048
ok dock inside viewport at 2048
ok no horizontal overflow at 1664
ok dock inside viewport at 1664
ok no horizontal overflow at 1440
ok dock inside viewport at 1440
ok no horizontal overflow at 1024
ok dock inside viewport at 1024
ok no horizontal overflow at 768
ok dock inside viewport at 768
ok no horizontal overflow at 390
ok dock inside viewport at 390
ok no-JS document remains readable
ok no-JS exposes no active run UI
ok print hides dock
ok print keeps prose
ok run dialog opens
ok run dialog mentions pure mode
ok run dialog previews the command
ok run state succeeded via SSE
ok run panel visible
ok run chips anchored
ok observed chips carry trace provenance
ok static statement anchors carry analysis provenance
ok at most one grouped chip per anchor
ok trace event list rendered
ok stdout rendered escaped
ok no polling API was used
ok clear hides run panel
ok page was never reloaded by the run
browser: PASS
==> browser suite: tests/fixtures/security-project
ok reader root rendered
ok document title has Marqdo
ok one stylesheet
ok one script
ok no external requests
ok no browser console errors
ok dock has all actions
ok dock run control present
ok interactive controls have accessible names
ok Tab reaches named controls
ok more dialog opens
ok source mode attribute
ok source pane visible
ok document hidden in source mode
ok document mode restored
ok search dialog opens
ok search returns local results
ok text size toggled
ok annotations toggled
ok adversarial doc has no alert dialog
ok adversarial doc has no external requests
ok raw HTML omitted note rendered
ok prose survives sanitization
ok javascript link neutralized
ok dark theme applied
ok theme preference persisted
ok paper theme restored
ok no horizontal overflow at 2048
ok dock inside viewport at 2048
ok no horizontal overflow at 1664
ok dock inside viewport at 1664
ok no horizontal overflow at 1440
ok dock inside viewport at 1440
ok no horizontal overflow at 1024
ok dock inside viewport at 1024
ok no horizontal overflow at 768
ok dock inside viewport at 768
ok no horizontal overflow at 390
ok dock inside viewport at 390
ok no-JS document remains readable
ok no-JS exposes no active run UI
ok print hides dock
ok print keeps prose
browser: PASS
browser: PASS (core sha256 062cb56e226bee55c21d238e195920caa985e62bb3877ba7b07abcc04dc0fe3f unchanged; screenshots: /root/work/marqdo-view/tests/browser/artifacts)
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB