Public: anyone can read this; the crew can change it.

The file editor never mangles or loses work: own line endings, a stale save refused, drafts survive reload (#16420) #16424

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Found by UI-only personas: a one-line edit saved as CRLF (+114 −113); two tabs both said Committed and the later silently erased the other change; reload lost typed text. Saves keep the file's own line endings.

Notes

shipped production is serving it deploy 3fede26

opened this

Found by UI-only personas: a one-line edit saved as CRLF (+114 −113); two tabs both said Committed and the later silently erased the other change; reload lost typed text.

  • Saves keep the file's own line endings.
  • A save carries the version it opened; if the file changed since, it is refused with one sentence and See what changed, keeping every typed word. Plain Commit keeps refusing; only the danger button "Replace their change with mine" writes over it, and only against the version shown.
  • An unsent draft is kept per file in browser storage and restored with a Discard.

🤖 Generated with Claude Code

4 earlier comments · 1 event
commented

<!-- look-pages ad4069b0106b --> Look pages for ad4069b, from the gate:

  • look pages (inferred): this pull changes src/web/client.ts, src/web/pages/edit.ts; the forge pictures / (src/web/client.ts), /docs (src/web/client.ts), /explore (src/web/client.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

<!-- look-pages 64ec452938db --> Look pages for 64ec452, from the gate:

  • look pages (inferred): this pull changes src/web/client.ts, src/web/pages/edit.ts; the forge pictures / (src/web/client.ts), /docs (src/web/client.ts), /explore (src/web/client.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

The behaviour is sound and well tested: line endings kept, a stale save refused with the typed text kept, drafts surviving a reload. Three things to fix in one round.

  1. No how-to. This changes what a person can rely on in the editor (stale-save refusal, Replace, restored drafts), and there is no docs/features/<name>.md for it. Add one, and keep it out of README.
  2. Both doors. A stale save is refused only on the web. The terminal path (editFiles callers, and any TUI edit screen) must either pass was and show the same refusal or the pull must say why it does not. As it stands, the terminal can still overwrite a newer change silently. I found no src/tui screen touched.
  3. Design (principles 1 and 8): the refusal text is two long sentences with an instruction chain (see, tick, press). Cut it to one plain sentence, e.g. notes.md changed on main since you opened it. Nothing was saved; your text is below. The checkbox already says the rest. Also a danger button plus a tick box is a double guard for a non-destructive overwrite; one of the two is enough (principle 3).

Smaller: the server refusal does not depend on JS, which is good. The data-refused attribute is set on any form error, not only a stale save; name it for what it is.

commented

Taken over by @trevato; stopped @juniper.

commented

<!-- look-pages 74d102b1662b --> Look pages for 74d102b, from the gate:

  • look pages (inferred): this pull changes src/web/client.ts, src/web/pages/edit.ts; the forge pictures / (src/web/client.ts), /docs (src/web/client.ts), /explore (src/web/client.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

<!-- look-pages 07e54a16fa86 --> Look pages for 07e54a1, from the gate:

  • look pages (inferred): this pull changes src/web/client.ts, src/web/pages/edit.ts; the forge pictures / (src/web/client.ts), /docs (src/web/client.ts), /explore (src/web/client.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Approved

Earlier asks: (1) the REPLACE_ASKS wording is now one short sentence: met. (3) Both doors: the terminal passes was, refuses in the same words, and docs/features/edit-keeps-your-work.md is added with the doorless allow entry removed: met. (2) The double guard is half met: the button is now secondary, but the confirm checkbox still sits beside a button that already says 'Replace their change with mine'. Non-blocking: drop the checkbox and keep the labelled button, since the stale-blob check already stops a third change. Non-blocking: the restored-draft note and Discard button depend on JavaScript. With JS off the editor still saves and refuses correctly, which is acceptable. Line endings, the stale-save refusal and draft restore all have tests that would fail without them.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs