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
feat(format): make Auto the default for new projects
EtienneLescot89c3d53b36c0
diff --git a/electron/ai-edition/document-service.test.ts b/electron/ai-edition/document-service.test.tsindex 5951c9090..04e3b763c 100644--- a/electron/ai-edition/document-service.test.ts+++ b/electron/ai-edition/document-service.test.ts@@ -29,9 +29,9 @@ describe("DocumentService", () => {});describe("createProject", () => {- it("creates a v7 doc with the given title and writes it to disk", async () => {+ it("creates a v8 doc with the given title and writes it to disk", async () => {const doc = await service.createProject("Demo Project");- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect(doc.project.title).toBe("Demo Project");expect(doc.project.id).toMatch(/^proj_/);expect(doc.assets).toEqual([]);diff --git a/src/cli/CliRecordRunner.tsx b/src/cli/CliRecordRunner.tsxindex be04ab043..b7325120b 100644--- a/src/cli/CliRecordRunner.tsx+++ b/src/cli/CliRecordRunner.tsx@@ -9,6 +9,7 @@ import {} from "@/components/video-editor/projectPersistence";import { useScreenRecorder } from "@/hooks/useScreenRecorder";import type { CliRecordRequest } from "@/lib/cliContracts";+import { DEFAULT_PROJECT_APPEARANCE } from "@/lib/projectDefaults";type Phase = "init" | "recording" | "stopping" | "done";@@ -91,7 +92,8 @@ function buildDefaultProject(session: {...(session.webcamVideoPath ? { webcamVideoPath: session.webcamVideoPath } : {}),...(session.cursorCaptureMode ? { cursorCaptureMode: session.cursorCaptureMode } : {}),},- editor: normalizeProjectEditor({}),+ // A new project: it takes the current default format rather than the v2 reading of none.+ editor: normalizeProjectEditor({ aspectRatio: DEFAULT_PROJECT_APPEARANCE.aspectRatio }),};}diff --git a/src/components/ai-edition/CaptionsPane.gating.test.tsx b/src/components/ai-edition/CaptionsPane.gating.test.tsxindex 5eee1b595..6c45674b5 100644--- a/src/components/ai-edition/CaptionsPane.gating.test.tsx+++ b/src/components/ai-edition/CaptionsPane.gating.test.tsx@@ -23,7 +23,7 @@ vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));function documentWith(asset: AxcutAsset): AxcutDocument {return {- schemaVersion: 7,+ schemaVersion: 8,project: {id: "proj_1",title: "Test",diff --git a/src/components/ai-edition/CaptionsPane.placement.test.tsx b/src/components/ai-edition/CaptionsPane.placement.test.tsxindex f1ab095ac..c6b890ec3 100644--- a/src/components/ai-edition/CaptionsPane.placement.test.tsx+++ b/src/components/ai-edition/CaptionsPane.placement.test.tsx@@ -33,7 +33,7 @@ const ASSET: AxcutAsset = {function documentWith(captions: Record<string, unknown>): AxcutDocument {return {- schemaVersion: 7,+ schemaVersion: 8,project: {id: "proj_1",title: "Test",diff --git a/src/components/ai-edition/EditorEmptyState.test.tsx b/src/components/ai-edition/EditorEmptyState.test.tsxindex b7d4902a0..681b6d8ec 100644--- a/src/components/ai-edition/EditorEmptyState.test.tsx+++ b/src/components/ai-edition/EditorEmptyState.test.tsx@@ -33,7 +33,7 @@ const sampleDoc = vi.hoisted(// imports are initialised, so reading the constant here throws// "Cannot access ... before initialization". The typecheck gate catches it// if it ever falls behind the schema.- schemaVersion: 7,+ schemaVersion: 8,project: {id: "proj_test",title: "Test",diff --git a/src/components/ai-edition/TranscriptPane.lanes.test.tsx b/src/components/ai-edition/TranscriptPane.lanes.test.tsxindex e84868f3e..e690a1352 100644--- a/src/components/ai-edition/TranscriptPane.lanes.test.tsx+++ b/src/components/ai-edition/TranscriptPane.lanes.test.tsx@@ -96,7 +96,7 @@ function mount(audioTracks: AxcutAudioTrack[]) {useProjectStore.setState({projectId: "proj_1",document: {- schemaVersion: 7,+ schemaVersion: 8,project: {id: "proj_1",title: "T",diff --git a/src/components/video-editor/editorDefaults.ts b/src/components/video-editor/editorDefaults.tsindex 3a4b37369..72028e8ec 100644--- a/src/components/video-editor/editorDefaults.ts+++ b/src/components/video-editor/editorDefaults.ts@@ -53,6 +53,9 @@ export const DEFAULT_EDITOR_LAYOUT_SETTINGS: {wallpaper: string;} = {padding: 50,+ // What a v2 project file means when it states no ratio. Every such file predates Auto, so+ // the answer stays 16:9 for good, as the v8 upgrader pins it for documents. New projects+ // state their ratio instead (see CliRecordRunner).aspectRatio: "16:9",cropRegion: DEFAULT_CROP_REGION,wallpaper: DEFAULT_WALLPAPER,diff --git a/src/lib/ai-edition/captions/captionLane.test.ts b/src/lib/ai-edition/captions/captionLane.test.tsindex dfc3f5d88..4bec43233 100644--- a/src/lib/ai-edition/captions/captionLane.test.ts+++ b/src/lib/ai-edition/captions/captionLane.test.ts@@ -62,7 +62,7 @@ function words(assetId: string, texts: string[]): AxcutTranscript {function doc(over: Partial<AxcutDocument> = {}): AxcutDocument {return {- schemaVersion: 7,+ schemaVersion: 8,project: {id: "p",title: "T",diff --git a/src/lib/ai-edition/document/audioLanes.test.ts b/src/lib/ai-edition/document/audioLanes.test.tsindex 53df11c9d..9e8b3645f 100644--- a/src/lib/ai-edition/document/audioLanes.test.ts+++ b/src/lib/ai-edition/document/audioLanes.test.ts@@ -51,7 +51,7 @@ function track(over: Partial<AxcutAudioTrack> & { id: string }): AxcutAudioTrackfunction doc(audioTracks: AxcutAudioTrack[]): AxcutDocument {return {- schemaVersion: 7,+ schemaVersion: 8,project: { id: "p", title: "T", createdAt: "", updatedAt: "" },assets: [],transcript: null,diff --git a/src/lib/ai-edition/document/migrate.test.ts b/src/lib/ai-edition/document/migrate.test.tsindex 6b0e3aef4..681cf64e2 100644--- a/src/lib/ai-edition/document/migrate.test.ts+++ b/src/lib/ai-edition/document/migrate.test.ts@@ -51,7 +51,7 @@ describe("migrateProjectDataToAxcutDocument", () => {it("produces a current-schema document with one asset and one clip from a v2 single-recording project", () => {const doc = migrateProjectDataToAxcutDocument(makeV2Project());- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect(doc.assets).toHaveLength(1);const asset = doc.assets[0];expect(asset.kind).toBe("video");@@ -498,7 +498,7 @@ describe("migrateRawDocumentToCurrent", () => {};}- it("upgrades a v3 document to v7 (cameraTrack relocated onto the primary asset)", () => {+ it("upgrades a v3 document to v8 (cameraTrack relocated onto the primary asset)", () => {// Models the full load path: every disk-read site runs the helper, then// the schema parse fills in defaults (cameraTrack: null on non-target// assets). The helper alone is just the upgrader chain; the schema is@@ -516,13 +516,13 @@ describe("migrateRawDocumentToCurrent", () => {}),),);- expect(migrated.schemaVersion).toBe(7);+ expect(migrated.schemaVersion).toBe(8);expect((migrated as Record<string, unknown>).cameraTrack).toBeUndefined();expect(migrated.assets[0].cameraTrack).toBeNull();expect(migrated.assets[1].cameraTrack?.sourcePath).toBe("/cam.mp4");});- it("upgrades a v4 document to v7 (anchors modifiers onto clips)", () => {+ it("upgrades a v4 document to v8 (anchors modifiers onto clips)", () => {const migrated = migrateRawDocumentToCurrent(makeV4Doc({zoomRanges: [@@ -530,7 +530,7 @@ describe("migrateRawDocumentToCurrent", () => {],}),) as Record<string, unknown>;- expect(migrated.schemaVersion).toBe(7);+ expect(migrated.schemaVersion).toBe(8);const zooms = migrated.zoomRanges as Array<Record<string, unknown>>;expect(zooms).toHaveLength(1);expect(zooms[0]).toMatchObject({ id: "z1", clipId: "c1", depth: 3 });@@ -538,12 +538,12 @@ describe("migrateRawDocumentToCurrent", () => {it("is a no-op for an already-current document (returns an equal value)", () => {const v5 = makeV4Doc(); // makeV4Doc's body is the v5-compatible shape- const once = migrateRawDocumentToCurrent({ ...v5, schemaVersion: 7 });+ const once = migrateRawDocumentToCurrent({ ...v5, schemaVersion: 8 });// ponytail: the upgrader chain checks schemaVersion and returns the input// unchanged, so the round-trip allocation is bounded to a property// comparison per upgrader — the same per-parse overhead the old// `z.preprocess` carried.- expect(once).toEqual({ ...v5, schemaVersion: 7 });+ expect(once).toEqual({ ...v5, schemaVersion: 8 });});it("passes non-document input through unchanged (the schema is the gate, not this helper)", () => {@@ -596,7 +596,7 @@ describe("dropping trims anchored to audio", () => {function docWith(trimRanges: unknown[], assets?: unknown[]) {return {- schemaVersion: 7,+ schemaVersion: 8,project: { id: "p", title: "t", createdAt, updatedAt: createdAt },assets: assets ?? [{ id: "vid", kind: "video", label: "v", originalPath: "/v.mp4", cameraTrack: null },@@ -736,7 +736,7 @@ describe("repairing inverted transcript timings", () => {],};return {- schemaVersion: 7,+ schemaVersion: 8,project: { id: "p", title: "t", createdAt, updatedAt: createdAt },assets: [{ id: "vid", kind: "video", label: "v", originalPath: "/v.mp4", cameraTrack: null }],transcript,diff --git a/src/lib/ai-edition/schema/index.test.ts b/src/lib/ai-edition/schema/index.test.tsindex c53bfae9f..57de1df50 100644--- a/src/lib/ai-edition/schema/index.test.ts+++ b/src/lib/ai-edition/schema/index.test.ts@@ -14,12 +14,13 @@ import {rangeSchema,timelineSchema,trimRangeSchema,+ upgradeV7DocumentToV8,zoomRegionSchema,} from "./index";-describe("axcut-schema v7", () => {- it("uses schema version 7", () => {- expect(axcutSchemaVersion).toBe(7);+describe("axcut-schema v8", () => {+ it("uses schema version 8", () => {+ expect(axcutSchemaVersion).toBe(8);});it("rejects unknown schema versions", () => {@@ -31,9 +32,9 @@ describe("axcut-schema v7", () => {).toThrow();});- it("createEmptyDocument returns a valid v7 doc with empty collections", () => {+ it("createEmptyDocument returns a valid v8 doc with empty collections", () => {const doc = createEmptyDocument({ projectId: "proj_1", title: "Demo" });- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect(doc.assets).toEqual([]);expect(doc.timeline.clips).toEqual([]);expect(doc.timeline.trimRanges).toEqual([]);@@ -216,7 +217,7 @@ describe("axcut-schema v7", () => {it("documentSchema defaults missing v3 envelopes on a v3 document", () => {// After the migration hoist, a v3 doc must run through// `migrateRawDocumentToCurrent` first; this models the new load-time- // contract: the schema parse is a pure v7 validation step.+ // contract: the schema parse is a pure v8 validation step.expect(() =>documentSchema.parse(migrateRawDocumentToCurrent({@@ -270,13 +271,13 @@ describe("axcut-schema v7", () => {it("relocates a legacy top-level cameraTrack onto the primaryAssetId asset", () => {// After the migration hoist, v3 input runs through the load-time- // upgrader before the pure v7 schema parse.+ // upgrader before the pure v8 schema parse.const doc = documentSchema.parse(migrateRawDocumentToCurrent(v3Doc({ project: { ...v3Doc().project, primaryAssetId: "asset_2" } }),),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc as Record<string, unknown>).cameraTrack).toBeUndefined();expect(doc.assets.find((a) => a.id === "asset_1")?.cameraTrack).toBeNull();expect(doc.assets.find((a) => a.id === "asset_2")?.cameraTrack?.sourcePath).toBe("/cam.mp4");@@ -290,7 +291,7 @@ describe("axcut-schema v7", () => {it("is a no-op when the v3 document has no legacy cameraTrack", () => {const doc = documentSchema.parse(migrateRawDocumentToCurrent(v3Doc({ cameraTrack: null })));- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);for (const asset of doc.assets) {expect(asset.cameraTrack).toBeNull();}@@ -298,7 +299,7 @@ describe("axcut-schema v7", () => {it("rejects schemaVersion 2 (the load-time helper only upgrades v3/v4)", () => {// The pre-hoist schema auto-upgraded v3 inside its `z.preprocess`;- // the post-hoist schema is a pure v7 validator, and the helper+ // the post-hoist schema is a pure v8 validator, and the helper// only handles v3/v4. v2 still requires the separate// `migrateProjectDataToAxcutDocument` pure function.expect(() => documentSchema.parse(v3Doc({ schemaVersion: 2 }))).toThrow();@@ -426,7 +427,7 @@ describe("v4 -> v5 clip-anchored modifier migration", () => {it("bumps the version and anchors a zoom wholly inside one clip", () => {// After the migration hoist, v4 input runs through the load-time- // upgrader before the pure v7 schema parse.+ // upgrader before the pure v8 schema parse.const doc = documentSchema.parse(migrateRawDocumentToCurrent(makeV4Doc({@@ -436,7 +437,7 @@ describe("v4 -> v5 clip-anchored modifier migration", () => {}),),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect(doc.zoomRanges).toHaveLength(1);const z = doc.zoomRanges[0];expect(z).toMatchObject({ id: "z1", clipId: "clip_a", depth: 3 });@@ -504,7 +505,7 @@ describe("v4 -> v5 clip-anchored modifier migration", () => {expect(doc.zoomRanges[0].clipId).toBeUndefined();});- it("is idempotent — re-parsing an already-v7 document changes nothing", () => {+ it("is idempotent — re-parsing an already-v8 document changes nothing", () => {// First call: v4 input → load-time upgrade → v7.const once = documentSchema.parse(migrateRawDocumentToCurrent(@@ -516,7 +517,7 @@ describe("v4 -> v5 clip-anchored modifier migration", () => {),);// Second call: already-current input, no upgrade needed; the parse is now a- // pure v7 validation step.+ // pure v8 validation step.const twice = documentSchema.parse(once);expect(twice).toEqual(once);});@@ -573,7 +574,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {}),),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("16:9");});@@ -630,7 +631,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {legacyEditor: { aspectRatio: "native" },}),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("9:16");});@@ -641,7 +642,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {const doc = documentSchema.parse(migrateRawDocumentToCurrent(makeV5Doc({ legacyEditor: { aspectRatio: "native" } })),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("native");});@@ -649,28 +650,28 @@ describe("v5 -> v6 native AspectRatio migration", () => {const doc = documentSchema.parse(migrateRawDocumentToCurrent(makeV5Doc({ legacyEditor: { aspectRatio: "4:5" } })),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("4:5");});- it("passes through a legacyEditor without aspectRatio unchanged", () => {+ it("passes through a legacyEditor without aspectRatio, which v8 then pins to 16:9", () => {const doc = documentSchema.parse(migrateRawDocumentToCurrent(makeV5Doc({ legacyEditor: { someOtherField: "preserved" } })),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);const legacy = doc.legacyEditor as Record<string, unknown>;expect(legacy.someOtherField).toBe("preserved");- expect(legacy.aspectRatio).toBeUndefined();+ expect(legacy.aspectRatio).toBe("16:9");});- it("passes through a v5 doc with no legacyEditor at all (only the version bumps)", () => {+ it("passes through a v5 doc with no legacyEditor at all, which v8 then pins to 16:9", () => {const v5 = makeV5Doc();const doc = documentSchema.parse(migrateRawDocumentToCurrent(v5));- expect(doc.schemaVersion).toBe(7);- expect(doc.legacyEditor).toBeNull();+ expect(doc.schemaVersion).toBe(8);+ expect(doc.legacyEditor).toEqual({ aspectRatio: "16:9" });});- it("is idempotent — re-parsing an already-v7 document changes nothing", () => {+ it("is idempotent — re-parsing an already-v8 document changes nothing", () => {const once = documentSchema.parse(migrateRawDocumentToCurrent(makeV5Doc({ legacyEditor: { aspectRatio: "16:9" } })),);@@ -720,7 +721,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {legacyEditor: { aspectRatio: "native" },}),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("native");});@@ -762,7 +763,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {legacyEditor: { aspectRatio: "native" },}),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("9:16");});@@ -806,7 +807,7 @@ describe("v5 -> v6 native AspectRatio migration", () => {legacyEditor: { aspectRatio: "native" },}),);- expect(doc.schemaVersion).toBe(7);+ expect(doc.schemaVersion).toBe(8);expect((doc.legacyEditor as Record<string, unknown>).aspectRatio).toBe("8:9");});});@@ -876,7 +877,7 @@ describe("v6 -> v7 trim clip-anchor migration", () => {[{ id: "t1", assetId: "asset_1", startSec: 3, endSec: 5, origin: "user", reason: "" }],),);- expect((out as Record<string, unknown>).schemaVersion).toBe(7);+ expect((out as Record<string, unknown>).schemaVersion).toBe(8);expect(trimsOf(out)).toEqual([{id: "t1",@@ -1080,3 +1081,34 @@ describe("audio tracks (issue #350)", () => {expect(parsed.audioTracks).toEqual([track]);});});++// --- v7 -> v8 : Auto becomes the default ratio ---------------------------------++describe("v7 -> v8 default ratio pin", () => {+ const v7Doc = (legacyEditor: Record<string, unknown> | null) => ({+ ...createEmptyDocument({ projectId: "p", title: "t" }),+ schemaVersion: 7,+ legacyEditor,+ });+ const ratioOf = (raw: unknown) =>+ ((raw as Record<string, unknown>).legacyEditor as Record<string, unknown>).aspectRatio;++ it("pins 16:9 on a document that never chose a ratio, so it keeps its frame", () => {+ expect(ratioOf(upgradeV7DocumentToV8(v7Doc(null)))).toBe("16:9");+ const out = upgradeV7DocumentToV8(v7Doc({ padding: 20 })) as Record<string, unknown>;+ expect(out.schemaVersion).toBe(8);+ expect(out.legacyEditor).toEqual({ padding: 20, aspectRatio: "16:9" });+ });++ it("keeps a ratio the document already states", () => {+ for (const aspectRatio of ["9:16", "683:384", "auto", "native"]) {+ expect(ratioOf(upgradeV7DocumentToV8(v7Doc({ aspectRatio })))).toBe(aspectRatio);+ }+ });++ it("leaves a current document alone, so a new project keeps reading the Auto default", () => {+ const fresh = createEmptyDocument({ projectId: "p", title: "t" });+ expect(upgradeV7DocumentToV8(fresh)).toBe(fresh);+ expect(fresh.legacyEditor).toBeNull();+ });+});diff --git a/src/lib/ai-edition/schema/index.ts b/src/lib/ai-edition/schema/index.tsindex b92ea4c00..8f1484151 100644--- a/src/lib/ai-edition/schema/index.ts+++ b/src/lib/ai-edition/schema/index.ts@@ -38,7 +38,10 @@ import { anchorRegionsWithDerivedMs } from "../timeline/timelineMap";// made them AMBIGUOUS the moment two clips drew from the same asset (a// duplicated clip): every reader either matched both clips or picked the// first. See `upgradeV6DocumentToV7`.-export const axcutSchemaVersion = 7;+// 7. v8 — Auto becomes the default AspectRatio. A document that never chose a+// ratio stores none and reads the default, so the upgrader pins the one it+// has always shown, 16:9. See `upgradeV7DocumentToV8`.+export const axcutSchemaVersion = 8;// ponytail: every region schema shares the same monotonicity rule// (end >= start) with the same error shape. Factor the refine so the@@ -874,6 +877,31 @@ export function upgradeV6DocumentToV7(raw: unknown): unknown {return { ...doc, schemaVersion: 7, timeline: { ...timeline, trimRanges: anchored } };}+/**+ * v7 → v8 — Auto becomes the default AspectRatio, and older documents keep their frame.+ *+ * A project whose user never opened the ratio menu stores no `aspectRatio` at all: every+ * reader falls back to the default (`getEditorSettings`). Changing that default would+ * therefore reshape every such project on its next open, which is the silent drift v6+ * removed for `"native"`. So the value those documents have always shown, 16:9, is written+ * down; only documents created from v8 on take the new default.+ *+ * Mirrors the read: `getEditorSettings` takes any stored value as is, so only a missing one+ * (no envelope, or no key) is pinned.+ */+export function upgradeV7DocumentToV8(raw: unknown): unknown {+ if (!raw || typeof raw !== "object") return raw;+ const doc = raw as Record<string, unknown>;+ if (doc.schemaVersion !== 7) return raw;++ const legacy =+ doc.legacyEditor && typeof doc.legacyEditor === "object" && !Array.isArray(doc.legacyEditor)+ ? (doc.legacyEditor as Record<string, unknown>)+ : null;+ if (legacy?.aspectRatio != null) return { ...doc, schemaVersion: 8 };+ return { ...doc, schemaVersion: 8, legacyEditor: { ...legacy, aspectRatio: "16:9" } };+}+/*** Runs the whole upgrade chain on a raw, untrusted value. Idempotent: each step* is gated on an exact `schemaVersion`, so an already-current document passes@@ -984,20 +1012,22 @@ function raiseInvertedTranscriptEnds(raw: unknown): unknown {export function migrateRawDocumentToCurrent(raw: unknown): unknown {return raiseInvertedTranscriptEnds(dropAudioAnchoredTrims(- upgradeV6DocumentToV7(- upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),+ upgradeV7DocumentToV8(+ upgradeV6DocumentToV7(+ upgradeV5DocumentToV6(upgradeV4DocumentToV5(upgradeV3DocumentToV4(raw))),+ ),),),);}-// PURE v7 validation. Callers that read a document from disk (or any other+// PURE v8 validation. Callers that read a document from disk (or any other// source that might carry an older `schemaVersion`) MUST run// `migrateRawDocumentToCurrent` on the raw value first. The previous// implementation wrapped this schema in a `z.preprocess` that re-ran the whole-// v3→…→v7 chain on EVERY parse, including in-memory parses of documents that+// v3→…→v8 chain on EVERY parse, including in-memory parses of documents that// were already current. Hoisting it to load time makes the in-memory parse a-// single `z.literal(7)` + shape check.+// single `z.literal(8)` + shape check.export const documentSchema = documentSchemaShape;export const createProjectInputSchema = z.object({diff --git a/src/lib/ai-edition/store/editorSettings.test.ts b/src/lib/ai-edition/store/editorSettings.test.tsindex 97f56007c..e4eeefac2 100644--- a/src/lib/ai-edition/store/editorSettings.test.ts+++ b/src/lib/ai-edition/store/editorSettings.test.ts@@ -39,7 +39,8 @@ describe("getEditorSettings", () => {it("returns the defaults when the document has no legacyEditor", () => {const snap = getEditorSettings(baseDoc);expect(snap.wallpaper).toBe(DEFAULT_EDITOR_SETTINGS.wallpaper);- expect(snap.aspectRatio).toBe("16:9");+ // A new project stores no ratio and reads Auto; older documents had 16:9 pinned by v8.+ expect(snap.aspectRatio).toBe("auto");expect(snap.shadowIntensity).toBe(DEFAULT_EDITOR_SETTINGS.shadowIntensity);expect(snap.showBlur).toBe(false);expect(snap.webcamLayoutPreset).toBe(DEFAULT_WEBCAM_LAYOUT_PRESET);diff --git a/src/lib/ai-edition/store/projectStore.test.ts b/src/lib/ai-edition/store/projectStore.test.tsindex 175e9dc71..b49bae656 100644--- a/src/lib/ai-edition/store/projectStore.test.ts+++ b/src/lib/ai-edition/store/projectStore.test.ts@@ -53,7 +53,7 @@ const sampleDoc = {// LITERAL 7, and an unannotated object literal widens it to `number` — so// every `document: sampleDoc` below fails to type-check for a fixture that// is, in fact, exactly right.- schemaVersion: 7 as const,+ schemaVersion: 8 as const,project: {id: "proj_test",title: "Test",diff --git a/src/lib/ai-edition/store/transcriptionStore.test.ts b/src/lib/ai-edition/store/transcriptionStore.test.tsindex 4190b937f..f58291e41 100644--- a/src/lib/ai-edition/store/transcriptionStore.test.ts+++ b/src/lib/ai-edition/store/transcriptionStore.test.ts@@ -45,7 +45,7 @@ function asset(id: string, extra: Record<string, unknown> = {}) {function makeDoc(assetIds: string[], projectId = "proj_1"): AxcutDocument {return {- schemaVersion: 7,+ schemaVersion: 8,project: {id: projectId,title: "Test",diff --git a/src/lib/ai-edition/transcription/status.test.ts b/src/lib/ai-edition/transcription/status.test.tsindex 895812533..442322d8a 100644--- a/src/lib/ai-edition/transcription/status.test.ts+++ b/src/lib/ai-edition/transcription/status.test.ts@@ -259,7 +259,7 @@ describe("resolveTranscriptGate", () => {});const base = {- schemaVersion: 7 as const,+ schemaVersion: 8 as const,project: {id: "proj_1",title: "T",diff --git a/src/lib/projectDefaults.ts b/src/lib/projectDefaults.tsindex 1951cbfc0..baab573f8 100644--- a/src/lib/projectDefaults.ts+++ b/src/lib/projectDefaults.ts@@ -70,7 +70,7 @@ export interface ProjectAppearanceDefaults {frame: RecordingFrame;/** Light or dark, for whichever frame is on. Inert with `frame: "none"`. */frameTheme: FrameTheme;- aspectRatio: `${number}:${number}` | "native";+ aspectRatio: `${number}:${number}` | "auto" | "native";shadowIntensity: number;showBlur: boolean;motionBlurAmount: number;@@ -108,7 +108,9 @@ export const DEFAULT_PROJECT_APPEARANCE: ProjectAppearanceDefaults = {wallpaperMotion: "none",frame: "none",frameTheme: "light",- aspectRatio: "16:9",+ // Auto: the frame follows the recording, its crop, the camera layout and the padding.+ // Documents from before it stored no ratio and read 16:9; the v8 upgrader pins that.+ aspectRatio: "auto",shadowIntensity: 0.2,showBlur: false,motionBlurAmount: 0.2,diff --git a/technical-documentation/architecture/document-model.md b/technical-documentation/architecture/document-model.mdindex ea5e76c88..f9cd5fd93 100644--- a/technical-documentation/architecture/document-model.md+++ b/technical-documentation/architecture/document-model.md@@ -11,15 +11,15 @@ the contract.## `schemaVersion` and top-level shape-`axcutSchemaVersion` is **7** — exported as a literal at the top of+`axcutSchemaVersion` is **8** — exported as a literal at the top of`src/lib/ai-edition/schema/index.ts`. Every document on disk carries-`schemaVersion: 7`; anything older is upgraded on parse (see [Migrations](#migrations))+`schemaVersion: 8`; anything older is upgraded on parse (see [Migrations](#migrations))and anything unknown is rejected by the `z.literal(axcutSchemaVersion)` check in`documentSchemaShape`.| Field | Holds | Notes ||---|---|---|-| `schemaVersion` | `7` | Bumping requires a migration; see the chain below. |+| `schemaVersion` | `8` | Bumping requires a migration; see the chain below. || `project` | `{ id, title, createdAt, updatedAt, primaryAssetId? }` | One project per file. || `assets[]` | `AxcutAsset` (one per recorded/imported media file) | Carries `originalPath`, `cameraTrack`, `durationSec` (renderer probes). || `transcript` | `AxcutTranscript \| null` | Legacy primary transcript; left for back-compat, no longer the source of truth. |@@ -40,14 +40,14 @@ Migrations are **one-way and forward-only**. There is no version downgrade path:newer document that lands on an older build is rejected by the `schemaVersion`literal, not silently truncated. The chain runs **at load time** through`migrateRawDocumentToCurrent` (`src/lib/ai-edition/document/migrate.ts`) — the-upgraders compose the chain and `documentSchema.parse` is a pure v7 validator.+upgraders compose the chain and `documentSchema.parse` is a pure v8 validator.Every JSON-read site (`DocumentService`, the browser shim, the renderer's`handleBrowseProject` / `openLoadedProject` disk-load paths) must call thehelper before `documentSchema.parse`. The pre-hoist implementation wrapped thischain in a `z.preprocess`, so it ran on every `setDocument` / `saveDocument` /`loadProject` parse — measurable per-parse overhead on documents that werealready current. Hoisting it to load time makes the in-memory parse a single-`z.literal(7)` + shape check on already-upgraded data.+`z.literal(8)` + shape check on already-upgraded data.### v3 → v4 (`upgradeV3DocumentToV4`, `schema/index.ts`)@@ -120,6 +120,21 @@ intervals, outside every clip by construction), and an unprobed clip has no realwindow to clamp against so its trims stay un-anchored. Un-anchored trims keep thepre-v7 asset-wide meaning, which is what makes the fallback lossless.+### v7 → v8 (`upgradeV7DocumentToV8`, `schema/index.ts`)++v8 makes **Auto** the default AspectRatio. A document whose user never opened the+ratio menu stores no `legacyEditor.aspectRatio`: every reader falls back to the+default (`getEditorSettings`). Changing the default alone would reshape all of those+projects on their next open, so the upgrader writes down the frame they have always+shown, `"16:9"`. It pins only a **missing** value (no envelope, or no key), which is+exactly what the read would have defaulted; any stored ratio, `"native"` included, is+left alone. Documents created from v8 on store none and read Auto.++The legacy v2 format keeps the same reading: `normalizeProjectEditor` fills a missing+ratio with `"16:9"` (`DEFAULT_EDITOR_LAYOUT_SETTINGS`), since every v2 file predates+Auto. The one producer of new v2 files, `openscreen record --project`, states Auto+explicitly.+### Legacy v2 → current (`migrateProjectDataToAxcutDocument`, `document/migrate.ts`)OpenScreen's pre-merge editor stored projects as `EditorProjectData` (an envelope