Repository navigation
fix(studio): a refused edit names the file and why, on every edit path - #7749
miguel-heygen wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head f2ce4470
-
blocker: two single-file edit paths still drop the file name, though the PR says it covers every edit path and lists only the multi-file patch batch as left out.
packages/studio/src/hooks/useFreezeFrame.ts:78: a freeze-frame on a read-only file gets the 403why: "permission"answer, because the/projects/:id/*held-file middleware (files.ts:2810) is registered beforeregisterFreezeFrameRoutes. The toast still readspermission denied, orFreeze frame failed (423), with no file.input.pathis in scope, so(await heldFileWordsOf(response, input.path)) ?? …before thejson()read is enough.packages/studio/src/captions/hooks/useCaptionSync.ts:106: thecaption-overrides.jsonPUT throwsHTTP 403and showsCaption changes couldn't be saved. That is the same refusal this PR fixes elsewhere.
Please fix both and add a test for the freeze-frame case, or name them under "Not changed" with a reason, as the PR does for the patch batch (the razor cut,
split-batch, is multi-file too and could sit there with it).
Scope
Read the whole diff and listed every mutating studioApiFetch in packages/studio/src to check coverage. The razor cut (split-batch) is multi-file, like the patch batch, so the same exemption fits it. The 3 touched test files pass locally (36 tests). The fails-without-the-fix line is present.
|
Fixed in b34649f.
|
There was a problem hiding this comment.
Verdict: APPROVE — 1 resolved, 0 open, 0 new · f2ce447 → b34649f
Receipt
Freeze frame and the caption save now name the refused file. The PR now lists the remaining multi-file edits with reasons. With useFreezeFrame.ts and useCaptionSync.ts reverted to f2ce4470, the two new tests fail (2 of 6). At the head, the touched tests pass 42/42. All CI on b34649fb is green.
What
When the server refuses an edit because the file is read-only or another program has it open, Studio now says so in words that name the file:
Before, deleting a clip from a read-only file showed "Failed to delete 1 clip from index.html", although the server had answered why (
403 {"why":"permission"}).Why
The server answers a refused write 403
why: "permission"or 423why: "busy"on every edit route (#7731). Studio only turned that into words on the paths that callcreateStudioSaveHttpErrorwith the file's path: the save and the reads. The timeline delete, element removal, group and wrap edits, element patches, GSAP edits and their rollback, and composition inserts each wrote their own generic message, or calledcreateStudioSaveHttpErrorwithout the path, which it needs to name the file.Related work
Follows #7731 (the server's 403/423 answers).
How
studioSaveDiagnostics.tskeeps the only copy of the words. A newheldFileWordsOf(response, path)returns them for a refused answer, reading a copy of the body so the caller can still read it, and null for anything else.caption-overrides.json), whose banner now says why. Element removal and composition insert already usedcreateStudioSaveHttpErrorand now pass the file's path.patch-element-batches), the razor cut (split-batch), undo and redo, and block install. Creating, renaming and deleting files in the Files panel never replace an existing file's contents, so a read-only file does not refuse them. Checked by listing every POST, PUT, PATCH and DELETE inpackages/studio/src.Before
A clip deleted from a read-only
index.html(the repo'stimeline-trim-snapfixture, the file made read-only after it loaded):After
The same delete:
Test plan
useTimelineDeleteOps.test.tsx: a delete the server refuses with 403 or 423 shows the words that name the file;useDomEditCommitsHelpers.test.ts: a patch refused as read-only shows the same words;useFreezeFrame.test.ts: a freeze-frame refused as read-only names the file;useCaptionSync.test.ts(new): a refused caption save shows the read-only words, and any other refusal keeps "Caption changes couldn't be saved";studioSaveDiagnostics.test.ts:heldFileWordsOfreads a copy and leaves the body for the caller, and is null for other answers.main's code, the two delete cases showed "Failed to delete 1 clip from index.html", the patch case showed "Couldn't save edit: permission denied", and the helper did not exist.studiosuite passes (757 files, 8,644 tests);tsc --noEmit,oxfmtandoxlintare clean on the changed files.mainand this branch; the clip stays on the timeline in both.