From 29166e2c0784ce018426940051beca344c67fa05 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 10 Jul 2026 19:23:36 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8C=BA=E5=88=86=20Trace=20=E6=91=98?= =?UTF-8?q?=E8=A6=81=E4=B8=8E=E7=9C=9F=E5=AE=9E=E8=A1=8C=E4=BF=9D=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ve-runner-trace-readability-source.test.ts | 41 +++++++++++++++++++ ...observe-runner-trace-readability-source.ts | 23 +++++++---- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.test.ts b/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.test.ts index 861d11c7..594d40c5 100644 --- a/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.test.ts +++ b/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.test.ts @@ -84,6 +84,7 @@ test("Workbench 产品 Trace 可读性源码解析独立 YAML 时序并识别终 mode: "window-progress", passed: true, retainedRowCount: 0, + retainedConcreteRowCount: 0, runningEventCount: 121, terminalEventCount: 122, runningSourceSeqMin: 1, @@ -92,6 +93,46 @@ test("Workbench 产品 Trace 可读性源码解析独立 YAML 时序并识别终 terminalSourceSeqMax: 121, valuesRedacted: true, }); + assert.deepEqual(helpers.workbenchTraceReadabilityRetention({ + rowIdentities: ["source:18:trace-noise-summary"], + disclosure: { eventCount: 25, rowWindowed: false }, + sourceSeqMin: 18, + sourceSeqMax: 18, + }, { + rowIdentities: ["source:21:event:evt_fixture", "source:42:terminal:evt_terminal"], + disclosure: { eventCount: 50, rowWindowed: false }, + sourceSeqMin: 21, + sourceSeqMax: 42, + }), { + mode: "summary-progress", + passed: true, + retainedRowCount: 0, + retainedConcreteRowCount: 0, + runningEventCount: 25, + terminalEventCount: 50, + runningSourceSeqMin: 18, + runningSourceSeqMax: 18, + terminalSourceSeqMin: 21, + terminalSourceSeqMax: 42, + valuesRedacted: true, + }); + assert.deepEqual(helpers.workbenchTraceReadabilityRetention({ + rowIdentities: ["source:18:event:evt_running"], + disclosure: { eventCount: 25, rowWindowed: false }, + sourceSeqMin: 18, + sourceSeqMax: 18, + }, { + rowIdentities: ["source:21:event:evt_terminal"], + disclosure: { eventCount: 50, rowWindowed: false }, + sourceSeqMin: 21, + sourceSeqMax: 21, + }), { + mode: "identity-overlap", + passed: false, + retainedRowCount: 0, + retainedConcreteRowCount: 0, + valuesRedacted: true, + }); }); test("运行卡片命中后使用 traceId 稳定定位,不随状态变更漂移", async () => { diff --git a/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.ts b/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.ts index f7089d51..1352670b 100644 --- a/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.ts +++ b/scripts/src/hwlab-node-web-observe-runner-trace-readability-source.ts @@ -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,