mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 06:30:03 +00:00
fix(engine): carry programmatic forceScreenshot opt-out to concrete-resolved site
Miguel R3 blocker on #2359: the runtime helper only checked the env opt-out (PRODUCER_FORCE_SCREENSHOT=false), silently defeating the documented programmatic escape hatch (overrides.forceScreenshot === false) on the browserGpuMode:'auto' → software probe path. At the concrete-resolution site the boolean forceScreenshot === false is ambiguous between default and explicit opt-out — resolveConfig sees the provenance but the runtime helper does not. Fix: persist provenance on the resolved config. - New INTERNAL EngineConfig field forceScreenshotExplicitlyOptedOut, set by resolveConfig when EITHER env or programmatic explicit-false is present. Purpose-documented in the type as 'not intended to be set by callers'. - shouldClampToScreenshotForConcreteGpu gains an opts.programmaticOptOut parameter; returns false early when set. Env stays as the third arg (backward compatibility with existing tests). - frameCapture.ts and renderOrchestrator.ts pass config.forceScreenshotExplicitlyOptedOut through at both call sites, so the auto→software probe path preserves the same escape hatches as literal browserGpuMode:'software'. New tests: 5 additional cases across the helper (programmatic opt-out alone; programmatic beats missing env) and resolveConfig provenance (programmatic sets flag; env sets flag; neither leaves it undefined). Local: 61/61 engine config tests pass (was 56).
This commit is contained in:
@@ -825,9 +825,16 @@ export async function createCaptureSession(
|
||||
// point too — `resolveConfig` can only see the pre-resolve `browserGpuMode`
|
||||
// string, so `"auto"` that probes to software would otherwise slip through
|
||||
// and launch BeginFrame + SwiftShader (the exact combination the invariant
|
||||
// is meant to prevent). Env-level opt-out preserved via the shared helper.
|
||||
// is meant to prevent). Both env and programmatic opt-outs preserved via
|
||||
// the shared helper (the programmatic one carried on the config as
|
||||
// `forceScreenshotExplicitlyOptedOut`, since at this point the boolean
|
||||
// `forceScreenshot === false` is otherwise ambiguous between default and
|
||||
// explicit opt-out).
|
||||
const effectiveForceScreenshot =
|
||||
forceScreenshot || shouldClampToScreenshotForConcreteGpu(resolvedGpuMode, forceScreenshot);
|
||||
forceScreenshot ||
|
||||
shouldClampToScreenshotForConcreteGpu(resolvedGpuMode, forceScreenshot, process.env, {
|
||||
programmaticOptOut: config?.forceScreenshotExplicitlyOptedOut ?? false,
|
||||
});
|
||||
const preMode: CaptureMode =
|
||||
headlessShell &&
|
||||
isLinux &&
|
||||
|
||||
Reference in New Issue
Block a user