feat: PJ2026-0104010803 P4 前端/CLI 单读源收敛 - 删除 events.at(-1) 读侧推理 (#1758)

workbench.ts (stores):
- applyTraceHydrationResult: activityLabel 只读 result.lastEventLabel,不读 events.at(-1)
- lastEventLabel: 只读 result.lastEventLabel,不 fallback 到 events.at(-1)
- normalizeTraceSnapshot: lastEventLabel 只读 source.lastEventLabel
- mergeRunnerTrace: lastEventLabel 不从 events.at(-1) 推断

useTraceSubscription.ts:
- lastEventLabel 只读 snapshot.lastEventLabel,不读 events.at(-1)

trace-renderer.ts (CLI):
- traceNoiseSummaryRow: status 只读 trace.status/traceStatus,不 fallback 到 lastEvent.status
- 保持 lastLabel 用于展示,但不参与 lifecycle 推断

api/workbench.ts:
- 添加注释标记 observedAt/lastEventAgeMs 为 diagnostic-only,不作用户可见相对时间权威

Closes #1750
Refs #1742
This commit is contained in:
Lyon
2026-06-20 19:37:35 +08:00
committed by GitHub
parent 9574e2b514
commit 44019f229e
4 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -220,7 +220,7 @@ function traceCompletionSummaryRow(trace: Record<string, unknown>, event: TraceE
function traceNoiseSummaryRow(trace: Record<string, unknown>, events: TraceEvent[], options: TraceDisplayRowsOptions): TraceEventRow {
const lastEvent = events.at(-1);
const status = nonEmptyString(trace.status ?? trace.traceStatus ?? lastEvent?.status) ?? "running";
const status = nonEmptyString(trace.status ?? trace.traceStatus) ?? "running";
const lastLabel = lastEvent ? readableTraceLabel(lastEvent) : "未观测";
return {
rowId: "trace-noise-summary",