Skip to content

fix(core): editors and preview runtimes from different releases can edit together again - #9046

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/editing-channel-released-handshake
Nov 29, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/editing-channel-released-handshake

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The preview's editing channel speaks the handshake every published release uses again: Studio asks, and the runtime makes the channel and posts its end back. An editor from 0.9.54 through 0.9.104 can edit a page on this runtime, and this Studio can edit a page whose runtime comes from those releases.

Why

#9000 changed the handshake (Studio made the channel, sent the frame one end and bumped the protocol to 2), so Studio and the runtime had to come from the same release. Editors pin a release while a page loads whichever runtime its link names, so a page on a newer runtime could not be edited from an older editor, and the reverse. No published release speaks the new handshake, so going back to the released one breaks nothing that shipped.

Related work

Reverts #9000. The page-shown and page-left notes from #9007 stay: they don't depend on how the channel is made. #9038 builds the channel rule that keeps a preview's channel to its own page on top of this.

How

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable): not applicable, no option or command changes
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

fails without the fix: packages/core/src/runtime/editingPort.releases.test.ts ("serves a released editor's connect on this runtime, and answers its requests", "edits a page on a released runtime, which answers the connect with its own port"): both red on main, green with the change.

Ran at this head: the core suite, the Studio suite and the producer's editing port test, both type checks and the repo hooks; the new test file 3 runs in a row. In Chrome, with the editing client and runtime from the published 0.9.54 and 0.9.104 packages paired with this branch's: each pair connects and moves an element (hello, query, gesture start, draft, keep), in all four pairings; the same four pairings against main time out.

No visible change

Editing works as before; only which versions can edit each other changes.

…dit together again

Reverts the handshake change that had Studio make the editing channel and send the frame one end.
Every published release asks and lets the runtime make the channel; a page loads whichever
runtime its link names, so an older editor could no longer edit a newer runtime, or the reverse.
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 275 (base branch 273), smooth 72 of those

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

Newly passing (2)

  • seqscaletwice-scale-px-r0-root-z100
  • seqscaletwice-scale-px-r0-nested-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-root-z100
  • seqscaletwice-scale-px-r0-nested-z100

Quarantined, measured but not gated (0)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR names cross-release regression tests in both directions and retains the page lifecycle notices and pointer-watch cleanup. The revert also removes the preview editing-channel ownership protection introduced in #9000. Please keep that protection in the compatibility change, so both guarantees ship together.

— tai (automated review)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked against the published 0.9.104 runtime. The restored handshake matches it, but sealed drag is still incompatible with that runtime. In packages/studio/src/components/editor/previewDrafts.ts:97, Studio adds chrome to the same draft request as the element movement. The 0.9.104 runtime accepts exactly the drafts key and rejects the entire request when chrome is present. The cross-release handshake test does not exercise this Studio drag path. Please preserve the legacy draft payload when the runtime lacks chrome support and cover a cross-release sealed drag.

— tai (automated review)

…ent again

A sealed drag sends the frame its selection outline with each draft, which runtimes before that
change refuse whole, so the element stayed put. The runtime now says in hello that it takes the
outline, and Studio sends it only to a runtime that said so.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Both points from the review, at the new head:

The drag outline and older runtimes. Right: a sealed drag sent chrome with every draft, and 0.9.104 answers a draft carrying it with invalid-params, so the element never moved. The runtime's hello now lists accepts: ["draft-chrome"]. When a sealed drag starts, Studio asks hello (once per page load). It adds chrome only after the runtime has listed it. Drafts never wait for that answer, so a draw still goes out before the save that ends it. If the answer comes mid-drag, the outline goes on its own right after. With any other runtime Studio sends the plain draft and keeps drawing its own outline, as before #8961.

I compared every request Studio sends against 0.9.104's request types. draft.chrome is the only new field on a kind that already existed. The one new kind, watch-pointer, already gets unknown-kind from 0.9.104, and Studio's existing fallback handles that.

fails without the fix: packages/studio/src/components/editor/frameDragChrome.test.ts "sends its drafts without chrome, so they land, and Studio keeps its whole chrome" drives a sealed drag against a stand-in runtime that answers the way 0.9.104 does (no accepts, invalid-params for a draft with chrome). On the previous head the element never moves. A second test covers a draft sent before the runtime answers: "reaches the frame when the drag's first draft went before the runtime said it takes it". Both fail when Studio sends chrome to every runtime.

In Chrome, the real published 0.9.104 and 0.9.54 runtimes answer "not taken", and they refuse a draft carrying chrome with invalid-params. This branch's runtime answers "taken" and accepts it. Open and sealed previews both behave this way.

The rule that keeps a preview's channel to its own page. This PR deliberately takes it out, together with the handshake change it was part of. #9038 brings it back on top of this PR, built so that it works with released runtimes, and it ships in the following release.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The compatibility issue is resolved. A runtime that does not advertise draft chrome continues to receive the legacy draft payload, and Studio keeps drawing the outline. The new regression covers that path, including the old runtime rejecting any draft that carries the extra field. I reviewed this delta against the published handshake. Static re-review.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit f04b6e1 Nov 29, 2026
107 checks passed
@miguel-heygen
miguel-heygen deleted the fix/editing-channel-released-handshake branch November 29, 2026 01:56
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