Skip to content

fix(web): concurrent section form saves keep every edit and never type into someone else's text - #8027

Merged
tlgimenes merged 24 commits into
mainfrom
fix/site-editor-concurrent-form-saves
Oct 19, 2026
Merged

tlgimenes merged 24 commits into
mainfrom
fix/site-editor-concurrent-form-saves

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes for the site editor's section form when two people edit the same block (#7909's stale-save protection), found while testing a v7 site with Fast Preview under load. #7909's guarantee is unchanged: a save built on an outdated copy is still refused by the server. Where both people changed the same value, the user now chooses whose version to keep (see below).

What was wrong

  1. An edit could be lost after a refused save. Under load the form's autosave could send a second save while the first was still on its way. mutate() only reports the outcome of the latest call, so when the first save was refused, the form's starting point went back to the unsaved first edit. The replay on the stored block then counted the user's own edit as someone else's change and kept the stored value. The user's edit was lost, and the toast named the wrong field.
  2. Keystrokes were appended to the other person's text. When a merge kept the other editor's value of the field being typed in, the form showed it at once, so the next keystrokes landed after it ("Picks A again" + "holk") and that mix was saved as the user's edit. The reload after the last retry did the same.
  3. The toasts. The conflict toast named fields by their code name ("title") instead of the form's label ("Headline"), said "the rest of your changes were saved" even when nothing else had changed, and one action could show the same toast twice.
  4. What the user typed after "The latest version was kept" was lost. The field still showed their text, but the form's baseline stayed the refused copy: their next keystrokes (or the same text typed again) were merged against it again and dropped with a second toast, and the field flipped to the other editor's value when they left it.
  5. "AbortError: Transition was skipped" was logged as uncaught in the preview after quick successive saves: only the view transition's finished promise was handled, not ready or updateCallbackDone. A second path (QA, 2026-10-19): a site with page-to-page view transitions (@view-transition { navigation: auto }, as the Storefront v7 store) gets one on every reload a save makes, and Studio set each new ?__draft= pointer on the frame while it was still loading the last one. The cancelled load skipped that transition and the page being left rejected its pageswap promise, which nothing handled (on the kit 2 of 3 rounds of 5 quick saves).
  6. The open conflict dialog didn't follow their version (QA, 2026-10-19). If the other person saved again while the dialog was open, it kept showing the copy it opened with; the newer one appeared only after Save selected versions was refused. The code that refreshes it in place runs when the editor reads a newer copy, and nothing read one while the dialog was open.

What changed

  • A section form sends one save at a time. The next one is built once the one on the wire has landed or been refused (mutateAsync, so every outcome is heard). A retry after a refusal reads the form's value when it runs, and while it waits out its backoff (fix(sections-editor): don't mistake a stale read of your own saves for someone else's change #8000), the form's next saves wait behind it.
  • While focus is in the open form, a merge that kept another editor's value of a field the user changed doesn't replace that field under the cursor. The form keeps showing what they type and re-reads the stored section once they leave the form. Merges that kept every edit still show at once.
  • Meanwhile the form's baseline is the merge it saved, and FormBase.displayed holds what it shows instead. A value the user changes after the notice (even typed back to the same text) is saved over the stored value they were told about; a value they don't touch keeps the stored value; a change from elsewhere after that is still refused by fix(decofile): stop stale editor copies from reverting other drafts' block changes #7909's check. Nothing is ever a mix of both texts.
  • The toast uses the form's field labels, says "The latest version was kept." when nothing else of the user's was left to save, and every outcome of one change shares one toast.
  • The preview's view transition settles all three promises, and the editor script also settles the outgoing page's pageswap transition (where the site runs the script: a v7 site's LiveControls accepts it only from deco.cx / decocms.com origins).
  • A Fast Preview frame loads one draft at a time (frame-navigation.ts): a pointer that arrives while the frame loads waits for its load, then the latest goes in and the ones in between are skipped; a held navigation whose load never fires is released after 15 s. Quick saves now show intermediate versions instead of cancelling every load, and no page-to-page transition is cut short. Sandbox and Local frames follow their src at once, as before.
  • The open conflict dialog follows their version in place (conflict-dialog-poll.ts, useDecofile's pollWhile): while a dialog is open the editor runs its own decofile read again every 3 s (15 s after two minutes open), one poll however many fields, stopped when the dialog closes; a tick is skipped while a write is on the wire, a read is running or just landed, or the tab is hidden. On Fast Preview the read first asks the branch head conditionally (If-None-Match, the same GET): an unchanged branch answers 304 with no body and no new draft grant, so the preview pointer stays put; only a moved head is read whole. The newer copy goes through the existing re-plan (refreshWaitingChoice).

Same-field conflicts: the user chooses (PO decision 2026-10-16)

PO: "instead of a toast, add a dialog with accept mine vs theirs and maybe show the diff? … Instead of using these heuristics, let the user decide". This replaces the same-field toast and the heuristics that served it.

  • Values only one side changed still merge silently (with fix(decofile): stop stale editor copies from reverting other drafts' block changes #7909's "This block was updated while you were editing" toast), now item by item inside lists, so two people editing different fields of the same slide no longer clash.

  • Values both sides changed to different things: nothing of the form's is written. Its saves for that section wait, and one dialog opens (never a toast, never two dialogs: a second waiting choice opens after the first is settled):

    One field, the common case (PO 2026-10-19, "Option B: two people, two cards"):

    ┌ Someone else changed the title while you were editing ─────┐
    │ Pick the one to keep. The other is discarded.              │
    │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃ (D) You  Your version · not saved yet                  ┃ │
    │ ┃     Register [today] and Save [Big!]                   ┃ │
    │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │
    │ ┌────────────────────────────────────────────────────────┐ │
    │ │ (o) Someone else  Their version · already saved        │ │
    │ │     Register [now] and Save [Big this Summer!]         │ │
    │ └────────────────────────────────────────────────────────┘ │
    │                                                      [OK]  │
    └────────────────────────────────────────────────────────────┘
    

    Two or more fields: one field per step (PO 2026-10-19 approved the proposal, "good"):

    ┌────────────────────────────────────────────────────────────┐
    │ ━━ ● ●                                              1 of 3 │
    │ Someone else also changed the title                        │
    │ Pick the one to keep. You can go back before saving.       │
    │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
    │ ┃ (D) You  Your version · not saved yet                  ┃ │
    │ ┃     [Huge] Summer Sale!                                ┃ │
    │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │
    │ ┌────────────────────────────────────────────────────────┐ │
    │ │ (o) Someone else  Their version · already saved        │ │
    │ │     [Big] Summer Sale!                                 │ │
    │ └────────────────────────────────────────────────────────┘ │
    │ [Back]                                              [Next] │
    └────────────────────────────────────────────────────────────┘
    

    The last step (3 of 3): the hint becomes the summary "Title: yours · Cta › Label: theirs · Cta › Href: yours" and Next becomes OK, which saves the picks:

    │ [Back]                                                [OK] │
    

    Each card is a radio (the whole card; arrow keys move the choice), and the one button, OK, saves the card chosen. With several fields, the same two cards come one field per step: a dot per field (a button named by it; the current one wider, the ones moved on from filled) and "1 of 3", Next keeps the pick and moves on, Back, a dot or the ←/→ keys revisit a step (on a card, ↑/↓ change the pick). Next on every step but the last, OK on the last (PO 2026-10-19: "remove the 'keep yours' label into something like next/next/done", then "instead of done, ok"). Nothing is saved before OK. Fields are named by their form labels. Text shows a word-level diff (the words the other version lacks are highlighted, rich text without tags); images show thumbnails; lists show their size and first item titles; small objects show their fields; Yes/No for booleans. Who or when isn't shown on v7 (PO decision, see the next section).

  • Saving (the dialog's one primary button) writes one save of the chosen values over their version, guarded by that version (Fast Preview expect = its fingerprint), and the form shows the result. If yet another change lands while the dialog is open, the dialog shows the newer version in place within a few seconds ("Their version changed again while this was open."), keeping the choices whose two versions didn't change (the other fields go back to yours); with several fields, the dot of each field whose version changed gets a ring until the user visits that step; a save that races it is still refused and asked again the same way. It never retries silently.

  • It must be answered (PO 2026-10-18): "when clicking 'decide later', looks like the ui stops sending or saving and we kind of stay in a frozen state. If the user needs to decide, we need to raise an alert dialog with no close option". The dialog is an alert dialog: no x, and Escape or a click outside don't close it; only saving a choice does. "Decide later", the "aren't saved yet / Choose versions" notice and the paused-saves state behind it are removed. Guarantees kept: nothing is lost, one save at a time, nothing written over a newer version without the user's choice.

  • Yours preselected (PO picked "Must-decide dialog, 'yours' preselected"): your card starts on yours, on every step, so one click on OK keeps the user's edit.

  • Wording (PO 2026-10-18): "'Keep all mine' and 'your version' wording is not a really good match, maybe 'Keep yours' and 'Use theirs'". No "mine" anywhere.

  • Buttons: Next and OK (PO 2026-10-19): "only for the button labels. Remove the 'use theirs for all' button. Also, remove the 'keep yours' label into something like next/next/done", then "instead of done, ok". The single-field dialog's button is OK too, for consistency. "Use theirs for all" and the labels that named the outcome ("Keep yours" / "Keep a mix" / "Use theirs") are removed with their strings; to use theirs, click the other card.

  • Layout: two people, two cards (PO 2026-10-19, "i like the friendliest option b"); several fields one at a time (PO 2026-10-19, "good"). One field: the title names the field ("Someone else changed the title while you were editing"; pt-BR "Outra pessoa mudou o campo “Título” enquanto você editava", which reads naturally whatever the label's gender), "Pick the one to keep. The other is discarded.", then You (your avatar or initials, "Your version · not saved yet") and Someone else ("Their version · already saved"); no dots, no Back or Next. Several fields: "Someone else also changed the title" (pt-BR "Outra pessoa também mudou o campo “Título”"), "Pick the one to keep. You can go back before saving." (pt-BR "Escolha qual versão manter. Dá para voltar antes de salvar."), the last step's summary "Title: yours · Cta › Label: theirs" (pt-BR "Título: a sua · …: a deles"). pt-BR buttons: "OK"; several fields "Voltar" / "Próximo" / "OK". The per-field switch layout (the mock's Option A) and its strings ("Yours" / "Theirs", "… changed 2 fields …", "Choose which version to keep for each field.") are removed. Screenshots from the v7 kit (LAN), light / dark: one field light / dark; three fields, step 1 light / dark; step 2 with theirs picked light / dark; the last step with the summary and OK light / dark.

  • Typing while the dialog is open: it is modal (focus is trapped), so nothing reaches the form behind it.

  • Removed: the "Changed while you were editing … The latest version was kept" toasts, mergedFormDisplay "on-leave" and FormBase.displayed / markEditedSinceDisplayed / formValueOnBase (typing on after the toast saved over theirs). Kept: one save at a time per form, the retry backoff, and the on-leave reload for a section replaced or a content sync while typing (not same-field specific).

  • A form save's page, page variant and section variant are now fixed when it is scheduled (FormSaveTarget), so a retry or a later choice writes to the section it was made for.

  • Copy in en and pt-BR (sectionsEditor.formConflict.*); unit tests form-conflict.test.ts (merge plan, choices, pointers, previews, word diff) and form-conflict-dialog.test.tsx (one field: title, cards as radios with yours chosen, diff marks in each card, one OK button saving the card chosen, arrow keys, initials, image previews; several fields: dots as buttons named by the field, "N of M", Next / Back / a dot / the ←/→ keys (not in a text field), ↑/↓ on a card, yours on every step, Back + Next on every step and Back + OK on the last, the last step's summary, OK saving the picks, a double click on Next not saving, the ring on a step whose version changed while open; markTheirsChanged).

Items 2 and 4 above (the on-leave display, typing on after the toast) are superseded by this dialog.

Who made the other change: not on v7 (PO 2026-10-16)

PO (final): "only have metadata and changed by on v8 hosted". The dialog on main shows no "changed by" line. 12633c0d8 reverts 46fe47593 and 9dcf8fb74: the changed-by route, commit-history reading, the copied history client and relative-time helper, and the e2e stub and config changes. This branch's tree equals b20846afd again.

Tests

  • 12633c0d8 (2026-10-16) reverts the who/when commits; the tree equals b20846afd, whose checks are below.

  • e2e site-editor-stale-form: "a form that saves again while its refused save is on the wire keeps both edits" "typing on after a save kept the other editor's value saves what the user typed, never mixed with that value" and "typing the same text again after the latest version was kept saves it" are new; "an edit to a value someone else also changed…" now checks the label, the shorter copy and the stored value after the user leaves the field. On a production build: 11/11 with the fixes (twice, 4 workers); without them the new tests fail (the stored headline stays "Published headline"). Toasts are counted as they appear and the waits allow for the fix(sections-editor): don't mistake a stale read of your own saves for someone else's change #8000 backoff, so a loaded machine doesn't fail them.

  • Unit tests: field labels (conflict-fields.test.ts), mergedFormDisplay / focusInside / formValueOnBase / markEditedSinceDisplayed (form-base.test.ts), the view transition (cms-editor-script.test.ts).

  • Same-field dialog (d97094779, d6bd6b995, b20846afd): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint and biome are clean; sections-editor + i18n unit tests 933 pass. e2e on a production web build (4 workers, clean database per run): site-editor-stale-form 12/12 twice (keep mine, decide later then use all theirs, mixed choices, different fields with no dialog, a third change while the dialog is open). b20846afd fixes the Keep mine case's check of the form behind the modal dialog (a modal dialog hides the rest of the page from role locators; it failed on the v8 branch's first run).

  • Before the dialog: tsc --noEmit (apps/web), oxlint and biome are clean; bun test for sections-editor and the preview: 912 pass (sections-editor).

  • Must-decide dialog, yours preselected (3a72b35e2, 6cf60af63, PO 2026-10-18): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint and biome clean; sections-editor + i18n unit tests 934 pass. e2e on a production web build (4 workers, clean database per run): site-editor-stale-form 12/12 (Escape and click outside don't close it, the default saves yours in one click, Use theirs for every field, mixed choices, a third change while it's open). The first run failed on the typing check: Radix's alert dialog focuses its Cancel button and this one has none, so keys still reached the form behind it; 6cf60af63 focuses the dialog itself, and the re-run passed 12/12. Checked by hand on the LAN spike kit with two editors in one draft: can't be dismissed, typing (with a space) stops at the dialog, one click saves yours, Use theirs keeps theirs and loads it into the form.

  • QA fixes (2026-10-19; 8b46c7acd, e81a12d0a, faa50196f, 7faee67b6): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint and biome clean; sections-editor + preview + i18n unit tests 1188 pass, new: the poll's lifecycle (starts on open, stops on close and unmount, one timer across renders, the latest read each tick, skips while a read runs / when asked / while hidden, slows after two minutes), refreshWaitingChoice (newer version in place, picks kept, nothing to refresh for the same copy / own save / other section type / no clash), the pageswap settle (cms-editor-script.test.ts, fails without the fix) and frame-navigation.test.ts. e2e on a production web build: site-editor-stale-form 13/13 with the new "the open dialog shows a newer version of theirs in place, with no click"; with fast-preview-git-sync, decofile-api and compact-page-layout: 37 pass, 2 compact-page-layout Library/header cases failed locally (a different one on a re-run, Preview case passing; CI's E2E passes on 7faee67b6). Real Chromium against the kit's store: two navigations about 30 ms apart after a 1.8 s-old page gave 8 uncaught errors in 60 pairs with the previous editor script and 0 with this one. On the LAN kit (hot-reloaded): B's dialog showed A's newer Title 0.3 to 3.6 s after it was stored, one conditional read every 3 s while open and none after; 15 quick saves in 3 rounds, 0 "Transition was skipped" (before the frame change, 2 of 3 rounds had one). QA video: http://192.168.15.11:8780/qa-8027/ (LAN).

  • Two cards (be52dec93, eca6e181d, PO 2026-10-19): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint, biome and knip clean; sections-editor + i18n unit tests 949 pass. e2e on a production web build: site-editor-stale-form 13/13 (a re-run; the first run's one failure was a socket hang-up in a test's setup write, before any dialog). On the LAN kit with two editors in one draft: both layouts in light and dark, yours chosen, "Use theirs" / "Keep a mix" stored as picked, no page errors. QA video re-recorded in one take on eca6e181d (every step re-checks the stored draft): 56/56 checks, 5:29, http://192.168.15.11:8780/qa-8027/ (LAN).

  • One field at a time (7929376db, PO 2026-10-19 "good"): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint, biome and knip clean; sections-editor + i18n unit tests 961 pass. e2e on a production web build: site-editor-stale-form 14/14 (new: two steps with Back, → and a mix stored as picked; "Use theirs for all" jumps to an unsaved summary, then stores theirs). CI on 7929376db: all checks pass. On the LAN kit with two editors in one draft: one field unchanged; three fields stepped through, Back, a mix stored as picked, light and dark, no page errors. QA video re-recorded in one take on 7929376db (step 4 is the stepper with the fast path; every step re-checks the stored draft): 67/67 checks, 6:31, http://192.168.15.11:8780/qa-8027/ (LAN).

  • Next and OK (96c4db3cd, PO 2026-10-19): apps/web and packages/e2e typecheck (tsc, single-threaded), oxlint, biome and knip clean; sections-editor + i18n unit tests 961 pass (new: Back + Next on every step, Back + OK on the last; the "Use theirs for all" test removed). e2e on a production web build: site-editor-stale-form 13/13 (OK in every case; no Next on the last step; the "Use theirs for all" case removed). CI on 96c4db3cd: all checks pass. Screenshots retaken on the LAN kit (one field, step 2, the last step; light and dark), 14/14 checks. QA video re-recorded in one take on 96c4db3cd (Next / Next / OK, OK in the single-field dialog; step 4 ends with B picking their Title by clicking the card; every step re-checks the stored draft): 69/69 checks, 6:28, http://192.168.15.11:8780/qa-8027/ (LAN).

The same fixes are on the Blocks v8 stack (#7888); this PR brings them to v7 sites without waiting for it.

🤖 Generated with Claude Code

https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu


Summary by cubic

Fixes the site editor's section form so two editors of the same block never lose an edit or type into someone else's text. A form sends one save at a time; a retry after a refusal reads the form's latest value, and a merge never swaps a field under the cursor while the form is still on the saved value.

Bug Fixes

  • The conflict toast uses the form's field labels, and one change shows one toast.
  • Rich text in the conflict dialog is read with DOMParser's textContent instead of regex tag stripping (CodeQL).
  • Preview view transitions settle all three promises, and a pageswap listener settles the outgoing page's transition, so skipped transitions no longer log an uncaught AbortError.
  • A Fast Preview frame loads one draft at a time: pointers arriving while the frame loads wait for it, then the latest goes in; a held navigation is released after 15 s.

Same-field conflicts: the user chooses

  • When both editors changed the same value, nothing of the form's is written and a dialog asks, field by field, whose version to keep; different fields still merge silently.
  • The dialog must be answered: no close button, and Escape or a click outside don't close it. Each step starts on yours.
  • The buttons are plain Next and OK (the "Use theirs for all" button and outcome-naming labels were removed per the product owner); OK saves the choices, guarded by the version the dialog showed. A newer change refuses the save and re-asks with that version, keeping choices that still hold.
  • While open, the stored block is re-read every few seconds so "their version" refreshes in place; on Fast Preview the read is conditional, so no new draft grant reloads the frame.
  • Who or when isn't shown on v7 (PO decision); copy is in en and pt-BR. The same fixes are on the Blocks v8 stack.

Written for commit 96c4db3. Summary will update on new commits.

View guided diff Turn on auto-fix

tlgimenes and others added 13 commits October 18, 2026 17:03
…rtError

Quick successive saves skip the running view transition; its ready and
updateCallbackDone promises then reject with "Transition was skipped" and
only finished was handled. The swap now settles all three.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…e can't drop the next edit

Under load the form's autosave could send a second save while a first one
was still on its way. When the first was refused as stale, the second was
built on a copy that never landed: mutate() reported only its outcome, its
starting point was put back to the unsaved first edit, and the replay on
the stored block then counted the user's own edit as a conflict and kept
the stored value. The user's edit was lost and the toast named the wrong
field (seen on a v7 site with two people on one block).

- A section form now has one save on the wire at a time; the next is built
  once that one lands or is refused (mutateAsync, so every outcome is
  heard). A retry after a refusal reads the form's value when it runs.
- The conflict toast names fields by their label in the form ("Headline",
  not "title"), says "The latest version was kept." when nothing else of
  the form's was left to save, and every outcome of one change shares one
  toast.
- With main's #8000, a refused save is retried with backoff (up to 3
  times) before the form reloads; while a retry waits out its backoff the
  form's next saves wait behind it, as behind a save on the wire, and the
  retry carries the form's latest value.

Tests: e2e "a form that saves again while its refused save is on the wire
keeps both edits" (fails before: the headline goes back to the stored one
with a "Changed while you were editing: headline" toast); the same-field
e2e now expects the label and the shorter copy; unit tests for the labels.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
Under load the form's autosave fires while the user is still typing. When
the save comes back merged and the merge kept another editor's value of
the field being typed in, the form showed that value at once, so the next
keystrokes landed after it ("Picks A again" + "holk" ...) and the mix was
saved as the user's edit, over the other editor's value. The reload after
the last retry re-seeded the form under the cursor the same way.

While focus is in the open form, those now wait: the form keeps showing
what the user types (its saves keep merging onto the stored section, so
the field keeps the stored value) and re-reads the stored section once
the user leaves the form and its own saves have settled. Merges that kept
every edit of the form still show at once.

Tests: e2e "typing on after a save kept the other editor's value does not
add the keystrokes to that value" (fails before: the field reads
"Published headline more"); the same-field e2e checks the stored value
after the user leaves the field; unit tests for mergedFormDisplay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
When a save kept another editor's value of the field the user is typing in,
the form keeps showing their text until they leave it (05d4ae5), but its
baseline stayed the refused copy. Their next keystrokes were merged against
that copy again, lost to the stored value with a second toast, and the field
went back to the stored value when they left it: the edit was gone.

The form's baseline is now the merge it saved, and FormBase.displayed holds
what the form shows instead. A field the user changes after the notice is
saved over the stored value they were told about; a field they leave alone
keeps the stored value; a change from elsewhere after that is still caught
by #7909's check. Nothing is ever a mix of both texts.

Tests: e2e "typing on after a save kept the other editor's value saves what
the user typed, never mixed with that value" (fails before: the stored
headline stays "Published headline"); unit tests for formValueOnBase and
displayedOverBase. The spec's toast and poll waits allow for main's backoff
retry (#8000) under load, and toasts are counted as they appear.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…pt" saves it

After a save kept another editor's value of the field the user is in, the
field still shows the user's text (until they leave the form). A user who
insists, selecting it and typing the same text again, ended with the value
the form already showed, so nothing counted as changed: the save kept the
stored value and the field flipped to it when they left.

Every value the user changes after the merge is now marked in
FormBase.displayed, so it is theirs even when it ends as it was shown.
Values they don't touch still keep the stored value.

Tests: e2e "typing the same text again after the latest version was kept
saves it" (fails before: the stored headline stays "Published headline");
unit tests for markEditedSinceDisplayed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
"a form that saves again while its refused save is on the wire keeps both
edits" counted the toasts on screen after a poll of up to 30 s; on a busy
machine the toast had already expired (count 0). Toasts are now counted by
text as they appear, as in the typing-on test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…keep

When the user and someone else changed the same values of a section, the
form no longer keeps the stored value with a toast and the "on-leave"
heuristics. Nothing of the form's is written: its saves wait, and one dialog
("Someone else changed this while you were editing") lists each value by
its form label, "Your version" next to "Their version" (a word diff for
text, a thumbnail for images, a summary for lists and objects), with "Keep
mine" / "Use theirs" per field and "Keep all mine" / "Use all theirs".
Apply saves the choice against the stored version the dialog showed (the
save's `expect`); a newer one refuses it and the same choice is asked again
with that version. "Decide later" keeps their version stored and the
user's edits in the form, unsaved, with a "Choose versions" notice. Values
only one side changed still merge silently, now item by item within lists.

Removed: the "Changed while you were editing" toasts, mergedFormDisplay
"on-leave", FormBase.displayed (typing on after the toast saving over
theirs). A save's page, page variant and section variant are fixed when it
is scheduled, so a choice made after the user moved on still writes there.

(Port of 731befa from the v8 stack, without the v8 parts.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
site-editor-stale-form: keep mine, decide later then use theirs, mixed
per-field choices, different fields merge with no dialog, a third change
while the dialog is open asks again with the newer version. The hero
fixture gains a Subtitle field.

(Port of c63ee03 from the v8 stack, without the deco-serve case.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
The Keep mine case checked the headline after typing into the open dialog
with the form's role locator. The dialog is modal, so everything outside it
is aria-hidden and the locator found nothing ("element(s) not found", the
form showing "Draft headline" behind the dialog in the screenshot). The
check now includes hidden elements.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…, and when

GET /api/:org/decofile/:project/:branch/changed-by?block=<key> (1 to 5 keys,
signed-in members only) answers { changedBy: { [key]: { name?, email?,
avatarUrl?, at, you? } } } for the "someone else changed this" dialog. The
editor asks once per version the dialog shows, never per poll.

Nothing new is stored: the block file's latest commit on the draft branch
(insights listCommits with a new `path` filter, limit 1: one GitHub call per
block) gives the Co-authored-by trailer the commit coalescer appends, else
the commit author when it is a person, and the commit time. The identity is
mapped to the org member (name, avatar) by email, else the git name; `you`
when it is the viewer. Unknown parts are left out.

Insights commits now carry the message body (where the trailers are), and
insightsClientForProjectRepo opens a project's history client, as on the
Blocks v8 line (#7887).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…nge, and when

Under the dialog's title: "Changed by Ana Souza · 3 minutes ago" with the
member's avatar and the exact time on hover; "You, in another tab or window
· …" for the viewer's own change; "Changed … ago" when only the time is
known. No line while it isn't known (never "unknown"). en and pt-BR.

A Fast Preview session asks Studio's history (GET …/changed-by) once per
version of theirs the dialog shows, never per poll: "Their version changed
again" reads who and when again. A sandbox session shows nothing. The
conflict remembers the block its save writes (a saved block, else the page).
formatRelativeTime comes from the Blocks v8 line (#7888).

e2e (written, not run here): stale-form asserts "You, in another tab or
window" for the same user's other save and "Changed by Dev Person" after a
developer's push while the dialog is open. The GitHub stub gains the
GraphQL commit history (as on #7888) with a path filter, commit dates and
authors, and an admin push; the API's GraphQL URL points at the stub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
This reverts commits 9dcf8fb and 46fe475. PO (final): "only have
metadata and changed by on v8 hosted": a v7 (Fast Preview) dialog shows no
"changed by" line. The dialog itself stays. Gone with it: the changed-by
route, commit trailer/author parsing, insights' path filter and message
body, insightsClientForProjectRepo and formatRelativeTime copied for it, the
GitHub stub's history and push, and the GraphQL URL in the e2e config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
…ver regex sanitizing

CodeQL flagged the tag stripping and entity decoding (incomplete multi-character
sanitization, double unescaping). Text now comes from DOMParser's textContent;
without a DOM, tags are dropped until none is left and each entity is decoded once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
@tlgimenes
tlgimenes force-pushed the fix/site-editor-concurrent-form-saves branch from f27c612 to 166bf6f Compare October 18, 2026 20:04
tlgimenes and others added 11 commits October 18, 2026 21:15
…cted

PO 2026-10-18: "Keep yours" / "Use theirs" wording, and "If the user needs
to decide, we need to raise an alert dialog with no close option" (Decide
later left the form in a frozen state). Picked: must-decide, yours
preselected.

- FormConflictDialog is an AlertDialog with no close button; Escape and a
  click outside don't close it. Only "Save selected versions" does.
- Every conflicting field starts on "Keep yours" (defaultConflictChoices);
  a re-plan (their version changed again) keeps the choices that still
  hold and puts the rest back on yours. "Use theirs" switches every field.
- Removed: Decide later, the "not saved yet / Choose versions" notice,
  conflictDialogOpen, reviewFormConflict, everyConflictChosen and their
  strings. One save at a time and the expected-version guard are unchanged.
- pt-br: "Manter a sua" / "Usar a deles" / "Salvar versões escolhidas".
- Tests: unit (default yours, one click, mixed, switch all, no close
  affordance); e2e stale-form drops the decide-later case, adds Escape /
  click outside, default saves yours, Use theirs for every field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
Radix's alert dialog focuses its Cancel button on open; this one has none,
so focus stayed in the form behind it and keys typed after the dialog
appeared still reached the field (the stale-form e2e caught "Draft
headlinexyz"). Focus the dialog itself: typing stops there, and a space
typed mid-word can't press a button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
… uncaught AbortError

A site that opts into cross-document view transitions
(`@view-transition { navigation: auto }`, as the Storefront v7 store does)
gets one on every reload a Fast Preview save makes. When the next save
navigates the frame before that transition starts, Chrome skips it and
rejects the outgoing page's `pageswap` transition `ready` promise with
"AbortError: Transition was skipped". Nothing handled it, so the editor's
page logged an uncaught error (QA-8027, step 8).

The editor script, injected into every preview page on load, now settles
the promises of the outgoing page's transition from a `pageswap` listener
(registered once per page and kept after deactivate), with the same helper
the in-place swap already used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
While a same-field dialog was open nothing read the stored blocks again,
so "their version" stayed the copy the dialog opened with; a newer save
only showed after "Save selected versions" was refused (QA-8027, step 5).

While a dialog is open, the editor's own decofile read runs again every
3 s (15 s after two minutes open), one poll however many fields or waiting
saves, stopped when the dialog closes. A tick is skipped while a write is
on the wire, a read is running or just landed, or the tab is hidden. On
Fast Preview the read first asks the branch head conditionally
(`If-None-Match`, the same GET): an unchanged branch answers 304, with no
body and no new draft grant, so the preview pointer (and frame) stays put.
The newer copy goes through the existing render-time re-plan, now
`refreshWaitingChoice`: their version in place, "Their version changed
again while this was open.", picks kept where both versions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
Every save gives the preview a new `?__draft=` pointer, and React set it on
the frame at once, even while the frame was still loading the last one.
That cancels the load (its render is wasted, so quick saves showed nothing
new until they stopped), and on a site with page-to-page view transitions
(`@view-transition { navigation: auto }`) the page being left rejects its
`pageswap` transition with "AbortError: Transition was skipped". Measured
on the kit: the store answered about 0.9 s after a save's navigation, the
next save's pointer came 0.5 s later, before the page committed (QA-8027,
step 8). The editor script settles that promise where it runs, but a v7
site only runs it for the origins its LiveControls trusts.

A Fast Preview pointer that arrives while the frame loads now waits for
the frame's load; then the latest goes in, the ones in between skipped.
A held navigation whose load never fires is released after 15 s. Other
frames (sandbox, Local) follow their src at once, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
"Your changes were applied on top of the latest version" read like an
override. When different fields were changed, both edits are kept, so it now
says so: "Someone else also edited this block. Both changes were kept."

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
The product owner picked "Option B: two people, two cards" ("i like the
friendliest option b") for the dialog that asks whose version to keep.

One field in conflict, the common case: "Someone else changed the title
while you were editing", "Pick the one to keep. The other is discarded."
Two whole-card choices, stacked: "You" (your avatar or initials, "Your
version · not saved yet") and "Someone else" ("Their version · already
saved"), each with its text and the changed words marked. Each card is a
radio (arrow keys move the choice). Yours is chosen; the one button names
what saving does: "Keep yours" or "Use theirs".

Two or more fields: a row per field with its label, a Yours / Theirs switch
and that side's value. "Use theirs for all", and a button that names the
outcome: "Keep yours", "Keep a mix" or "Use theirs".

Unchanged: it must be answered (no close button, Escape or click outside),
it follows their newer version in place while open, images, lists and
objects keep their previews. Strings the old layout used are removed;
pt-br says "o campo “Título”", which reads naturally whatever the label's
gender.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
The product owner approved "one field at a time" for a conflict on several
fields ("good"), replacing the Yours / Theirs switch per field.

Each field gets a step with the same two cards as the single-field dialog,
yours chosen: "Someone else also changed the title", "Pick the one to keep.
You can go back before saving." A dot per field (a button named by it; the
current one wider, the ones moved on from filled) and "1 of 3" above. Next
keeps the pick and moves on; Back, a dot or the ←/→ keys revisit a step
(not while typing in a text field; on a card, ↑/↓ change the pick). The
last step sums up the picks ("Title: yours · Button text: theirs") and its
button names the outcome: "Keep yours", "Keep a mix" or "Use theirs".
Nothing is saved before that click, and the second click of a double click
on Next doesn't count as one.

"Use theirs for all" stays on every step: it picks theirs everywhere and
goes to the last step, so saving is still one click on "Use theirs".

When their version changes again while the dialog is open, the steps show
the newer values, the picks that still apply are kept, and the dot of each
field whose value changed gets a ring until it is visited
(markTheirsChanged counts the changes per field).

One field is unchanged: no dots, no Back or Next. The switch layout's code
and strings are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
The product owner asked for plain step buttons: "Remove the 'use theirs
for all' button", the primary as "next/next/done", then "instead of done,
ok".

With several fields, every step but the last shows Next and the last one
OK, which saves the picks as "Keep yours" / "Keep a mix" / "Use theirs"
did. The single-field dialog's button is OK as well. pt-br: "Próximo" and
"OK".

"Use theirs for all" is gone from every step, with its strings, unit test
and e2e case; so is the label that named the outcome and its strings.
Cards, dots, Back, the last step's summary, the arrow keys, the must-decide
dialog, the refresh ring, yours preselected and the double-click guard on
the last Next are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu
@tlgimenes
tlgimenes merged commit fbb64f0 into main Oct 19, 2026
23 checks passed
@tlgimenes
tlgimenes deleted the fix/site-editor-concurrent-form-saves branch October 19, 2026 17:48
decocms Bot pushed a commit that referenced this pull request Oct 19, 2026
PR: #8027 fix(web): concurrent section form saves keep every edit and never type into someone else's text
Bump type: patch

- decocms (apps/api/package.json): 4.500.2 -> 4.500.3
- @decocms/e2e (packages/e2e/package.json): 1.119.0 -> 1.119.1

Deploy-Scope: web
tlgimenes added a commit that referenced this pull request Oct 19, 2026
…ish and releases, site tokens (#8062)

* feat(shared): Blocks v8 detector, blocksMajor runtime marker, secret ciphertext

- blocks-major: the one place that decides whether a project is a Blocks v8
  site (isV8Schema / isBlocksV8Project), with a guard test that no other file
  decides v8 or reads meta.gen.json for it.
- session-runtime: a v8 project (server-managed blocksMajor: 8) with a preview
  server always has Fast Preview; v7 keeps its switch, unchanged.
- secret-ciphertext: the sealed-box format shared by the server and editor.
- site-editor is a reserved organization slug (it is a top-level route).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): Blocks v8 content protocol, hosted Deco CMS releases and site tokens

Server side of Blocks v8 (no UI calls any of it yet; v7 projects are
unchanged):

- decofile routes: POST /api/:org/decofile/:id/:branch/rpc serves the
  Blocks content protocol (createContentHandler from @decocms/blocks) over
  the repository (decofile/repo-content-storage.ts), plus hosted draft
  publish and its status. gen-artifact.ts is the shared blocks.gen.json
  regeneration and commit message the commit coalescer now uses.
- hosted/: the delivery bucket (R2 through its S3 API) and its CDN purge,
  drafts, releases (list + roll back the current one), publish, site
  tokens (Ed25519), the v8 scope checks and the blocksMajor marker that
  caches main's isV8Schema answer on the project. Unconfigured (no
  DELIVERY_R2_* / DECO_SITE_TOKEN_SIGNING_KEY) they answer 'not configured'.
- /api/:org/hosted/:id/{releases,site-tokens}; admin backfill route that
  links existing v8 projects to their org_sites row and syncs the marker.
- project create claims a free site slug for its org (never another org's,
  a deleted org's, or a deco.cx one) and gives a linked site its managed
  asset config; the deco.cx import shares that config code
  (file-storage/managed-site-config.ts). A new thread on an unmarked
  repo-backed project checks for v8 first (bounded) so it gets the cms
  runtime for life.
- the managed assets' public base defaults to https://assets.decocms.com.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): serve a sandbox's content protocol over the daemon's fs routes

The sandbox daemon stays files and git only (packages/sandbox untouched).

POST /api/:org/sandbox/:id/:branch/rpc now runs the same protocol core
GitHub mode uses (createContentHandler) over a new storage,
apps/api/src/sandbox/content-storage.ts, backed by the daemon's existing
authed routes:

- listing: one /_sandbox/bash call hashes `.deco/blocks/*.json` and the
  schema/secrets files with `git hash-object` (exact git-blob versions of the
  uncommitted working tree; the daemon has no stat route);
- reads: /_sandbox/read in parallel, only for versions the core's per-sandbox
  body cache lacks (handlers stay warm per claim, LRU of 16);
- apply: under a per-sandbox lock, a fresh listing checks every expected
  version and the schema's (stale -> the protocol's Conflict/retry), then
  ordered /_sandbox/write and /_sandbox/unlink calls, rolled back on failure;
  the listing cache is invalidated after every write.

The daemon e2e conformance suite moves with it: the published conformance
suite, the byte-for-byte parity run against the reference fs server and the
sandbox-specific cases now run against the Studio route, over an in-process
stand-in for the daemon's fs routes (unit) and over the real main daemon
(content-storage.daemon.e2e.test.ts, run by the Sandbox workflow).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* fix(api): a sandbox poll right after an agent edit reads it instead of failing

The sandbox listing is reused for 250 ms. When the agent wrote a block in
that window and the core had to read its body, the bytes never matched the
reused listing, so all three of the core's snapshots saw the same stale
versions and the poll failed with "saved blocks kept changing while being
read". A body that disagrees with the listing now drops it, so the core's
next snapshot is fresh. Found by driving the real main daemon with an agent
writing through /_sandbox/write while the editor polled and saved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* test(e2e): the decofile API's 404 for a project with no repository is coded

The decofile routes now answer {error, code: "no_repository"} (the editor
reads that code as a v7 answer), so the spec expects the code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* fix(api): sandbox listings go through a file, and a failed apply puts back the file in flight

- The listing no longer travels through /_sandbox/bash stdout, where the
  daemon keeps only the last 256 KiB: big sites lost the head of it, and past
  ~6.4k blocks it parsed as an empty site that an apply could overwrite. The
  command writes it to a file in the sandbox's tmp and prints its path; Studio
  reads it back through /_sandbox/read. A `truncated` answer is refused, and the
  listing (one `<hash> <path>` line per file, then `@end`) is refused unless
  complete, so a cut can never read as a short or empty site.
- Hashes come from git's index for the files git's own path + mtime + size
  check says are unchanged, and `git hash-object` runs only on changed,
  untracked or filtered files. The task's output is one line, so a retained
  daemon task costs almost nothing.
- commit() marks each file as touched before its daemon call, so a write or
  unlink that landed but then timed out or lost its connection is rolled back
  with the rest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* test(api): the route test's stand-in daemon answers the listing through a file

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* fix(api): a hosted draft drops a block written back to main's content

A discard in the v8 editor writes main's version of a block back through
blocks.apply. applyAttemptToDraft now drops the draft entry when the put
equals main's one file for that name (by blob sha, else as JSON values)
instead of keeping a copy, which would shadow a later change on main and
never let the draft be empty. The write reports main's version for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): Republish rolls forward to an earlier release; no pointer flip

Releases no longer move latest.json back to an older commit. Republishing a
release (POST hosted/:vmcp/releases/:sha/republish) commits that release's
.deco/blocks/*.json on main (only the files that differ: copied from the
release's commit, blocks added since deleted; schema, index.ts and the rest
of the code untouched), then runs Publish's release path (companion release,
latest.json, purge), with the same main-moved conflict check. A release made
for another schema asks again (409 schema-mismatch) and goes live once
confirmed.

The message follows git's revert convention: "Republish: <note>", never
chained, "Republish: release from <date UTC>" for a release without a note,
plus a Republished-From: <sha> trailer that Releases returns as
`republishOf`.

Releases also returns `serving`: the release the site reports serving, from
its telemetry in the stats lake (deco.release on the upstream-fetch
histogram and the error logs, last 15 min; a bundled snapshot's content
revision is matched to the newest release with that content). A source
that fails (no grant on the histogram yet, a timeout) is skipped; none
answering is `{ source: "none" }`, the pointer fallback.

makeCurrent and its { sha, confirm } route are gone; releases/current keeps
only { head: true }, Publish's "Try again". Content clients gain
readCommit; insights commits carry the message body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* test(api): a Bitbucket commit carries the rest of its message as body

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): Reapply version replaces Republish; no served-revision reads; releases/retry

Reapplying a version (POST hosted/:vmcp/releases/:sha/reapply) still rolls
forward: a new commit on main with that version's .deco/blocks/*.json (only
the files that differ), then Publish's release path with the same main-moved
check. A version made for another schema is no longer refused or asked
about twice: it is reapplied, and the result carries `schemaChanged` (also
logged) so the screen can say how to go back. GET releases/:sha/reapply
answers `{ schemaChanged }` before the user confirms: it compares the
schema's blob ids at both commits and only hashes the schemas when they
differ (a formatting-only change is not a change).

The message is "Reapply: <note>" (never chained; "Reapply: version from
<date> UTC" without a note) with a Reapplied-From: <sha> trailer, returned
by Releases as `reapplyOf`.

Releases no longer reads what the site serves: hosted/serving.ts and the
`serving` field are gone. `current` is the latest.json pointer, nothing
more. Publish's "Try again" moves from releases/current to releases/retry
(releaseMainHead); releases/current no longer exists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* fix(api): Reapply reports a schema change; an older original keeps its date

reapplyVersion looked for .deco/schema.gen.json in listDecofileEntries,
which (on GitHub, GitLab and Bitbucket) lists only blocks.gen.json and
.deco/blocks/*, so schemaChanged was always false and the toast never
said how to go back. Both the check and the reapply now read the schema's
entry with getEntriesAtPaths. The test fake's listDecofileEntries now lists
what the real providers list, which is what hid this.

Releases also reads the date of a reapplied version's original when it is
not on the same page (one commit read each), so the row can still say
"Same content as the version from <date>".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): changes.* on hosted and sandbox content (@decocms/blocks 8.2.1)

Pins @decocms/blocks to 8.2.1 (content protocol 1.1) and gives both
Studio content storages the three new primitives, so changes.list,
changes.get and changes.discard answer on every v8 source.

- Hosted: the base is main's head. The changes are the files the draft
  makes differ from main (its own names; a set byte-equal to main isn't
  one), base bodies come from main by blob sha, and a discard drops the
  names from the draft so main shows through whatever its bytes or
  spellings. expectedBase is checked against main, and a discard's
  expected versions inside the draft lock.
- Sandbox: the base is HEAD, read in the same listing (one bash call per
  poll): commit, branch, ls-tree blob ids, and git's filters confirm
  files that only differ by a checkout conversion. Base bodies come from
  cat-file --filters as base64. A discard unstages what it restores
  (reset / rm --cached, both sides of a staged rename) and puts the index
  back if a write fails, as deco serve 8.2.1 does. No daemon changes.
- The v7-main storage answers an empty base.
- The v8 answers on /git/status, /git/diff and /git/discard are gone:
  hosted/draft-publish-status.ts is deleted and sandbox-proxy.ts is back
  to main's text for those routes; the editor uses changes.* instead.

Tests: the published 8.2.1 conformance suite (changes cases included)
over hosted (stub main + draft store, baseEntry) and sandbox (committed
base, and an unborn one), the parity run with changes.* calls against a
deterministic commit, CRLF, unstaging, app root and stale-base cases;
the same suites pass over the real Go daemon.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* test(api): a hosted discard through changes.discard follows main; drop unused exports

The hosted discard case the web branch carried (it drove the deleted
draftGitDiscard) now discards through the content protocol, and checks
the discard's revision is the next read's. draftFileChanges and the
sandbox suite's base entry name are module-private again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* fix(api): a reapplied release without a note is named "release from <date>"

The Releases screen says "release", never "version": the server-written
fallback note follows ("Reapply: release from <date>", "Reapply: earlier
release").

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WNwbSEePYNcY5YCgqZURig

* feat(api): changed-by tells the site editor who made the other change, and when

GET /api/:org/decofile/:project/:branch/changed-by?block=<key> (1 to 5 keys,
signed-in members only) answers { changedBy: { [key]: { name?, email?,
avatarUrl?, at, you? } } } for the "someone else changed this" dialog. The
editor asks once per version the dialog shows, never per poll.

- Fast Preview (v7): nothing new is stored. The block file's latest commit on
  the draft branch (insights listCommits with a new `path` filter, limit 1:
  one GitHub call per block) gives the Co-authored-by trailer the coalescer
  appends, else the commit author when it is a person, and the commit time.
- v8 hosted drafts are not git: each draft save now records, per draft name,
  the Studio user and time in the org KV record next to the draft slug
  (never in the draft object, which anyone with its URL can read). Discarded
  or published names drop their record. A block the draft doesn't hold falls
  back to main's history, like v7.
- The identity is mapped to the org member (name, avatar) by user id or
  email, else the git name; `you` when it is the viewer. Unknown parts are
  left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* feat(api): a v8 draft's who-changed-what is public next to it, ids and times only

PO: "write on the public draft, no worries. write the user_id and grab user
data on the front maybe". Each hosted draft save writes, per name it
changed, { userId, at } to sites/<site>/drafts/<slug>.edits.json, next to
the draft, instead of the org KV. The draft object itself stays exactly
{ set, delete }: every released @decocms/blocks 8 refuses a draft with any
other field (parseDraftChanges: "unexpected field"), and the SDK never
reads the sibling, so the ids can't reach a rendered page. Publish removes
both objects; the KV record is the slug again.

The session GET answers `edits` with `?edits=1`: every name the draft holds,
{ userId, at } or null when not recorded; the editor resolves the people
from the org's members. changed-by no longer reads the draft: on a v8
project it answers main's history for the keys asked (the editor asks only
for names the draft doesn't hold).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* feat(api,shared): who edited a block last lives on the block (`__meta`); no sidecar

PO: "just add, on the block a metadata … something that tells last edited
by. but on the same json" and "do not create an edits.json please".

- Removed: the draft's `<slug>.edits.json` sidecar (written, read, deleted
  on publish), DraftStore.edits / stampDraftEdits / heldDraftEdits, the
  session GET's `?edits=1`, and the ref's `editor`. The draft is the one
  object a save writes, `{ set, delete }`, and publish copies its blocks to
  main as they are, `__meta` included (blocks drops it when resolving).
- @decocms/shared: BLOCK_META_KEY (`__meta`: { lastEditedBy: <Studio user
  id>, lastEditedAt: <ISO 8601> }), blockMetaOf, stampBlockMeta (the editor
  stamps every saved block). It isn't content: canonicalBlockJson (so
  decoBlockFingerprint, Fast Preview's `expect`) ignores it, and
  mergeBlockJson keeps the preferred side's record without a conflict.
- Hosted draft storage: a put of main's content with a new `__meta` is
  still main's content (no draft entry).
- changed-by stays the fallback for blocks without `__meta` (git history:
  the draft branch on Fast Preview, main on v8).

Tests: shared fingerprint/merge (ignored, stamped, dropped without a user,
no conflict), draft-content-storage "a save writes only the draft object"
(one object, one put, `__meta` kept in it; main's content restamped is no
change); draft-store.test.ts (the sidecar's) removed, publish logs back to
one delete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* Revert who/when from git history, the draft sidecar and block __meta

This reverts commits d3df85b, 92038d9 and e3544e9. PO (final): "only
have metadata and changed by on v8 hosted". Fast Preview (v7) and Localhost
show no "changed by" line, so the changed-by route, the commit trailer and
author parsing, insights' `path` filter, block `__meta` (shared helpers,
canonical-JSON ignore, merge rule) and the draft's edits record all go; the
next commit keeps who and when in the hosted draft object's metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* feat(api): a hosted v8 draft records who changed each block in its object metadata

PO: "only have metadata and changed by on v8 hosted". Each draft save writes
`x-amz-meta-deco-edited` on the draft object (S3 metadata, which R2 keeps):
`<name>,<userId>,<base-36 seconds>` entries joined by `;`, name and id
URI-escaped (ASCII), oldest first, capped at 1900 bytes under the 2 KB of
user metadata an object may carry, dropping the oldest entries first. The
JSON stays exactly { set, delete }; no block carries anything.

- DeliveryStore.putJson takes metadata; get returns it.
- DraftStore: load decodes the editors from the GET it already makes, and
  update stamps the names a save changed with the ref's editor (the session
  user), keeps the others, drops names no longer in the draft, and writes
  them with the draft: no extra HEAD per save.
- The session GET answers `changedBy: { [name]: { userId, at } }` next to the
  draft pointer, read from the same GET.

Tests: draft-editors (encode/decode with any characters, malformed values,
the cap dropping the oldest, stamping), draft-store (carried forward across
saves, one object, JSON free of ids, one put per save, discard and publish).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* feat(web): Blocks v8 site editor, hosted Publish, Releases and site tokens

The site editor on the Blocks v8 content protocol (hosted drafts, deco
serve, sandboxes), hosted Publish and Releases, site tokens, and the v8
parts of the section-form conflict handling: the ifMatch guard on every
v8 section save, and on hosted v8 drafts the conflict dialog names who
made the other change and when ("Ana changed the title…", their avatar,
"saved 3 minutes ago"), read from the draft object's metadata.

Rebased on main after #8027 (concurrent saves and the conflict dialog for
v7) merged as fbb64f0. This branch carried the same dialog/save changes
as cherry-picks (F4-F15); main's version of that shared code is kept
as is, and only the v8 additions sit on top of it. The web side was
squashed (replaying each cherry-pick on top of its own squash was
impractical); it replaces these commits (e2e changes in the next commit):

- feat(web): Blocks v8 site editor, hosted Publish, Releases and site tokens (ee9dc4b)
- test(web): a six-level self-referencing menu renders and edits every level (A9) (d04ba3d)
- fix(web): v8 section saves refuse to overwrite a block someone else changed (5bcaf7f)
- fix(web): opening Settings with no CMS block no longer creates CMS.json (45c2f9c)
- fix(web): "." on a page opens that page, not the catch-all template's (d9faba6)
- fix(web): a skipped preview transition no longer logs an uncaught AbortError (8e30608)
- fix(web): a section form saves one change at a time, so a refused save can't drop the next edit (0462d9b)
- fix(web): a deep link to Releases waits for main's schema instead of bouncing to Settings (38fa751)
- fix(web): a merge never swaps a field under the user's cursor (8d785f4)
- fix(web): what a user types after "The latest version was kept" is saved (6ce2aa9)
- fix(web): typing the same text again after "The latest version was kept" saves it (b3a6d74)
- feat(web): a same-field edit conflict asks the user whose version to keep (6736660)
- feat(web): the same-field conflict dialog says who made the other change, and when (843b212)
- feat(web): a hosted v8 draft's who-changed-what comes from the draft, people from the org (c4af50c)
- feat(web): every save stamps the block's `__meta`; the dialog reads it first (4cd6626)
- Revert the web's who/when from git history, draft edits and block __meta (3c8bcd2)
- feat(web): the same-field dialog says who and when on hosted v8 drafts only (3cb4269)
- fix(web): the conflict dialog reads rich text with the DOM parser, never regex sanitizing (4400428)
- feat(web): the same-field dialog must be answered, with yours preselected (2e9e5e3)
- fix(web): a skipped page-to-page preview transition no longer logs an uncaught AbortError (8cdb102)
- fix(web): the open conflict dialog follows their version in place (f27634b)
- fix(web): a Fast Preview frame loads one draft at a time (ee7cf18)
- fix(web): the merge toast says both changes were kept (580f814)
- feat(web): the same-field dialog shows two people, two cards (d6675e1)
- chore(web): applyLabel is not exported (43b28fd)
- feat(web): several conflicting fields are asked one at a time (e533e43)
- feat(web): the conflict dialog's buttons read Next and OK (6f9ab40)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* test(e2e): Blocks v8 content protocol, deco serve, hosted drafts, Publish and Releases

The e2e side of the previous commit: the content protocol over GitHub,
deco serve and its stub, hosted drafts, Publish, Releases and changes.*,
and the v8 cases of the stale-form and same-field dialog specs (who made
the other change on hosted v8). Squashed with the web side; it replaces
these commits plus the e2e parts of the web commits listed there:

- test(e2e): Blocks v8 content protocol, drafts, Publish, Releases and changes.* (463f8cc)
- test(e2e): the deco serve spec follows the UI and its stub, on a production build (9ae3629)
- test(e2e): the CMS settings guard test holds the editor's polls (f54b9bc)
- test(e2e): stale-form toasts are counted as they appear (e725bdb)
- test(e2e): same-field conflicts go through the choose-versions dialog (6ec2500)
- test(e2e): find the form behind the conflict dialog with includeHidden (024b6f3)
- test(e2e): the hosted session read answers changedBy next to the draft pointer (b5d7979)
- test(e2e): the GitHub conformance run opens one socket per request (695fca3)
- test(e2e): the open conflict dialog shows a newer version of theirs with no click (1f2d72f)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

* chore: @decocms/blocks 8.4.0

api, web and e2e move from 8.2.1 to 8.4.0 (published, latest). Studio
imports only /protocol, /protocol/server, /protocol/storage/fs,
/protocol/keys, /protocol/conformance and /secrets; none of them changed
between 8.2.1 and 8.4.0 (8.3.0/8.4.0 add /image, /preview and /vite, the
NODE_ENV dev default, schema --check and multivariate first-match, and an
optional vite peer), so no code changes. bun.lock gains only the
@decocms/blocks entries. The legacy-secret-guard test no longer points
at a patch that was dropped long ago.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016ZsmzpZ2zahRBoATBb2tBu

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude PR authored by a coding agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants