Files
hyperframes/packages/engine/src/services/captureWarning.ts
James Russo 9c11715971 fix(audio): preserve subprocess causes through CLI diagnostics (#5620)
* fix(audio): preserve subprocess evidence through CLI diagnostics

* test(producer): retain real engine exports in assembly mock

* fix(audio): retain triggering interruption within diagnostic cap

* fix(producer): sanitize audio evidence before encoder error construction

* test(cli): isolate diagnostic render temporary project
2026-10-14 20:26:59 +00:00

29 lines
1.0 KiB
TypeScript

import type { CaptureWarning } from "../types.js";
/** Clone every mutable field before a warning crosses an async or ownership boundary. */
export function cloneCaptureWarning<T extends CaptureWarning>(warning: T): T {
return {
...warning,
details: warning.details
? {
...warning.details,
audioFailures: warning.details.audioFailures?.map((failure) => ({
...failure,
...(failure.subprocess ? { subprocess: { ...failure.subprocess } } : {}),
})),
sources: warning.details.sources ? [...warning.details.sources] : undefined,
failureReasons: warning.details.failureReasons
? [...warning.details.failureReasons]
: undefined,
failureStages: warning.details.failureStages
? [...warning.details.failureStages]
: undefined,
}
: undefined,
} as T;
}
export function cloneCaptureWarnings<T extends CaptureWarning>(warnings: readonly T[]): T[] {
return warnings.map(cloneCaptureWarning);
}