mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
fix(engine): preserve static dedup across caption runs (#3438)
* fix(engine): preserve authored clip boundaries after normalization * perf(engine): bound static verification work across caption runs * fix(core): preserve explicit nonpositive timeline windows
This commit is contained in:
@@ -82,6 +82,52 @@ describe("buildRenderPerfSummary static-dedup aggregation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps predicted and verified counts distinct and aggregates bounded verifier telemetry", () => {
|
||||
const s = buildRenderPerfSummary(
|
||||
baseInput([
|
||||
perf({
|
||||
staticDedupEnabled: true,
|
||||
staticDedupArmed: true,
|
||||
staticDedupPredicted: 300,
|
||||
staticDedupVerified: 240,
|
||||
staticDedupVerificationOutcome: "time_budget",
|
||||
staticDedupVerificationPlannedRuns: 60,
|
||||
staticDedupVerificationCompletedRuns: 48,
|
||||
staticDedupVerificationScreenshots: 96,
|
||||
staticDedupVerificationSeeks: 97,
|
||||
staticDedupVerificationComparisons: 48,
|
||||
staticDedupVerificationElapsedMs: 15_000,
|
||||
}),
|
||||
perf({
|
||||
staticDedupEnabled: true,
|
||||
staticDedupArmed: true,
|
||||
staticDedupPredicted: 200,
|
||||
staticDedupVerified: 200,
|
||||
staticDedupVerificationOutcome: "verified",
|
||||
staticDedupVerificationPlannedRuns: 40,
|
||||
staticDedupVerificationCompletedRuns: 40,
|
||||
staticDedupVerificationScreenshots: 80,
|
||||
staticDedupVerificationSeeks: 81,
|
||||
staticDedupVerificationComparisons: 40,
|
||||
staticDedupVerificationElapsedMs: 8_000,
|
||||
}),
|
||||
]),
|
||||
).staticDedup;
|
||||
expect(s).toMatchObject({
|
||||
armed: true,
|
||||
predictedFrames: 500,
|
||||
verifiedFrames: 440,
|
||||
verificationOutcomes: ["time_budget", "verified"],
|
||||
plannedRuns: 100,
|
||||
completedRuns: 88,
|
||||
screenshots: 176,
|
||||
seeks: 178,
|
||||
comparisons: 88,
|
||||
verificationElapsedMs: 23_000,
|
||||
skipReason: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it("reports skipReason when no worker armed", () => {
|
||||
const s = buildRenderPerfSummary(
|
||||
baseInput([
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
|
||||
import { arch, cpus, platform, totalmem } from "node:os";
|
||||
import { fpsToNumber } from "@hyperframes/core";
|
||||
import type { CapturePerfSummary, SubTimelineWaitOutcome, WorkerSizing } from "@hyperframes/engine";
|
||||
import type {
|
||||
CapturePerfSummary,
|
||||
StaticVerificationOutcome,
|
||||
SubTimelineWaitOutcome,
|
||||
WorkerSizing,
|
||||
} from "@hyperframes/engine";
|
||||
import type { CaptureCalibrationSample, CaptureCostEstimate } from "./captureCost.js";
|
||||
import type {
|
||||
CaptureAttemptSummary,
|
||||
@@ -165,12 +170,53 @@ function aggregateDedup(perfs: CapturePerfSummary[]): RenderPerfSummary["staticD
|
||||
: [
|
||||
...new Set(perfs.map((p) => p.staticDedupSkipReason).filter((r): r is string => !!r)),
|
||||
].sort();
|
||||
const verificationPerfs = perfs.filter((perf) => perf.staticDedupVerificationOutcome);
|
||||
const verificationOutcomes = [
|
||||
...new Set(
|
||||
verificationPerfs
|
||||
.map((perf) => perf.staticDedupVerificationOutcome)
|
||||
.filter((outcome): outcome is StaticVerificationOutcome => outcome != null),
|
||||
),
|
||||
].sort();
|
||||
return {
|
||||
enabled: perfs.some((p) => p.staticDedupEnabled),
|
||||
armed,
|
||||
predictedFrames: perfs.reduce((sum, p) => sum + (p.staticDedupPredicted ?? 0), 0),
|
||||
reusedFrames: perfs.reduce((sum, p) => sum + (p.staticDedupReused ?? 0), 0),
|
||||
skipReason: skipReasons.length > 0 ? skipReasons.join("|") : undefined,
|
||||
...(verificationPerfs.length === 0
|
||||
? {}
|
||||
: {
|
||||
verifiedFrames: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerified ?? 0),
|
||||
0,
|
||||
),
|
||||
verificationOutcomes,
|
||||
plannedRuns: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationPlannedRuns ?? 0),
|
||||
0,
|
||||
),
|
||||
completedRuns: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationCompletedRuns ?? 0),
|
||||
0,
|
||||
),
|
||||
screenshots: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationScreenshots ?? 0),
|
||||
0,
|
||||
),
|
||||
seeks: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationSeeks ?? 0),
|
||||
0,
|
||||
),
|
||||
comparisons: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationComparisons ?? 0),
|
||||
0,
|
||||
),
|
||||
verificationElapsedMs: verificationPerfs.reduce(
|
||||
(sum, perf) => sum + (perf.staticDedupVerificationElapsedMs ?? 0),
|
||||
0,
|
||||
),
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ import {
|
||||
type CaptureWarning,
|
||||
type SubTimelineWaitOutcome,
|
||||
type WorkerSizing,
|
||||
type StaticVerificationOutcome,
|
||||
resolveBrowserGpuMode,
|
||||
resolveHeadlessShellPath,
|
||||
applyConcreteGpuScreenshotClamp,
|
||||
@@ -461,8 +462,16 @@ export interface RenderPerfSummary {
|
||||
enabled: boolean;
|
||||
armed: boolean;
|
||||
predictedFrames: number;
|
||||
verifiedFrames?: number;
|
||||
reusedFrames: number;
|
||||
skipReason?: string;
|
||||
verificationOutcomes?: StaticVerificationOutcome[];
|
||||
plannedRuns?: number;
|
||||
completedRuns?: number;
|
||||
screenshots?: number;
|
||||
seeks?: number;
|
||||
comparisons?: number;
|
||||
verificationElapsedMs?: number;
|
||||
};
|
||||
/**
|
||||
* BeginFrame no-damage reuse outcome for this render (Linux/Docker),
|
||||
|
||||
Reference in New Issue
Block a user