fix: 区分 Trace 摘要与真实行保留

This commit is contained in:
Codex
2026-07-10 19:23:36 +02:00
parent 2394d8252e
commit 29166e2c07
2 changed files with 55 additions and 9 deletions
@@ -475,15 +475,10 @@ function workbenchTraceReadabilityRetention(running, terminal) {
const runningRowIds = new Set(running?.rowIdentities || []);
const terminalRowIds = new Set(terminal?.rowIdentities || []);
const retainedRowCount = [...runningRowIds].filter((identity) => terminalRowIds.has(identity)).length;
const concreteRunningRowIds = [...runningRowIds].filter((identity) => !identity.endsWith(":trace-noise-summary"));
const retainedConcreteRowCount = concreteRunningRowIds.filter((identity) => terminalRowIds.has(identity)).length;
const summaryOnly = runningRowIds.size > 0 && concreteRunningRowIds.length === 0;
const windowed = terminal?.disclosure?.rowWindowed === true;
if (!windowed) {
return {
mode: "identity-overlap",
passed: retainedRowCount > 0,
retainedRowCount,
valuesRedacted: true
};
}
const runningEventCount = running?.disclosure?.eventCount;
const terminalEventCount = terminal?.disclosure?.eventCount;
const countsAdvance = Number.isInteger(runningEventCount)
@@ -495,10 +490,20 @@ function workbenchTraceReadabilityRetention(running, terminal) {
&& Number.isInteger(terminal?.sourceSeqMax)
&& terminal.sourceSeqMin >= running.sourceSeqMin
&& terminal.sourceSeqMax >= running.sourceSeqMax;
if (!windowed && !summaryOnly) {
return {
mode: "identity-overlap",
passed: retainedConcreteRowCount > 0,
retainedRowCount,
retainedConcreteRowCount,
valuesRedacted: true
};
}
return {
mode: "window-progress",
mode: windowed ? "window-progress" : "summary-progress",
passed: countsAdvance && sequenceWindowAdvances,
retainedRowCount,
retainedConcreteRowCount,
runningEventCount: runningEventCount ?? null,
terminalEventCount: terminalEventCount ?? null,
runningSourceSeqMin: running?.sourceSeqMin ?? null,