Skip to content

fix(studio): an edit the history could not record says why in the log - #5489

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/history-claim-log-tag
Oct 12, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/history-claim-log-tag

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

When Studio saves an edit but its history server refuses to record it as the person's undo step, the console line now starts with [history] and carries the HTTP status (0 when the server could not be reached):

[history] 409: "Move clip" was not recorded as your edit: <server reason>

Before, the line started with the edit's label, so a host that only forwards known tags (HyperFrames Desktop's error reporting keeps a fixed tag list, which already has history) reported it as a bare "Error". With the tag a host can forward the line, and with the status it can tell a refusal from an unreachable server once its own filter reads the status. Behaviour is unchanged: the edit still lands as an outside change, as before.

No visible change

Log text only, in packages/studio/src/hooks/usePersistentEditHistory.ts (claimHeld). The tag shape follows the existing [studio] line in useShadowPreviewReload.ts.

Checked

  • usePersistentEditHistory.test.ts: a new case for a 409 refusal and an unreachable server, and the existing 500 case updated; all three fail without the change and the file passes 26/26 three runs in a row.
  • oxfmt, oxlint, the comment checks and the studio typecheck are clean.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 2061 (base branch 2061), smooth 1525 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • crop-none-px-r0-nested-z100: tracking 0.04, pressJump 0, drop 0.08, reload 40.07, render 40.03, renderKey -, undo false, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.03, renderKey -, undo true, teleport true / tracking 0.04, pressJump 0, drop 0.08, reload 0.08, render 0.03, renderKey -, undo true, teleport true

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at ecc89187. I found no blocker.

The change: claimHeld now logs [history] <status>: "<label>" was not recorded as your edit: <reason>. Before, the line started with the label. The only thing that changes is the log text. A refused claim still returns null, so the write still lands as an outside change, and a 404 is still silent.

Where the status comes from: I checked it against post().

  • An unreachable server gives status: 0 with "Studio could not reach its server." (the .catch(() => null) branch), which matches the new 0 case.
  • Any non-2xx reply passes its own response.status through, so the 409 and 500 cases are right.
  • A 2xx reply whose body can't be read logs as [history] 200: … The history's reply was unreadable. That's correct, but it's a fourth shape the PR body doesn't list.

Callers: this exact string appears nowhere else in the repo. The only matches are this line and its tests, so nothing parses the old label-first form.

Host side: the tag now leads the line, so a host that matches on a leading [tag] against a fixed list (which already includes history) keeps the category. The free text after the tag is not the tag itself, so the label and the server's reason are still not forwarded as categories.

Tests: the 500 case is updated, and the new it.each covers 409 and unreachable. The unreachable stub rejects only /history/claim and passes every other URL to the real fetch, which keeps the rest of the hook working. CI's Test (studio) ran usePersistentEditHistory.test.ts (26 tests), and the job passed with 7876 tests. I didn't run it locally.

I didn't do a live Studio run against a refusing history server.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit 86521b9 Oct 12, 2026
137 checks passed
@miguel-heygen
miguel-heygen deleted the fix/history-claim-log-tag branch October 12, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants