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

+29
View File
@@ -254,6 +254,30 @@ function localHostOnly(url) {
check("run state succeeded via SSE", (await page.getAttribute("body", "data-run-state")) === "succeeded");
check("run panel visible", await page.locator("#mq-run-panel").isVisible());
check("run chips anchored", (await page.locator(".mq-run-chip").count()) > 0);
check(
"observed chips carry trace provenance",
(await page.locator('.mq-run-chip[data-annotation-source="trace"]').count()) > 0
);
check(
"static statement anchors carry analysis provenance",
(await page.locator('[data-annotation-source="analysis"]').count()) > 0
);
check(
"at most one grouped chip per anchor",
(await page.locator(".mq-run-chip").count()) ===
(await page.locator(".mq-run-chip").evaluateAll((nodes) => {
const seen = new Set();
let unique = 0;
nodes.forEach((node) => {
const key = node.parentElement ? node.parentElement.dataset.sourceId : null;
if (key && !seen.has(key)) {
seen.add(key);
unique += 1;
}
});
return unique;
}))
);
check(
"trace event list rendered",
(await page.locator("#mq-run-events li").count()) > 0
@@ -269,6 +293,11 @@ function localHostOnly(url) {
);
if (screenshotDir) {
await page.screenshot({ path: path.join(screenshotDir, "control-flow-run.png") });
await page.click('.mq-dock-btn[data-action="settings"]');
await page.click('#mq-dialog-settings [data-action="theme"]');
await page.screenshot({ path: path.join(screenshotDir, "control-flow-run-dark.png") });
await page.click('.mq-dock-btn[data-action="settings"]');
await page.click('#mq-dialog-settings [data-action="theme"]');
}
// Clear run hides the display and keeps the project untouched.
await page.click('.mq-dock-btn[data-action="clear"]');