Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(tests): close the test typecheck gate, and two review nits
Etienne Lescotafe72dedf245
diff --git a/src/components/ai-edition/VirtualPreview.playback.test.tsx b/src/components/ai-edition/VirtualPreview.playback.test.tsxindex 3a56c0266..5dce37785 100644--- a/src/components/ai-edition/VirtualPreview.playback.test.tsx+++ b/src/components/ai-edition/VirtualPreview.playback.test.tsx@@ -183,7 +183,15 @@ describe("VirtualPreview playback across a clip boundary", () => {// while clip_1 plays — the twin keeping the stretch used to answer for it.const clips = [clip("clip_1", "a1", 0, 10, 0), clip("clip_2", "a1", 0, 10, 10)];const trims: AxcutTrimRange[] = [- { id: "trim_1", assetId: "a1", clipId: "clip_1", startSec: 4, endSec: 6 },+ {+ id: "trim_1",+ assetId: "a1",+ clipId: "clip_1",+ startSec: 4,+ endSec: 6,+ origin: "user",+ reason: "",+ },];const { video } = mount(clips, trims);diff --git a/src/components/ai-edition/v4/V4Timeline.tsx b/src/components/ai-edition/v4/V4Timeline.tsxindex 9d905e8d8..268aca40f 100644--- a/src/components/ai-edition/v4/V4Timeline.tsx+++ b/src/components/ai-edition/v4/V4Timeline.tsx@@ -905,24 +905,27 @@ export function V4Timeline({}setAutoBusy(true);try {- // Read once, outside the loop: every clip reserves against the zooms the- // document ALREADY holds, and two clips can never contest the same stretch- // of ruler, so no accumulation across assets is needed.+ // Read once, up front: every clip reserves against the zooms the document+ // ALREADY holds, and two clips can never contest the same stretch of ruler, so+ // nothing here depends on the order the assets are visited — which is what lets+ // their telemetry be fetched concurrently rather than one IPC round trip after+ // another. `Promise.all` preserves input order, so the suggestions come out in+ // the same sequence a loop would have produced.const existingRegions = tl.zoomRegions.map((z) => ({ startMs: z.startMs, endMs: z.endMs }));- const suggestions: AutoZoomSuggestion[] = [];- for (const source of sources) {- const telemetry =- (await nativeBridgeClient.cursor.getTelemetry(fromFileUrl(source.src))) ?? [];- suggestions.push(- ...buildAutoZoomSuggestionsForClips({+ const perSource = await Promise.all(+ sources.map(async (source) => {+ const telemetry =+ (await nativeBridgeClient.cursor.getTelemetry(fromFileUrl(source.src))) ?? [];+ return buildAutoZoomSuggestionsForClips({cursorTelemetry: telemetry,assetId: source.id,clips,existingRegions,defaultDurationMs: 2000,- }),- );- }+ });+ }),+ );+ const suggestions: AutoZoomSuggestion[] = perSource.flat();if (suggestions.length === 0) {toast.info(t("toolbar.noAutoZoomMoments"), {description: t("toolbar.noAutoZoomMomentsDescription"),diff --git a/src/lib/ai-edition/timeline/virtual-preview.test.ts b/src/lib/ai-edition/timeline/virtual-preview.test.tsindex baf08d91c..f3dd64888 100644--- a/src/lib/ai-edition/timeline/virtual-preview.test.ts+++ b/src/lib/ai-edition/timeline/virtual-preview.test.ts@@ -289,7 +289,15 @@ describe("virtual-preview pure functions", () => {},];const playbackClips = resolvePlaybackSegments(rawClips, [- { id: "trim_1", assetId: "a1", clipId: "clip_1", startSec: 4, endSec: 6 },+ {+ id: "trim_1",+ assetId: "a1",+ clipId: "clip_1",+ startSec: 4,+ endSec: 6,+ origin: "user",+ reason: "",+ },]);it("reports source time inside the playing clip's own cut as NOT kept", () => {@@ -449,7 +457,15 @@ describe("virtual-preview pure functions", () => {},];const playbackClips = resolvePlaybackSegments(rawClips, [- { id: "trim_1", assetId: "a1", clipId: "clip_2", startSec: 5, endSec: 10 },+ {+ id: "trim_1",+ assetId: "a1",+ clipId: "clip_2",+ startSec: 5,+ endSec: 10,+ origin: "user",+ reason: "",+ },]);it("resumes after the cut instead of jumping to the top of the timeline", () => {diff --git a/src/lib/ai-edition/timeline/virtual-preview.ts b/src/lib/ai-edition/timeline/virtual-preview.tsindex bdd6aace9..1cdc5d2f6 100644--- a/src/lib/ai-edition/timeline/virtual-preview.ts+++ b/src/lib/ai-edition/timeline/virtual-preview.ts@@ -154,7 +154,15 @@ function isWithinClipBounds(epsilon: number,closingEdge: ClosingEdge,): boolean {- const sourceEnd = clip.sourceEndSec ?? 0;+ // An un-probed clip has no end yet, and `resolvePlaybackSegments` reads that as a+ // zero-width window at the in-point — the same default is used here because+ // `locateKeptSegment` now feeds this function that very output, so the two sit in+ // series and must not read one missing field two ways. (`?? 0` put the window+ // BELOW `sourceStartSec` for a clip starting anywhere but 0, which no source time+ // could ever satisfy. Unreachable in practice — a clip only awaits probing with+ // `sourceStartSec === 0`, where the two defaults coincide — so this changes no+ // behaviour; it removes a divergence, not a bug.)+ const sourceEnd = clip.sourceEndSec ?? clip.sourceStartSec;const upperBound = closingEdge === "inclusive" ? sourceEnd + epsilon : sourceEnd - epsilon;return sourceTimeSec >= clip.sourceStartSec - epsilon && sourceTimeSec <= upperBound;}