Skip to content

Write HTML. Render video. Built for agents.

refactor(studio): drop recordEdit's kind, which the project history never read (#4474)

Miguel Ángel828c434f7600
diff --git a/packages/studio-server/src/history/projectHistory.ts b/packages/studio-server/src/history/projectHistory.ts
index bb982aacab..c6ed9cb437 100644
--- a/packages/studio-server/src/history/projectHistory.ts
+++ b/packages/studio-server/src/history/projectHistory.ts
@@ -341,7 +341,7 @@ class Engine {
for (const [window, paths] of cut) await this.commitCut(window, paths);
}
- /** The held claim `taken` continues: same key, each change starting where the claim's own left off (no one between). */
+ /** The held claim `taken` continues: same key, each file from its own last change, no held file changed since. */
heldFor(key: string | undefined, taken: readonly HistoryFileChange[]): Group | null {
const group = key && this.claimed?.key === key ? this.claimed.group : null;
const after = (path: string, before: string | null) => {
diff --git a/packages/studio/src/components/StudioRightPanels.types.ts b/packages/studio/src/components/StudioRightPanels.types.ts
index 058f1b046e..a8a5f227ef 100644
--- a/packages/studio/src/components/StudioRightPanels.types.ts
+++ b/packages/studio/src/components/StudioRightPanels.types.ts
@@ -9,7 +9,6 @@
import type { StudioEditPersistenceProps } from "./panels/VariablesPanel";
import type { BlockParam } from "@hyperframes/core/registry";
import type { Composition } from "@hyperframes/sdk";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { UseSlideshowPersistParams } from "../hooks/useSlideshowPersist";
import type { AddMediaOverlayHandler } from "./editor/propertyPanelTypes";
import type { ToggleHiddenHandler } from "../utils/studioHelpers";
@@ -46,7 +45,6 @@ export interface StudioRightPanelsProps extends StudioEditPersistenceProps {
reloadPreview: () => void;
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
onToggleElementHidden?: ToggleHiddenHandler;
diff --git a/packages/studio/src/components/nle/useCanvasZOrderTimelineMirror.test.tsx b/packages/studio/src/components/nle/useCanvasZOrderTimelineMirror.test.tsx
index 6f42b84148..e4c94d4eef 100644
--- a/packages/studio/src/components/nle/useCanvasZOrderTimelineMirror.test.tsx
+++ b/packages/studio/src/components/nle/useCanvasZOrderTimelineMirror.test.tsx
@@ -57,7 +57,6 @@ interface HarnessApi {
interface RecordedWrite {
label: string;
- kind: "manual" | "timeline";
coalesceKey: string;
after: string;
}
@@ -70,9 +69,9 @@ interface RecordedWrite {
* only captures what Studio sends on each write:
*
* - the z sink mimics commitDomEditPatchBatches' recordEdit call verbatim
- * (kind "manual", options.coalesceKey — see useDomEditCommits.ts), and
+ * (options.coalesceKey — see useDomEditCommits.ts), and
* - the move sink mimics persistTimelineBatchEdit → saveProjectFilesWithHistory
- * (kind "timeline", the coalesceKey forwarded through onMoveElements — see
+ * (the coalesceKey forwarded through onMoveElements — see
* timelineEditingHelpers.ts / studioFileHistory.ts).
*/
function mountMirrorHarness(history: {
@@ -82,12 +81,11 @@ function mountMirrorHarness(history: {
}) {
const record = (
label: string,
- kind: "manual" | "timeline",
coalesceKey: string,
_coalesceMs: number | undefined,
after: string,
) => {
- history.records.push({ label, kind, coalesceKey, after });
+ history.records.push({ label, coalesceKey, after });
history.fileContent.current = after;
};
@@ -98,7 +96,7 @@ function mountMirrorHarness(history: {
coalesceMs,
) => {
history.moveCoalesceKeys.push(coalesceKey ?? "<none>");
- record("Move timeline clips", "timeline", coalesceKey ?? "<none>", coalesceMs, "C-move");
+ record("Move timeline clips", coalesceKey ?? "<none>", coalesceMs, "C-move");
};
const api: Partial<HarnessApi> = {};
@@ -106,7 +104,7 @@ function mountMirrorHarness(history: {
const { handleDomZIndexReorderCommit } = useElementLifecycleOps(
makeLifecycleOpsParams({
commitDomEditPatchBatches: async (_batches, options) => {
- record(options.label, "manual", options.coalesceKey, options.coalesceMs, "B-z");
+ record(options.label, options.coalesceKey, options.coalesceMs, "B-z");
return { durable: true, allMatched: true, changed: true };
},
}),
diff --git a/packages/studio/src/components/panels/VariablesPanel.tsx b/packages/studio/src/components/panels/VariablesPanel.tsx
index b52ace1d50..d953a6256c 100644
--- a/packages/studio/src/components/panels/VariablesPanel.tsx
+++ b/packages/studio/src/components/panels/VariablesPanel.tsx
@@ -5,7 +5,6 @@ import type {
VariableUsageReport,
VariableValidationIssue,
} from "@hyperframes/sdk";
-import type { EditHistoryKind } from "../../utils/editHistory";
import type { PublishSdkSession } from "../../utils/sdkCutover";
import { useStudioPlaybackContext, useStudioShellContext } from "../../contexts/StudioContext";
import { useDomEditContext } from "../../contexts/DomEditContext";
@@ -37,7 +36,6 @@ export interface StudioEditPersistenceProps {
reloadPreview: () => void;
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
}
diff --git a/packages/studio/src/components/studioColorGradingScope.ts b/packages/studio/src/components/studioColorGradingScope.ts
index 46b36b6dc7..cfce6ad624 100644
--- a/packages/studio/src/components/studioColorGradingScope.ts
+++ b/packages/studio/src/components/studioColorGradingScope.ts
@@ -1,4 +1,3 @@
-import type { EditHistoryKind } from "../utils/editHistory";
import { saveProjectFilesWithHistory } from "../utils/studioFileHistory";
import { patchMediaColorGradingInHtml } from "./editor/colorGradingScopePatch";
import { hasRelativeLutSource } from "./studioMediaJobs";
@@ -11,7 +10,6 @@ type ProjectFileWriter = (path: string, content: string) => Promise<void>;
type ShowToast = (message: string, tone?: "error" | "info") => void;
type RecordEdit = (entry: {
label: string;
- kind: EditHistoryKind;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
@@ -105,7 +103,6 @@ export async function applyColorGradingScopeUpdate({
const changedPaths = await saveProjectFilesWithHistory({
projectId,
label: value ? "Apply color grading" : "Clear color grading",
- kind: "manual",
files,
readFile: readProjectFile,
writeFile: writeProjectFile,
diff --git a/packages/studio/src/hooks/domEditDeleteMembers.ts b/packages/studio/src/hooks/domEditDeleteMembers.ts
index ed4bb733ec..7c0582081d 100644
--- a/packages/studio/src/hooks/domEditDeleteMembers.ts
+++ b/packages/studio/src/hooks/domEditDeleteMembers.ts
@@ -6,7 +6,6 @@
*/
import type { DomEditSelection } from "../components/editor/domEditingTypes";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { TimelineElement } from "../player";
import { findMatchingTimelineElementId } from "../utils/studioHelpers";
@@ -14,7 +13,6 @@ import { findMatchingTimelineElementId } from "../utils/studioHelpers";
* supplies it. */
export interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
diff --git a/packages/studio/src/hooks/gsapScriptCommitTypes.ts b/packages/studio/src/hooks/gsapScriptCommitTypes.ts
index 59394d6a15..ed292c649f 100644
--- a/packages/studio/src/hooks/gsapScriptCommitTypes.ts
+++ b/packages/studio/src/hooks/gsapScriptCommitTypes.ts
@@ -1,7 +1,6 @@
import type { ParsedGsap } from "@hyperframes/core/gsap-parser";
import type { Composition } from "@hyperframes/sdk";
import type { DomEditSelection } from "../components/editor/domEditingTypes";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { PublishSdkSession } from "../utils/sdkCutover";
import type { RuntimeTweenChange } from "./gsapRuntimePatch";
@@ -96,7 +95,6 @@ export interface GsapScriptCommitsParams {
editHistory: {
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, { before: string; after: string }>;
diff --git a/packages/studio/src/hooks/timelineAudioGroupCreate.ts b/packages/studio/src/hooks/timelineAudioGroupCreate.ts
index 6510a55ce7..c027039f69 100644
--- a/packages/studio/src/hooks/timelineAudioGroupCreate.ts
+++ b/packages/studio/src/hooks/timelineAudioGroupCreate.ts
@@ -237,7 +237,6 @@ export async function createAudioGroupAndAssignMembers({
label: groupLabel
? `Group ${elements.length} clips as ${groupLabel}`
: `Group ${elements.length} voice clips`,
- kind: "timeline",
files,
readFile: async (path) => {
const original = originalByPath.get(path);
diff --git a/packages/studio/src/hooks/timelineEditingHelpers.ts b/packages/studio/src/hooks/timelineEditingHelpers.ts
index 7e21adce9f..95f612ec8c 100644
--- a/packages/studio/src/hooks/timelineEditingHelpers.ts
+++ b/packages/studio/src/hooks/timelineEditingHelpers.ts
@@ -318,7 +318,6 @@ export async function persistTimelineEdit(input: PersistTimelineEditInput): Prom
await saveProjectFilesWithHistory({
projectId: input.projectId,
label: input.label,
- kind: "timeline",
coalesceKey: input.coalesceKey,
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
@@ -388,7 +387,6 @@ export async function persistTimelineBatchEdit(
await saveProjectFilesWithHistory({
projectId: input.projectId,
label: input.label,
- kind: "timeline",
coalesceKey: input.coalesceKey,
coalesceMs: input.coalesceMs,
files,
@@ -466,7 +464,6 @@ export async function persistElementAttribute({
const changedPaths = await saveProjectFilesWithHistory({
projectId,
label,
- kind: "timeline",
files: { [targetPath]: patched },
readFile: async (path) => (path === targetPath ? before : readFileContent(projectId, path)),
writeFile: writeProjectFile,
diff --git a/packages/studio/src/hooks/timelineTimingSync.ts b/packages/studio/src/hooks/timelineTimingSync.ts
index aac58e926f..c2514c4caa 100644
--- a/packages/studio/src/hooks/timelineTimingSync.ts
+++ b/packages/studio/src/hooks/timelineTimingSync.ts
@@ -399,7 +399,6 @@ async function foldGsapMutationIntoHistory(input: {
if (Object.keys(files).length > 0) {
await input.recordEdit({
label: input.label,
- kind: "timeline",
coalesceKey: input.coalesceKey,
coalesceMs: GSAP_HISTORY_COALESCE_MS,
files,
diff --git a/packages/studio/src/hooks/timelineTrackVisibility.ts b/packages/studio/src/hooks/timelineTrackVisibility.ts
index 559bee7f69..0876dd9a91 100644
--- a/packages/studio/src/hooks/timelineTrackVisibility.ts
+++ b/packages/studio/src/hooks/timelineTrackVisibility.ts
@@ -175,7 +175,6 @@ async function setElementsHidden({
const changedPaths = await saveProjectFilesWithHistory({
projectId,
label,
- kind: "timeline",
files,
readFile: async (path) => {
const original = originalByPath.get(path);
diff --git a/packages/studio/src/hooks/useBlockHandlers.ts b/packages/studio/src/hooks/useBlockHandlers.ts
index c857ceacfb..08d17f0d26 100644
--- a/packages/studio/src/hooks/useBlockHandlers.ts
+++ b/packages/studio/src/hooks/useBlockHandlers.ts
@@ -8,7 +8,6 @@ import { usePlayerStore } from "../player";
import { addBlockToProject } from "../utils/blockInstaller";
import { selectAndRevealTimelineElement } from "../player/components/timelineDropReveal";
import type { BlockParam } from "@hyperframes/core/registry";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { RightPanelTab } from "../utils/studioHelpers";
import type { MediaOverlayPlacement } from "../components/editor/propertyPanelTypes";
@@ -19,7 +18,6 @@ interface BlockCtxDeps {
writeProjectFile: (path: string, content: string) => Promise<void>;
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
diff --git a/packages/studio/src/hooks/useClipboard.ts b/packages/studio/src/hooks/useClipboard.ts
index ee546d99ea..7166ab5366 100644
--- a/packages/studio/src/hooks/useClipboard.ts
+++ b/packages/studio/src/hooks/useClipboard.ts
@@ -13,7 +13,6 @@ import { collectHtmlIds } from "../utils/studioHelpers";
import { insertTimelineAssetIntoSource } from "../utils/timelineAssetDrop";
import { extendRootDurationInSource } from "../utils/rootDuration";
import { saveProjectFilesWithHistory } from "../utils/studioFileHistory";
-import type { EditHistoryKind } from "../utils/editHistory";
import { formatTimelineAttributeNumber } from "../player/components/timelineEditing";
import { findElementForSelection } from "../components/editor/domEditingElement";
import { findTimelineElementInIframe, readFileContent } from "./timelineEditingHelpers";
@@ -22,7 +21,6 @@ import { timeRangesOverlap } from "../player/components/timelineCollision";
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
@@ -297,7 +295,6 @@ export function useClipboard({
await saveProjectFilesWithHistory({
projectId: pid,
label,
- kind: "timeline" as EditHistoryKind,
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
writeFile: writeProjectFile,
@@ -348,7 +345,6 @@ export function useClipboard({
await saveProjectFilesWithHistory({
projectId: pid,
label: clipLabel("Duplicate", clips.length),
- kind: "timeline" as EditHistoryKind,
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
writeFile: writeProjectFile,
diff --git a/packages/studio/src/hooks/useDomEditCommits.test.tsx b/packages/studio/src/hooks/useDomEditCommits.test.tsx
index dd8c190733..f931d34645 100644
--- a/packages/studio/src/hooks/useDomEditCommits.test.tsx
+++ b/packages/studio/src/hooks/useDomEditCommits.test.tsx
@@ -340,7 +340,6 @@ describe("useDomEditCommits z-index reorder persistence", () => {
expect(rendered.recordEdit).toHaveBeenCalledTimes(1);
expect(rendered.recordEdit).toHaveBeenCalledWith({
label: "Reorder layers",
- kind: "manual",
coalesceKey: "z-reorder:test",
// Unbounded per-gesture fold window (keys are unique per gesture):
// the z entry and its mirror/lane counterpart fold across the server
diff --git a/packages/studio/src/hooks/useDomEditCommits.ts b/packages/studio/src/hooks/useDomEditCommits.ts
index b5358f3723..5c5d089d61 100644
--- a/packages/studio/src/hooks/useDomEditCommits.ts
+++ b/packages/studio/src/hooks/useDomEditCommits.ts
@@ -12,7 +12,6 @@ import {
} from "../utils/studioSaveDiagnostics";
import { buildDomEditPatchTarget, type DomEditSelection } from "../components/editor/domEditing";
import { fontFamilyFromAssetPath, type ImportedFontAsset } from "../components/editor/fontAssets";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { CommitDomEditPatchBatches, PersistDomEditOperations } from "./domEditCommitTypes";
import type { PatchOperation } from "../utils/sourcePatcher";
import {
@@ -38,7 +37,6 @@ import { studioWriteHeaders } from "../utils/studioFileVersion";
import { reseekPreviewRuntime } from "./timelineTrackVisibility";
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, { before: string; after: string }>;
@@ -286,7 +284,6 @@ export function useDomEditCommits({
await editHistory.recordEdit({
label: options?.label ?? "Edit layer",
- kind: "manual",
coalesceKey: options?.coalesceKey,
coalesceMs: options?.coalesceMs,
files: { [targetPath]: { before: originalContent, after: finalContent } },
@@ -365,7 +362,6 @@ export function useDomEditCommits({
if (changed) {
await editHistory.recordEdit({
label: options.label,
- kind: "manual",
coalesceKey: options.coalesceKey,
coalesceMs: options.coalesceMs,
files,
diff --git a/packages/studio/src/hooks/useEditorSave.ts b/packages/studio/src/hooks/useEditorSave.ts
index c2c5891bfd..38a8e00685 100644
--- a/packages/studio/src/hooks/useEditorSave.ts
+++ b/packages/studio/src/hooks/useEditorSave.ts
@@ -1,6 +1,5 @@
import { useCallback, useRef } from "react";
import { saveProjectFilesWithHistory } from "../utils/studioFileHistory";
-import type { EditHistoryKind } from "../utils/editHistory";
import {
StudioFileConflictError,
buildStudioSaveFailureProperties,
@@ -12,7 +11,6 @@ const FAILURE_BURST_MS = 5_000;
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
@@ -108,7 +106,6 @@ export function useEditorSave({
const task = saveProjectFilesWithHistory({
projectId: candidate.projectId,
label: "Edit source",
- kind: "source",
coalesceKey: `source:${candidate.path}`,
files: { [candidate.path]: candidate.content },
readFile: readProjectFile,
diff --git a/packages/studio/src/hooks/useElementLifecycleOps.ts b/packages/studio/src/hooks/useElementLifecycleOps.ts
index 15a45194ca..9b5ee2feef 100644
--- a/packages/studio/src/hooks/useElementLifecycleOps.ts
+++ b/packages/studio/src/hooks/useElementLifecycleOps.ts
@@ -185,7 +185,6 @@ export function useElementLifecycleOps({
await saveProjectFilesWithHistory({
projectId: pid,
label: "Delete element",
- kind: "timeline",
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
// remove-element already wrote the removal, so disk holds THAT — not
diff --git a/packages/studio/src/hooks/useFileManager.ts b/packages/studio/src/hooks/useFileManager.ts
index bacbf7c096..0023375a20 100644
--- a/packages/studio/src/hooks/useFileManager.ts
+++ b/packages/studio/src/hooks/useFileManager.ts
@@ -2,7 +2,6 @@ import { useState, useCallback, useRef } from "react";
import type { EditingFile } from "../utils/studioHelpers";
import { FONT_EXT, isMediaFile } from "../utils/mediaTypes";
import { fontFamilyFromAssetPath, type ImportedFontAsset } from "../components/editor/fontAssets";
-import type { EditHistoryKind } from "../utils/editHistory";
import { findTagByTarget, type PatchTarget } from "../utils/sourcePatcher";
import { StudioFileConflictError } from "../utils/studioSaveDiagnostics";
import { useFileTree } from "./useFileTree";
@@ -13,7 +12,6 @@ import { useProjectFileWriter } from "./useProjectFileWriter";
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
diff --git a/packages/studio/src/hooks/useGroupCommits.ts b/packages/studio/src/hooks/useGroupCommits.ts
index 133623c955..4e230a04aa 100644
--- a/packages/studio/src/hooks/useGroupCommits.ts
+++ b/packages/studio/src/hooks/useGroupCommits.ts
@@ -146,7 +146,6 @@ async function commitStructuralMutation(
await saveProjectFilesWithHistory({
projectId: pid,
label,
- kind: "manual",
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
writeFile: deps.writeProjectFile,
diff --git a/packages/studio/src/hooks/useGsapScriptCommits.ts b/packages/studio/src/hooks/useGsapScriptCommits.ts
index 1758db2051..9c4689f7f2 100644
--- a/packages/studio/src/hooks/useGsapScriptCommits.ts
+++ b/packages/studio/src/hooks/useGsapScriptCommits.ts
@@ -326,7 +326,6 @@ export function useGsapScriptCommits({ projectIdRef, activeCompPath, previewIfra
if (result.before == null || result.after == null) return;
await editHistory.recordEdit({
label: options.label,
- kind: "manual",
coalesceKey: options.coalesceKey,
coalesceMs: options.coalesceMs,
files: { [targetPath]: { before: result.before, after: result.after } },
diff --git a/packages/studio/src/hooks/usePersistentEditHistory.test.ts b/packages/studio/src/hooks/usePersistentEditHistory.test.ts
index eb8b0e8a2c..6c1bb5e18e 100644
--- a/packages/studio/src/hooks/usePersistentEditHistory.test.ts
+++ b/packages/studio/src/hooks/usePersistentEditHistory.test.ts
@@ -66,7 +66,6 @@ it("an edit Studio saved is undone and redone by the project's history, with the
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "A", after: "B" } },
}),
);
@@ -98,7 +97,6 @@ it("a drag's edits under one key undo as one step, even before the drag goes idl
await act(() =>
hook().recordEdit({
label: "Dragged Title",
- kind: "manual",
coalesceKey: "drag",
coalesceMs: 60_000,
files: { "index.html": { before, after } },
@@ -119,12 +117,11 @@ it("a drag's edits under one key undo as one step, even before the drag goes idl
it("an agent's edit made seconds before Studio's stays the agent's: Cmd+Z undoes only Studio's", async () => {
const { hook, file, save, readFile } = await studio();
save("B");
- await act(() => hook().recordEdit({ label: "sweep", kind: "manual", files: {} }));
+ await act(() => hook().recordEdit({ label: "sweep", files: {} }));
save("C");
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "B", after: "C" } },
}),
);
@@ -138,7 +135,6 @@ it("an undo's writes carry the write token Studio marked, so their echo is not r
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "A", after: "B" } },
}),
);
@@ -153,7 +149,6 @@ it("without a history on the server an edit still saves, and there is nothing to
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "A", after: "B" } },
}),
);
@@ -191,7 +186,6 @@ it("a refused step names the files that changed since its edit", async () => {
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "A", after: "B" } },
}),
);
@@ -213,7 +207,6 @@ it("a claim the server refused is logged, and the write stays undoable as a chan
await act(() =>
hook().recordEdit({
label: "Moved Title",
- kind: "manual",
files: { "index.html": { before: "A", after: "B" } },
}),
);
diff --git a/packages/studio/src/hooks/usePersistentEditHistory.ts b/packages/studio/src/hooks/usePersistentEditHistory.ts
index 156bafe806..268ddc38dd 100644
--- a/packages/studio/src/hooks/usePersistentEditHistory.ts
+++ b/packages/studio/src/hooks/usePersistentEditHistory.ts
@@ -1,11 +1,9 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import type { HistoryListItem, HistoryResult } from "@hyperframes/studio-server";
-import type { EditHistoryKind } from "../utils/editHistory";
import { studioFileContentVersion, studioWriteHeaders } from "../utils/studioFileVersion";
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, { before: string; after: string }>;
diff --git a/packages/studio/src/hooks/usePreviewPersistence.ts b/packages/studio/src/hooks/usePreviewPersistence.ts
index ee7039231f..e62eae6735 100644
--- a/packages/studio/src/hooks/usePreviewPersistence.ts
+++ b/packages/studio/src/hooks/usePreviewPersistence.ts
@@ -5,7 +5,6 @@ import {
reapplyPositionEditsAfterSeek,
} from "../components/editor/manualEdits";
import { STUDIO_MOTION_PATH } from "../components/editor/studioMotion";
-import type { EditHistoryKind } from "../utils/editHistory";
import { createDomEditSaveQueue, type DomEditSaveDrainResult } from "../utils/domEditSaveQueue";
import {
flushStudioPendingEdits,
@@ -26,7 +25,6 @@ interface HistoryPreviewRestore {
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
diff --git a/packages/studio/src/hooks/useProjectCompositionVariables.ts b/packages/studio/src/hooks/useProjectCompositionVariables.ts
index cd621309d6..0f6198be98 100644
--- a/packages/studio/src/hooks/useProjectCompositionVariables.ts
+++ b/packages/studio/src/hooks/useProjectCompositionVariables.ts
@@ -1,12 +1,10 @@
import { useCallback, useEffect, useState } from "react";
import { openComposition, type Composition, type CompositionVariable } from "@hyperframes/sdk";
import { persistSdkSerialize } from "../utils/sdkCutover";
-import type { EditHistoryKind } from "../utils/editHistory";
-/** Records an edit into the studio's undo history (label + kind + per-file before/after). */
+/** Records an edit into the studio's undo history (label + per-file before/after). */
export type RecordEditFn = (entry: {
label: string;
- kind: EditHistoryKind;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
diff --git a/packages/studio/src/hooks/useRazorSplit.history.test.tsx b/packages/studio/src/hooks/useRazorSplit.history.test.tsx
index 548ba01ec8..748911a892 100644
--- a/packages/studio/src/hooks/useRazorSplit.history.test.tsx
+++ b/packages/studio/src/hooks/useRazorSplit.history.test.tsx
@@ -175,7 +175,6 @@ describe("useRazorSplit — split is undoable via edit history", () => {
expect(harness.records).toHaveLength(1);
expect(harness.records[0]).toMatchObject({
label: "Split timeline clip",
- kind: "timeline",
});
expect(harness.records[0]!.files["index.html"]).toEqual({
before: ORIGINAL,
diff --git a/packages/studio/src/hooks/useSlideshowPersist.ts b/packages/studio/src/hooks/useSlideshowPersist.ts
index c679bddf73..e8a4c37316 100644
--- a/packages/studio/src/hooks/useSlideshowPersist.ts
+++ b/packages/studio/src/hooks/useSlideshowPersist.ts
@@ -1,7 +1,6 @@
import { useCallback } from "react";
import type { Composition } from "@hyperframes/sdk";
import type { SlideshowManifest } from "@hyperframes/core/slideshow";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { PublishSdkSession } from "../utils/sdkCutover";
import { persistSlideshowManifest } from "../utils/setSlideshowManifest";
@@ -12,7 +11,6 @@ export interface UseSlideshowPersistParams {
writeProjectFile: (path: string, content: string) => Promise<void>;
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
reloadPreview: () => void;
diff --git a/packages/studio/src/hooks/useTimelineAssetDropOps.ts b/packages/studio/src/hooks/useTimelineAssetDropOps.ts
index 4630490170..e30d86ca48 100644
--- a/packages/studio/src/hooks/useTimelineAssetDropOps.ts
+++ b/packages/studio/src/hooks/useTimelineAssetDropOps.ts
@@ -166,7 +166,6 @@ export function useTimelineAssetDropOps({
await saveProjectFilesWithHistory({
projectId: pid,
label: "Add timeline asset",
- kind: "timeline",
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
writeFile: writeProjectFile,
diff --git a/packages/studio/src/hooks/useTimelineDeleteOps.ts b/packages/studio/src/hooks/useTimelineDeleteOps.ts
index a2240206c5..ec0c1c014c 100644
--- a/packages/studio/src/hooks/useTimelineDeleteOps.ts
+++ b/packages/studio/src/hooks/useTimelineDeleteOps.ts
@@ -157,7 +157,6 @@ export function useTimelineDeleteOps({
await saveProjectFilesWithHistory({
projectId: pid,
label: deleteHistoryLabel,
- kind: "timeline",
coalesceKey,
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
diff --git a/packages/studio/src/hooks/useTimelineEditing.test.tsx b/packages/studio/src/hooks/useTimelineEditing.test.tsx
index 1d056d6e60..0048eee2fe 100644
--- a/packages/studio/src/hooks/useTimelineEditing.test.tsx
+++ b/packages/studio/src/hooks/useTimelineEditing.test.tsx
@@ -112,7 +112,6 @@ function renderTimelineEditingHook(input: {
writeProjectFile?: (path: string, content: string) => Promise<void>;
recordEdit?: (input: {
label: string;
- kind: string;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
diff --git a/packages/studio/src/hooks/useTimelineEditingTypes.ts b/packages/studio/src/hooks/useTimelineEditingTypes.ts
index 9c0cf886d2..7b9a8edf60 100644
--- a/packages/studio/src/hooks/useTimelineEditingTypes.ts
+++ b/packages/studio/src/hooks/useTimelineEditingTypes.ts
@@ -2,13 +2,11 @@ import type { MutableRefObject, RefObject } from "react";
import type { Composition } from "@hyperframes/sdk";
import type { TimelineElement } from "../player";
import type { TimelineStackingReorderIntent } from "../player/components/timelineEditing";
-import type { EditHistoryKind } from "../utils/editHistory";
import type { PublishSdkSession } from "../utils/sdkCutover";
import type { CanEditTimelineElement } from "./timelineEditPermission";
interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}
diff --git a/packages/studio/src/utils/blockInstaller.ts b/packages/studio/src/utils/blockInstaller.ts
index 94eacf9db1..6784710615 100644
--- a/packages/studio/src/utils/blockInstaller.ts
+++ b/packages/studio/src/utils/blockInstaller.ts
@@ -9,7 +9,6 @@ import { collectHtmlIds } from "./studioHelpers";
import { generateId } from "./generateId";
import { formatTimelineAttributeNumber } from "../player/components/timelineEditing";
import { saveProjectFilesWithHistory } from "./studioFileHistory";
-import type { EditHistoryKind } from "./editHistory";
import { extendRootDurationInSource } from "./rootDuration";
import { deriveTimelineStoreKeyForDomId } from "../player/lib/timelineElementHelpers";
@@ -41,7 +40,6 @@ interface AddBlockOptions {
writeProjectFile: (path: string, content: string) => Promise<void>;
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
files: Record<string, { before: string; after: string }>;
}) => Promise<void>;
@@ -234,7 +232,6 @@ export async function addBlockToProject(
await saveProjectFilesWithHistory({
projectId,
label: `Add ${isBlock ? "block" : "component"}: ${block.title}`,
- kind: "timeline",
files: { [targetPath]: patchedContent },
readFile: async () => originalContent,
writeFile: writeProjectFile,
diff --git a/packages/studio/src/utils/editHistory.ts b/packages/studio/src/utils/editHistory.ts
deleted file mode 100644
index 6cd41125da..0000000000
--- a/packages/studio/src/utils/editHistory.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type EditHistoryKind = "manual" | "motion" | "timeline" | "source";
diff --git a/packages/studio/src/utils/razorSplitTransaction.test.ts b/packages/studio/src/utils/razorSplitTransaction.test.ts
index 9e4a2dfebd..6b1cd0a2cb 100644
--- a/packages/studio/src/utils/razorSplitTransaction.test.ts
+++ b/packages/studio/src/utils/razorSplitTransaction.test.ts
@@ -133,7 +133,6 @@ describe("runAtomicCutTransaction", () => {
expect(writeProjectFile).not.toHaveBeenCalled();
expect(recordEdit).toHaveBeenCalledWith({
label: "Split timeline clip",
- kind: "timeline",
files: { "index.html": { before: "before", after: "after" } },
});
expect(observe).toHaveBeenCalledWith("index.html", '"v1"');
diff --git a/packages/studio/src/utils/razorSplitTransaction.ts b/packages/studio/src/utils/razorSplitTransaction.ts
index 77054df21c..ca679c318f 100644
--- a/packages/studio/src/utils/razorSplitTransaction.ts
+++ b/packages/studio/src/utils/razorSplitTransaction.ts
@@ -181,7 +181,7 @@ export function runAtomicCutTransaction(input: RunAtomicCutInput): Promise<Atomi
result.files.map((file) => [file.path, { before: file.before, after: file.after }]),
);
try {
- await input.recordEdit({ label: input.label, kind: "timeline", files: snapshots });
+ await input.recordEdit({ label: input.label, files: snapshots });
} catch (error) {
try {
await rollbackUnrecordedCut(result.files, input.writeProjectFile);
diff --git a/packages/studio/src/utils/sdkEditTransaction.ts b/packages/studio/src/utils/sdkEditTransaction.ts
index 310f17210a..10dad8f9de 100644
--- a/packages/studio/src/utils/sdkEditTransaction.ts
+++ b/packages/studio/src/utils/sdkEditTransaction.ts
@@ -1,5 +1,4 @@
import { openComposition, type Composition } from "@hyperframes/sdk";
-import type { EditHistoryKind } from "./editHistory";
import { hashContent, markSelfWrite } from "../hooks/sdkSelfWriteRegistry";
import { trackStudioEvent } from "./studioTelemetry";
import { serializeStudioFileMutation } from "./studioFileMutationCoordinator";
@@ -32,7 +31,6 @@ export interface CutoverDeps {
editHistory: {
recordEdit: (entry: {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, { before: string; after: string }>;
@@ -248,7 +246,6 @@ async function writeAndRecord(
try {
await deps.editHistory.recordEdit({
label: options?.label ?? "Edit layer",
- kind: "manual",
...(options?.coalesceKey ? { coalesceKey: options.coalesceKey } : {}),
...(options?.coalesceMs != null ? { coalesceMs: options.coalesceMs } : {}),
files: { [targetPath]: { before: originalContent, after } },
diff --git a/packages/studio/src/utils/studioFileHistory.test.ts b/packages/studio/src/utils/studioFileHistory.test.ts
index 8965e38813..f0bfdad517 100644
--- a/packages/studio/src/utils/studioFileHistory.test.ts
+++ b/packages/studio/src/utils/studioFileHistory.test.ts
@@ -11,7 +11,6 @@ describe("saveProjectFilesWithHistory", () => {
await saveProjectFilesWithHistory({
projectId: "project-1",
label: "Move layer",
- kind: "manual",
files: { "index.html": "after" },
readFile: async (path) => reads[path],
writeFile: async (path, content) => {
@@ -23,7 +22,6 @@ describe("saveProjectFilesWithHistory", () => {
expect(writes).toEqual({ "index.html": "after" });
expect(recordEdit).toHaveBeenCalledWith({
label: "Move layer",
- kind: "manual",
coalesceKey: undefined,
files: { "index.html": { before: "before", after: "after" } },
});
@@ -42,7 +40,6 @@ describe("saveProjectFilesWithHistory", () => {
await saveProjectFilesWithHistory({
projectId: "project-1",
label: "Delete timeline clip",
- kind: "timeline",
files: { "index.html": "removed+shrunk" },
readFile: async () => "original",
diskContent: { "index.html": "removed" },
@@ -67,7 +64,6 @@ describe("saveProjectFilesWithHistory", () => {
await saveProjectFilesWithHistory({
projectId: "project-1",
label: "Move layer",
- kind: "manual",
files: { "index.html": "after" },
readFile: async () => "before",
writeFile: async (path, _content, expectedContent) => {
@@ -85,7 +81,6 @@ describe("saveProjectFilesWithHistory", () => {
const changedPaths = await saveProjectFilesWithHistory({
projectId: "project-1",
label: "Edit layer",
- kind: "manual",
files: { "index.html": "same" },
readFile: async () => "same",
writeFile,
@@ -109,7 +104,6 @@ describe("saveProjectFilesWithHistory", () => {
saveProjectFilesWithHistory({
projectId: "project-1",
label: "Move layer",
- kind: "manual",
files: {
"index.html": "index-after",
"scene.html": "scene-after",
@@ -144,7 +138,6 @@ describe("saveProjectFilesWithHistory", () => {
saveProjectFilesWithHistory({
projectId: "project-1",
label: "Move layer",
- kind: "manual",
files: {
"index.html": "index-after",
"scene.html": "scene-after",
@@ -178,7 +171,6 @@ describe("saveProjectFilesWithHistory", () => {
saveProjectFilesWithHistory({
projectId: "project-1",
label: "Move layer",
- kind: "manual",
files: {
"index.html": "index-after",
"scene.html": "scene-after",
@@ -223,7 +215,6 @@ describe("saveProjectFilesWithHistory", () => {
const save = saveProjectFilesWithHistory({
projectId: "project-1",
label: "Edit source",
- kind: "source",
files: { "index.html": "editor-after" },
readFile,
writeFile,
diff --git a/packages/studio/src/utils/studioFileHistory.ts b/packages/studio/src/utils/studioFileHistory.ts
index 675ec7c1d6..29c967144b 100644
--- a/packages/studio/src/utils/studioFileHistory.ts
+++ b/packages/studio/src/utils/studioFileHistory.ts
@@ -1,12 +1,10 @@
import { buildProjectApiPath } from "./projectRouting";
import type { MutableRefObject } from "react";
-import type { EditHistoryKind } from "./editHistory";
import { serializeStudioFileMutations } from "./studioFileMutationCoordinator";
import { createStudioSaveHttpError } from "./studioSaveDiagnostics";
export interface RecordEditInput {
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, { before: string; after: string }>;
@@ -27,7 +25,6 @@ type ProjectFileWriter = (path: string, content: string, expectedContent?: strin
interface SaveProjectFilesWithHistoryInput {
projectId: string;
label: string;
- kind: EditHistoryKind;
coalesceKey?: string;
coalesceMs?: number;
files: Record<string, string>;
@@ -65,7 +62,6 @@ export async function readProjectFileContent(pid: string, path: string): Promise
export async function saveProjectFilesWithHistory({
label,
- kind,
coalesceKey,
coalesceMs,
files,
@@ -93,7 +89,7 @@ export async function saveProjectFilesWithHistory({
writtenPaths.push(path);
}
- await recordEdit({ label, kind, coalesceKey, coalesceMs, files: snapshots });
+ await recordEdit({ label, coalesceKey, coalesceMs, files: snapshots });
} catch (error) {
try {
for (const path of writtenPaths.reverse()) {
diff --git a/packages/studio/src/utils/timelineCompositionInsert.ts b/packages/studio/src/utils/timelineCompositionInsert.ts
index 0b92c67ebd..de54fb21be 100644
--- a/packages/studio/src/utils/timelineCompositionInsert.ts
+++ b/packages/studio/src/utils/timelineCompositionInsert.ts
@@ -70,7 +70,6 @@ export async function commitTimelineCompositionInsertion(input: {
try {
await input.recordEdit({
label: "Add composition to timeline",
- kind: "timeline",
files: { [input.targetPath]: { before: result.before, after: result.after } },
});
} catch (error) {
diff --git a/scripts/check-no-main-deletions.mjs b/scripts/check-no-main-deletions.mjs
index 14787b09b5..9edd378ce2 100644
--- a/scripts/check-no-main-deletions.mjs
+++ b/scripts/check-no-main-deletions.mjs
@@ -40,6 +40,10 @@ const STORYBOARD_VIEW_REASON =
"owner-directed removal of the Studio storyboard view; its only readers were deleted with it";
export const ALLOWED_DELETIONS = new Map([
+ [
+ "packages/studio/src/utils/editHistory.ts",
+ "held only EditHistoryKind; recordEdit's kind was never sent to the project history, so it and every caller's copy go",
+ ],
[
"packages/studio/src/utils/editHistoryStorage.ts",
"Studio's undo moves onto the project history (studio-server); the browser IndexedDB history and its reducer are removed",