Skip to content

[Bug] Note gets duplicated while typing if another plugin writes to it (2.1.1) #74

Description

@hayato-osh

YAOS plugin version

2.1.1

Server deployment commit SHA

98a3033 (server 0.3.0, not redeployed since 2.1.1 is client only)

Relevant logs or error text

This is a follow-up to #73. The cap works, I only get 2 conflict files per note now and they don't sync. But the note itself still gets messed up if another plugin writes to it while I'm typing. I tried it with Templater's folder template on, and separately with update-time-on-edit on, and both break it. With Templater trigger, update-time-on-edit and Linter's auto lint all turned off, the same steps are fine.

Here's the flight log from one of the bad runs. New note inbox/testfile.md, plain ASCII, Templater folder template on:

01:38:29.664 disk.create.observed      size 0
01:38:30.073 disk.modify.observed      size 152  writerGuess: external      (Templater inserting the template)
01:38:30.432 recovery.skipped          reason: recent-editor-activity-local-only
01:38:31.388 editor.repair.applied     reason: retry-health-check:missing-sync-facet
01:38:37.315 disk.modify.observed      size 169  (me typing)
01:38:40.407 disk.modify.observed      size 171
             conflict artifacts created at 01:38:40Z
01:38:42.470 disk.modify.observed      size 325
01:38:44.602 disk.modify.observed      size 479

The two conflict files it made:

disk side:  the template frontmatter, then "- new file creation o", then ## Related / ## Reference
crdt side:  "new file creaton ion of"        (no frontmatter, no "- ", letters out of order)

And testfile.md itself ended up as 479 bytes: the whole note three times over. The second copy starts at 6\naliases: [], the third at ses: [], so each copy is missing a few more characters from the front.

For comparison, same vault 12 minutes later with Templater trigger, update-time-on-edit and Linter's lint-on-save / lint-on-file-change all off:

01:50:58.075 disk.create.observed      size 0
01:50:59.807 editor.repair.applied     reason: retry-health-check:missing-sync-facet
01:51:07 - 01:51:56  disk.modify  7 → 16 → 25 → ... → 122   (just typing)
             recovery.skipped  reason: crdt-current-no-op  every time

No conflict files, note is fine. The missing-sync-facet repair shows up in both runs, so that by itself doesn't seem to be the problem. The difference is the external write right before typing, followed by recent-editor-activity-local-only.

What you did

  1. Both devices on 2.1.1.
  2. In a folder with a Templater folder template (trigger_on_file_creation: true), create a note, type one line of ASCII. Within about 10 seconds there are 2 conflict files next to it and the note body has been doubled, then tripled. I got this 3 times, once typing ASCII and twice typing Japanese. In the Japanese runs the crdt-side conflict file had half-converted IME characters mixed into it.
  3. Templater trigger off, no template, but update-time-on-edit enabled (it writes created/updated into the frontmatter when you edit). Typed two lines into an untitled note. 0.4 s after an editor.repair.applied ... missing-sync-facet, YAOS wrote the file back (disk.write.ok, writerGuess: yaos-write) with the content exactly doubled.
  4. Templater trigger off, update-time-on-edit disabled, Linter auto lint off. Create a note, type a line. Nothing happens.

Server side looks fine the whole time, hashMismatches: 0 and path counts match.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions