Skip to content

Commit 4d87f8b

Browse files
fix(producer): enforce video extraction failures by default (#3372) (#3526)
The extraction failure policy defaulted to "off", silently swallowing per-source errors. The plumbing to surface them (typed error, retryable classification, caller throw) was fully built but gated behind an env-var opt-in. Flip the default to "enforce" so extraction failures fail the render instead of producing misleading coverage aborts. Set HF_VIDEO_EXTRACTION_FAILURE_MODE=off to restore the old behavior. Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com>
1 parent 9eb84c9 commit 4d87f8b

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

packages/producer/src/services/render/stages/extractVideosStage.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ describe("shouldCopyExtractedFrames", () => {
205205
});
206206

207207
describe("resolveVideoExtractionPolicy", () => {
208-
it("preserves stable behavior by default", () => {
208+
it("enforces extraction failures by default (#3372)", () => {
209209
expect(resolveVideoExtractionPolicy({})).toEqual({
210-
failureMode: "off",
210+
failureMode: "enforce",
211211
maxTransientRetries: 0,
212212
});
213213
});
214214

215-
it("allows only the bounded candidate rollout values", () => {
215+
it("allows explicit opt-out or observe mode", () => {
216216
expect(
217217
resolveVideoExtractionPolicy({
218218
HF_VIDEO_EXTRACTION_FAILURE_MODE: "observe",
@@ -221,10 +221,15 @@ describe("resolveVideoExtractionPolicy", () => {
221221
).toEqual({ failureMode: "observe", maxTransientRetries: 1 });
222222
expect(
223223
resolveVideoExtractionPolicy({
224-
HF_VIDEO_EXTRACTION_FAILURE_MODE: "unexpected",
225-
HF_VIDEO_EXTRACTION_MAX_RETRIES: "1",
224+
HF_VIDEO_EXTRACTION_FAILURE_MODE: "off",
226225
}),
227226
).toEqual({ failureMode: "off", maxTransientRetries: 0 });
227+
expect(
228+
resolveVideoExtractionPolicy({
229+
HF_VIDEO_EXTRACTION_FAILURE_MODE: "enforce",
230+
HF_VIDEO_EXTRACTION_MAX_RETRIES: "1",
231+
}),
232+
).toEqual({ failureMode: "enforce", maxTransientRetries: 1 });
228233
});
229234
});
230235

packages/producer/src/services/render/stages/extractVideosStage.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,17 @@ export interface VideoExtractionPolicy {
131131
}
132132

133133
/**
134-
* Candidate-lane rollout controls. Stable behavior remains unchanged unless
135-
* explicitly enabled in the producer environment.
134+
* Extraction failure policy. Defaults to `enforce` so per-source errors
135+
* surface as render failures instead of being silently swallowed (#3372).
136+
* Set `HF_VIDEO_EXTRACTION_FAILURE_MODE=off` to restore the old silent
137+
* behavior, or `observe` to log without failing.
136138
*/
137139
export function resolveVideoExtractionPolicy(
138140
env: Readonly<Record<string, string | undefined>> = process.env,
139141
): VideoExtractionPolicy {
140142
const rawMode = env.HF_VIDEO_EXTRACTION_FAILURE_MODE?.trim().toLowerCase();
141143
const failureMode: VideoExtractionFailureMode =
142-
rawMode === "observe" || rawMode === "enforce" ? rawMode : "off";
144+
rawMode === "observe" || rawMode === "off" ? rawMode : "enforce";
143145
const maxTransientRetries =
144146
failureMode !== "off" && env.HF_VIDEO_EXTRACTION_MAX_RETRIES?.trim() === "1" ? 1 : 0;
145147
return { failureMode, maxTransientRetries };

0 commit comments

Comments
 (0)