mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 12:54:29 +00:00
fix(render): ignore favicon probe noise (#2487)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { isActionableProbeFailure } from "./probeFailures.js";
|
||||
|
||||
describe("isActionableProbeFailure", () => {
|
||||
it("ignores favicon 404 noise without hiding real asset failures", () => {
|
||||
expect(
|
||||
isActionableProbeFailure(
|
||||
"[Browser:HTTP404] GET http://127.0.0.1:4173/favicon.ico resource=image",
|
||||
),
|
||||
).toBe(false);
|
||||
expect(
|
||||
isActionableProbeFailure(
|
||||
"[Browser:HTTP404] GET http://127.0.0.1:4173/assets/missing.png resource=image",
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isActionableProbeFailure(
|
||||
"[Browser:REQUESTFAILED] GET http://127.0.0.1:4173/assets/app.js resource=script error=net::ERR_FAILED",
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
const NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
|
||||
const FAVICON_PATTERN = /(?:^|[/?])favicon(?:\.[a-z0-9]+)?(?:[?#\s]|$)/i;
|
||||
|
||||
export function isActionableProbeFailure(line: string): boolean {
|
||||
return NETWORK_FAILURE_PATTERN.test(line) && !FAVICON_PATTERN.test(line);
|
||||
}
|
||||
@@ -59,6 +59,7 @@ import {
|
||||
type CompositionMetadata,
|
||||
} from "../shared.js";
|
||||
import type { RenderJob } from "../../renderOrchestrator.js";
|
||||
import { isActionableProbeFailure } from "./probeFailures.js";
|
||||
|
||||
export interface ProbeStageInput {
|
||||
projectDir: string;
|
||||
@@ -643,9 +644,7 @@ export async function runProbeStage(input: ProbeStageInput): Promise<ProbeStageR
|
||||
// These don't block the render but indicate missing images, fonts, or
|
||||
// scripts that may produce unexpected visual artifacts.
|
||||
if (probeSession) {
|
||||
const failedRequests = probeSession.browserConsoleBuffer.filter((line) =>
|
||||
/404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i.test(line),
|
||||
);
|
||||
const failedRequests = probeSession.browserConsoleBuffer.filter(isActionableProbeFailure);
|
||||
if (failedRequests.length > 0) {
|
||||
log.warn("Browser encountered network failures during page load:", {
|
||||
failures: failedRequests.slice(0, 10),
|
||||
|
||||
Reference in New Issue
Block a user