mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
feat(producer): a failed render says which file was gone again, looking only in its own folders (#8168)
* feat(producer): a render that fails on a missing file says what was gone again Restores the diagnostic the previous commit on main took out, as it was; the commits after it confine what it looks at. * test(producer): render failure diagnostics never probe a path from error text or outside the render * fix(producer): probe a missing path only from a real error, inside the render's folders describeMissingPath now reads only the path Node set on an ENOENT error, never one quoted in a message the page can write, and looks on disk only under the render's temp root, extract cache or work folder. Any other path is named from its text, so a network share is never contacted and the facts cannot tell an existing path from a missing one. * test(producer): a missing-path probe never passes an outside link or climbs above its folder * fix(producer): walk down from the render's own folder and check each link before following it * build(producer): give the packed size budget its 5% headroom with the missing-file diagnostic back
This commit is contained in:
@@ -2010,6 +2010,7 @@ function handleRenderError(
|
||||
errorName: error instanceof Error ? error.name : "unknown",
|
||||
failedStageCode: normalizeStageCode(failedStage || "pipeline"),
|
||||
missingPathKind: missingPathKind(error),
|
||||
missingPath: job?.errorDetails?.missingPath,
|
||||
...renderJobObservabilityTelemetryPayload(job),
|
||||
...getMemorySnapshot(),
|
||||
...cpu.stop(),
|
||||
|
||||
@@ -690,6 +690,24 @@ describe("render telemetry events", () => {
|
||||
expect(props.hf_env_overrides).toEqual(["HF_DE_VERIFY", "HYPERFRAMES_FONT_CACHE_DIR"]);
|
||||
});
|
||||
|
||||
it("sends only the closed-list missing-path facts on render_error", () => {
|
||||
trackRenderError({
|
||||
fps: 30,
|
||||
quality: "draft",
|
||||
docker: false,
|
||||
missingPath: { scope: "cache_entry", synced: true, root: "system_temp" },
|
||||
});
|
||||
const props = trackEvent.mock.calls[0]?.[1] as Record<string, unknown>;
|
||||
expect(props).toMatchObject({
|
||||
missing_path_scope: "cache_entry",
|
||||
missing_path_synced: true,
|
||||
missing_path_root: "system_temp",
|
||||
});
|
||||
expect(Object.values(props).filter((v) => typeof v === "string" && /[\\/]/.test(v))).toEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
it("reports an empty array, not an absent field, when no override was resolved", () => {
|
||||
trackRenderError({ fps: 30, quality: "draft", docker: false });
|
||||
const props = trackEvent.mock.calls[0]?.[1] as Record<string, unknown>;
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
renderMotionBlurEventProperties,
|
||||
} from "./renderMotionBlur.js";
|
||||
import { CliRuntimeError } from "../utils/commandResult.js";
|
||||
import type { MissingPathFacts } from "@hyperframes/producer";
|
||||
|
||||
// Power state is volatile (a laptop docks/undocks mid-session), so it is
|
||||
// sampled per render event rather than cached with SystemMeta. Attached to
|
||||
@@ -127,6 +128,7 @@ export interface RenderObservabilityTelemetryPayload {
|
||||
observabilityExtractVfrPreflightCount?: number;
|
||||
observabilityExtractCacheHits?: number;
|
||||
observabilityExtractCacheMisses?: number;
|
||||
observabilityExtractCachePublishFailures?: number;
|
||||
observabilityInitDurationMs?: number;
|
||||
observabilityInitTweenCount?: number;
|
||||
observabilityInitElementCount?: number;
|
||||
@@ -207,6 +209,7 @@ function renderObservabilityEventProperties(props: RenderObservabilityTelemetryP
|
||||
observability_extract_vfr_preflight_count: props.observabilityExtractVfrPreflightCount,
|
||||
observability_extract_cache_hits: props.observabilityExtractCacheHits,
|
||||
observability_extract_cache_misses: props.observabilityExtractCacheMisses,
|
||||
observability_extract_cache_publish_failures: props.observabilityExtractCachePublishFailures,
|
||||
observability_init_duration_ms: props.observabilityInitDurationMs,
|
||||
observability_init_tween_count: props.observabilityInitTweenCount,
|
||||
observability_init_element_count: props.observabilityInitElementCount,
|
||||
@@ -702,6 +705,7 @@ export function trackRenderError(
|
||||
/** failedStage normalized to a stable snake_case code. */
|
||||
failedStageCode?: string;
|
||||
missingPathKind?: string;
|
||||
missingPath?: MissingPathFacts;
|
||||
errorMessage?: string;
|
||||
elapsedMs?: number;
|
||||
peakMemoryMb?: number;
|
||||
@@ -731,6 +735,9 @@ export function trackRenderError(
|
||||
error_name: props.errorName,
|
||||
failed_stage_code: props.failedStageCode,
|
||||
missing_path_kind: props.missingPathKind,
|
||||
missing_path_scope: props.missingPath?.scope,
|
||||
missing_path_synced: props.missingPath?.synced,
|
||||
missing_path_root: props.missingPath?.root,
|
||||
error_message: props.errorMessage ? redactTelemetryMessage(props.errorMessage) : undefined,
|
||||
elapsed_ms: props.elapsedMs,
|
||||
...renderOutputShapeEventProperties(props),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { missingPathOf } from "@hyperframes/core/missing-path";
|
||||
|
||||
const KINDS: ReadonlyArray<[RegExp, string]> = [
|
||||
[/(^|[\\/])hfcache-/, "extract_cache"],
|
||||
[/(^|[\\/])__hyperframes_video_frames([\\/]|$)/, "video_frames"],
|
||||
@@ -11,24 +13,6 @@ const KINDS: ReadonlyArray<[RegExp, string]> = [
|
||||
[/(^|[\\/])(hf-render-|work-[0-9a-f]{8}-)/, "work_dir"],
|
||||
];
|
||||
|
||||
const quotedPath = (text: string) => /'([^']+)'/.exec(text)?.[1] ?? "";
|
||||
|
||||
function errorChain(error: unknown): Error[] {
|
||||
const chain: Error[] = [];
|
||||
for (let seen = error; seen instanceof Error && chain.length < 5; seen = seen.cause)
|
||||
chain.push(seen);
|
||||
return chain;
|
||||
}
|
||||
|
||||
function missingPathOf(error: unknown): string | undefined {
|
||||
const enoent = errorChain(error).find(
|
||||
(seen) => (seen as NodeJS.ErrnoException).code === "ENOENT",
|
||||
);
|
||||
if (enoent) return (enoent as NodeJS.ErrnoException).path ?? quotedPath(enoent.message);
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return /\bENOENT\b/.test(message) ? quotedPath(message) : undefined;
|
||||
}
|
||||
|
||||
/** Which kind of file a render found missing (a fixed name, never the path), or undefined when nothing was missing. */
|
||||
export function missingPathKind(error: unknown): string | undefined {
|
||||
const path = missingPathOf(error);
|
||||
|
||||
@@ -84,6 +84,7 @@ export function renderObservabilityTelemetryPayload(
|
||||
observabilityExtractVfrPreflightCount: extraction?.vfrPreflightCount,
|
||||
observabilityExtractCacheHits: extraction?.cacheHits,
|
||||
observabilityExtractCacheMisses: extraction?.cacheMisses,
|
||||
observabilityExtractCachePublishFailures: extraction?.cachePublishFailures,
|
||||
observabilityInitDurationMs: init?.initDurationMs,
|
||||
observabilityInitTweenCount: init?.tweenCount,
|
||||
observabilityInitElementCount: init?.elementCount,
|
||||
|
||||
Reference in New Issue
Block a user