Skip to content

A disk edit whose entry exceeds 1 MiB is silently reverted (the user's file is overwritten) for notes of about 340 KB on a Private collection #1952

Backlog

Description

@Lorite

Summary

On a Private (end-to-end encrypted) collection served by the headless daemon, a disk edit to a Markdown note of about 340 KB or more is refused locally with too_large ("the entry exceeds 1 MiB"). The daemon then writes the last confirmed version back over the file, so the edit disappears. The daemon logs nothing at INFO, creates no hold and no conflict, and mdbase status shows nothing. In our vault this silently lost three edits over one week (journal entries, ticked boxes and a status change), and later edits of the same note were reverted within seconds.

I think #1309 fixes exactly this ("Planning-time rejections (sealed entry over 1 MiB) and disk edits the planner refuses are fenced"), but it is still open, and v0.2.31 has the same code path. This issue is the user-side report with a reproduction, in case it helps to prioritize it.

Reproduce (daemon 0.1.20, Linux, Private collection, files written with cp)

  1. Copy a Markdown note of 392,174 bytes into the collection folder. The create is confirmed.
  2. Overwrite it with a version that is 350 bytes longer (392,524 bytes).
  3. Within 5 s the local receipt is rejected with too_large / "the entry exceeds 1 MiB", and the file on disk is the 392,174-byte version again.

The same 392,524-byte content is confirmed when it is created as a new note. So the limit hits edits before creates. A probe with truncated copies of the same note (create, wait 8 s, append one line of about 100 bytes, wait 8 s):

Note size (bytes) Create Edit File after the edit
300,000 confirmed confirmed kept
330,000 confirmed confirmed kept
345,000 confirmed rejected, too_large reverted
360,000 confirmed rejected, too_large reverted
375,000 confirmed rejected, too_large reverted

So for this note an edit entry is about 3.0 to 3.2 times the note size, and a create less than 2.7 times (private collections are not compressed, append.rs:525).

What happens in the code (v0.2.31): append.rs:547 rejects a sealed item over 1 << 20 bytes. resolve_rejected (append.rs:1188) drops the pending row and rebuilds the view, and the confirmed version is then materialized over the user's file. The receipt in st_lreceipt has the problem, but nothing else shows it.

Expected: a local size limit never overwrites the user's file. Keep the disk bytes and show a hold or a notice (as #1309 describes), and log the refusal with the record path at WARN.

What we saw in a real vault: 5 notes in the collection above 340 KB (the largest active one 393 KB). 8 refused edits between 2026-11-19 and 2026-11-26, each less than a minute after an editor saved the note or Syncthing delivered it. With Syncthing on top, each reverted file was then copied to every other device. We recovered the three lost edits from the editors' own logs.

Suggestions

  1. Merge and release Reject a change the log refuses for itself, keeping the user's file, instead of stopping sync #1309, or keep the disk bytes in another way.
  2. Log the refusal at WARN with the record path.
  3. If possible, make an edit entry smaller (one copy of the body, or a patch), so that editable notes are not limited to about a third of 1 MiB.

Environment: headless daemon 0.1.20 (Linux x64 CLI build, systemd user service), Private collection, TaskNotes web and Android. The code path is the same in v0.2.31.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions