fix: tighten web probe in-place refresh evidence
This commit is contained in:
@@ -2467,11 +2467,15 @@ function detectWorkbenchTerminalApiDomLag(samples, network) {
|
||||
for (const event of terminalEvents) {
|
||||
const pageSamples = rowsByPage.get(event.pageKey) || [];
|
||||
if (pageSamples.length === 0 || event.tsMs < pageSamples[0].tsMs) continue;
|
||||
const alreadyVisible = lastWorkbenchSampleAtOrBefore(pageSamples, event.tsMs, event, (row) => workbenchSampleHasTerminalProjection(row.sample, event));
|
||||
if (alreadyVisible) continue;
|
||||
const firstAfter = firstWorkbenchSampleAfter(pageSamples, event.tsMs, event.tsMs + windowMs, event);
|
||||
const firstMiss = firstWorkbenchSampleAfter(pageSamples, event.tsMs, event.tsMs + budgetMs, event, (row) => !workbenchSampleHasTerminalProjection(row.sample, event));
|
||||
const resolved = firstWorkbenchSampleAfter(pageSamples, event.tsMs, event.tsMs + windowMs, event, (row) => workbenchSampleHasTerminalProjection(row.sample, event));
|
||||
const deltaMs = resolved ? Math.max(0, Math.round(resolved.tsMs - event.tsMs)) : null;
|
||||
const unresolved = !resolved;
|
||||
const exceedsBudget = unresolved || (Number.isFinite(deltaMs) && deltaMs > budgetMs);
|
||||
if (!firstMiss) continue;
|
||||
if (!exceedsBudget) continue;
|
||||
overBudget.push({
|
||||
ts: event.ts,
|
||||
@@ -2490,6 +2494,7 @@ function detectWorkbenchTerminalApiDomLag(samples, network) {
|
||||
resolvedDeltaMs: deltaMs,
|
||||
unresolvedWithinWindow: unresolved,
|
||||
firstAfterSample: compactWorkbenchProjectionSample(firstAfter?.sample, event),
|
||||
firstMissSample: compactWorkbenchProjectionSample(firstMiss?.sample, event),
|
||||
resolvedSample: compactWorkbenchProjectionSample(resolved?.sample, event),
|
||||
valuesRedacted: true
|
||||
});
|
||||
@@ -2547,6 +2552,17 @@ function isReliableWorkbenchTerminalApiEvent(summary, routeKind) {
|
||||
return Number(summary.runningStatusCount ?? 0) <= 0;
|
||||
}
|
||||
|
||||
function lastWorkbenchSampleAtOrBefore(rows, tsMs, event, predicate = null) {
|
||||
let result = null;
|
||||
for (const row of rows || []) {
|
||||
if (row.tsMs > tsMs) break;
|
||||
if (!workbenchSampleMatchesTerminalEvent(row.sample, event)) continue;
|
||||
if (typeof predicate === "function" && !predicate(row)) continue;
|
||||
result = row;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function firstWorkbenchSampleAfter(rows, startMs, endMs, event, predicate = null) {
|
||||
for (const row of rows || []) {
|
||||
if (row.tsMs < startMs) continue;
|
||||
|
||||
Reference in New Issue
Block a user