Skip to content

Prevent external file writes from silently discarding unsaved visual edits #81

Closed

Description

@BinaryOutlook

An external write to an open Markdown file can erase unsaved visual edits without a conflict confirmation. The document becomes clean, and the tested Undo action does not restore the local text. Preserve recoverable local content until the conflict has been resolved.

Priority: P1 / High — confirmed data loss. The affected synchronization path predates #80; the installed reproduction below applies to its audited candidate. This is distinct from #11's queued-edit/native-Save overlap.

Reproduction and findings

  1. Save a synthetic document containing # External conflict, a blank line, and BASE-MARKER.
  2. Open it with Binary Markdown. Append LOCAL-UNSAVED-MARKER using the keyboard without saving.
  3. Confirm that the VS Code document is dirty and the file on disk still contains only the original marker. Keep Auto Save off for this reproduction.
  4. Let typing become idle, then use a separate process to replace the same file with # External conflict, a blank line, and EXTERNAL-MARKER.
  5. Inspect the visual editor, document dirty state, and disk; focus the visual editor and invoke Undo once.

Observed twice: both the host document and visual editor contain the external revision; the document is clean; no conflict-confirmation dialog appeared; the local marker did not return after the tested Undo action. No conclusion is drawn about separate VS Code backups or operating-system recovery facilities.

Expected: external changes must not silently discard unsaved local content. The conflict must remain recoverable until resolved.

Scope and acceptance criteria

  • Define and implement a dirty-document conflict policy that preserves both revisions until resolution; keep ordinary clean-document external reloads working.
  • Cover idle and active visual editing, Source mode, delayed watcher events, native/keyboard saves, and undo/recovery with deterministic native regressions.
  • Keep own-save notifications from overwriting later edits; preserve the existing save/export synchronization guarantees.
  • Correct the external-change guide's promise of review/accept/dismiss controls and an unsaved-edit confirmation so it matches the delivered behavior.

The conflict interaction is a product decision; this issue does not require a full collaborative merge engine. Cross-link #11 when coordinating shared save infrastructure without treating the two reproductions as the same defect.

Source evidence

The file watcher replaces document contents and saves without a dirty-content conflict decision. The webview update handler applies the external revision when idle and clears editor undo. The external-change guide advertises safeguards absent from this observed flow.

Build identity and verification boundary

Recorded during the 2026-09-27 audit of #80 at ffbdad524d393aa783760f4829cb995d8b9d6405 (package version 0.4.0), using Node 24.21.0 on macOS ARM64. The tested product source was unmodified. This is an unreleased development snapshot.

Reproduced in the installed VSIX with VS Code 1.138.0 using an isolated owned profile and synthetic documents. Package SHA-256: b813d91c719b8530ea2bbce18dcf924fd605ed7fc0f689d2b5a2f1305d3092fe. These are native host/filesystem observations; other operating systems were not retested for this case.

Reproduce and validate changes using the checkout's build guide and testing guide. Keep evidence synthetic and sanitized.

Activity

  1. added
    bug
    documentation
    on Sep 27, 2026
  2. added 2 commits that reference this issue on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdocumentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions