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

+19 -3
View File
@@ -800,14 +800,30 @@
$$("[data-source-id]").forEach(function (element) {
bySource[element.dataset.sourceId] = element;
});
var grouped = {};
entryEvents.forEach(function (event) {
if (!event.source_id || !bySource[event.source_id]) return;
if (!grouped[event.source_id]) grouped[event.source_id] = [];
grouped[event.source_id].push(event);
});
Object.keys(grouped).forEach(function (sourceId) {
var group = grouped[sourceId];
var last = group[group.length - 1];
var kinds = [];
group.forEach(function (event) {
if (kinds.indexOf(event.kind) < 0) kinds.push(event.kind);
});
var chip = document.createElement("span");
chip.className = "mq-run-chip";
chip.dataset.viewChip = "1";
chip.dataset.runSeq = String(event.seq);
chip.textContent = event.detail || event.kind;
bySource[event.source_id].appendChild(chip);
chip.dataset.annotationSource = "trace";
chip.dataset.runSeq = String(last.seq);
chip.dataset.runKind = kinds.join(",");
var text = last.detail || last.kind;
if (group.length > 3) text += " ×" + group.length;
chip.textContent = text;
chip.title = "本次 Trace 事件:" + group.length + " 条(" + kinds.join(",") + ")";
bySource[sourceId].appendChild(chip);
});
}
}