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
Check · Review · Land · Live done — Landed and live in production.
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.
shipped production is serving it deploy 3fede26
4 earlier comments · 1 event
<!-- 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
<!-- 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
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.
- 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.
- Both doors. A stale save is refused only on the web. The terminal path (editFiles callers, and any TUI edit screen) must either pass
wasand 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. - 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.
<!-- 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
<!-- 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
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.
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.
🤖 Generated with Claude Code