Files
hyperframes/packages/cli/src/telemetry/missingPathKind.ts
T
Miguel Ángel cfea8cfff5 fix(producer): a render that fails on a missing file says what was gone (#7955)
* fix(producer): a render that fails on a missing file says what was gone

* fix(producer): a failed look at what was missing never hides the render's own error

The missing-path probe now returns nothing when it throws, reads through at most four links and only
links that point into the temp root or the cache folder, names a removed folder by its own name, treats
a custom cache folder as the cache, and skips programs that could not start.

* refactor(producer): split the missing-path link walk into its own step
2026-11-18 06:36:23 +00:00

22 lines
908 B
TypeScript

import { missingPathOf } from "@hyperframes/core/missing-path";
const KINDS: ReadonlyArray<[RegExp, string]> = [
[/(^|[\\/])hfcache-/, "extract_cache"],
[/(^|[\\/])__hyperframes_video_frames([\\/]|$)/, "video_frames"],
[/(^|[\\/])captured-frames([\\/]|$)/, "captured_frames"],
[
/(^|[\\/])(capture-attempt-\d+|retry-\d+-batch-\d+-worker-\d+|worker-\d+)([\\/]|$)/,
"worker_frames",
],
[/(^|[\\/])capture-calibration/, "calibration"],
[/(^|[\\/])compiled([\\/]|$)/, "compiled"],
[/(^|[\\/])(hf-render-|work-[0-9a-f]{8}-)/, "work_dir"],
];
/** 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);
if (path === undefined) return undefined;
return KINDS.find(([pattern]) => pattern.test(path))?.[1] ?? "other";
}