mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
feat(cli): check_report counts the browser-playable copies a check waited for (#7316)
* feat(cli): check_report counts the browser-playable copies a check waited for * style(cli): shorten the copy facts comment under the line limit * fix(cli): a check stopped by the copy wait stays browserSkipped; count only abort-caused unfinished * style(cli): format the copy facts tests
This commit is contained in:
@@ -63,7 +63,7 @@ import {
|
||||
resolveProxies,
|
||||
type ProxyProgress,
|
||||
} from "@hyperframes/studio-server/proxy-transcoder";
|
||||
import { rectToBbox } from "./checkTypes.js";
|
||||
import { rectToBbox, type MediaCopyFacts } from "./checkTypes.js";
|
||||
import type {
|
||||
AnchoredLayoutIssue,
|
||||
CheckAnchor,
|
||||
@@ -245,6 +245,7 @@ export async function preResolveHostileMediaProxies(
|
||||
html: string,
|
||||
autoProxyOverride?: boolean,
|
||||
budgetMs?: number,
|
||||
record?: (facts: MediaCopyFacts) => void,
|
||||
): Promise<ProxyPreResolution> {
|
||||
const none: ProxyPreResolution = {
|
||||
findings: [],
|
||||
@@ -333,6 +334,11 @@ export async function preResolveHostileMediaProxies(
|
||||
const unfinished = sources.flatMap(({ file }, index) =>
|
||||
results[index]!.status === "rejected" ? [`${file} ${heartbeat.percent(index)}`] : [],
|
||||
);
|
||||
record?.({
|
||||
total,
|
||||
waitedMs: Date.now() - startedAt,
|
||||
unfinished: overBudget === undefined ? 0 : unfinished.length,
|
||||
});
|
||||
if (overBudget !== undefined && unfinished.length > 0) {
|
||||
throw new CheckCopiesUnfinishedError(overBudget, unfinished);
|
||||
}
|
||||
@@ -439,6 +445,8 @@ export async function runBrowserCheck(
|
||||
): Promise<CheckBrowserResult> {
|
||||
const html = await loadCheckHtmlWithDeferredMedia(project.dir);
|
||||
deadline?.enter("copies");
|
||||
let mediaCopies: MediaCopyFacts | undefined;
|
||||
deadline?.keepPartial(() => (mediaCopies ? { mediaCopies } : {}));
|
||||
const {
|
||||
findings: drafts,
|
||||
failedPaths,
|
||||
@@ -448,6 +456,9 @@ export async function runBrowserCheck(
|
||||
html,
|
||||
options.autoProxy,
|
||||
Math.min(COPY_BUDGET_MS, deadline?.remainingMs() ?? COPY_BUDGET_MS),
|
||||
(facts) => {
|
||||
mediaCopies = facts;
|
||||
},
|
||||
);
|
||||
deadline?.enter("launch");
|
||||
const server = await serveStaticProjectHtml(
|
||||
@@ -533,6 +544,7 @@ export async function runBrowserCheck(
|
||||
const unreachable = await networkChangesStillFailing(merged);
|
||||
return {
|
||||
...result,
|
||||
...(mediaCopies && { mediaCopies }),
|
||||
timings: { ...result.timings, launchSettleMs },
|
||||
renderReadyTimedOut: session.renderReadyTimedOut,
|
||||
runtimeFindings: dropFailedProxyEchoes(
|
||||
|
||||
@@ -1747,7 +1747,8 @@ export async function runCheckPipeline(
|
||||
);
|
||||
} catch (error) {
|
||||
const found = deadline.partialResult();
|
||||
browser = { ...emptyBrowserResult(), ...found, skipped: Object.keys(found).length === 0 };
|
||||
const ran = Object.keys(found).filter((key) => key !== "mediaCopies");
|
||||
browser = { ...emptyBrowserResult(), ...found, skipped: ran.length === 0 };
|
||||
browser.runtimeFindings = [...browser.runtimeFindings, runtimeFailure(error)];
|
||||
}
|
||||
|
||||
@@ -2133,6 +2134,7 @@ function buildReport(
|
||||
stopCode: browser.runtimeFindings
|
||||
.map((finding) => finding.code)
|
||||
.find((code): code is StopCode => (STOP_CODES as readonly string[]).includes(code)),
|
||||
mediaCopies: browser.mediaCopies,
|
||||
runId: getRunId(),
|
||||
});
|
||||
return filterComponentReport(report, options);
|
||||
|
||||
@@ -322,7 +322,14 @@ export interface CheckTimings {
|
||||
overlapMs: number;
|
||||
}
|
||||
|
||||
export interface MediaCopyFacts {
|
||||
total: number;
|
||||
waitedMs: number;
|
||||
unfinished: number;
|
||||
}
|
||||
|
||||
export interface CheckBrowserResult {
|
||||
mediaCopies?: MediaCopyFacts;
|
||||
duration: number;
|
||||
layoutSamples: number[];
|
||||
transitionSamples: number[];
|
||||
|
||||
Reference in New Issue
Block a user