Corruption trap hunt: catalogue every way a note can be duplicated or lose text #3
Open
opened 2026-10-13 14:44:26 +00:00 by kayg
·
2 comments
No Branch/Tag specified
main
port/tasks-float-2
fix/train-1116-2
fix/train-1116-3
fix/train-1116-1
fix/flake-1134
fix/server-1182
dev
port/notes-float-3c
docs/auto-update-ig
feat/dav-transport
port/tasks-float-1
wip/mail1011-sv-order-1116
fix/flake-1179
fix/flake-1178
fix/guards-1153-fsio-split
fix/guards-1153-notes-split-we
fix/guards-1153-notes-lib
fix/guards-1153-notes-home
fix/guards-1153-ui-primitives
fix/guards-1153-primitives-e2e
fix/guards-1153-visibility-doc
feat/paper-grey-1116
fix/flake-1165
fix/flake-1119
docs/imap-766-plan-v2
fix/e2e-unique-ports
t3/paged-search-reconcile-final
wip/mail1011-final-1115
docs/tasks-float-port
perf/editor-first-paint-1c
feat/imap-notes-fetch
feat/imap-notes-projection
feat/imap-notes-readonly
feat/imap-notes-auth
feat/imap-notes-server-foundation
wip/mail1011-txn-ownvocab-1115
wip/mail1011-txn-novocab-1115
perf/p1117-final-harness
perf/single-shot-repeats
port/tasks-matrix
wip/mail1011-txn-1115
fix/static-gates-1155
feat/files-s1-identity-r7
fix/files-r7-idle-loop
fix/daily-train-1152
port/notes-float
fix/editor-tables-test-types
port/notes-float-listscript
feat/tasks-actions
port/notes-float-phone-preload
perf/sound-comparator
port/notes-float-listscroll
port/notes-float-budgets
port/notes-float-suite-fix-b
port/notes-float-sidebar-fix
port/notes-float-trim
port/notes-float-3-lists
fix/attachments-meta-capability
docs/carddav-writes-v2-plan
feat/contacts-companion-pure
issue/carddav-read-perf-fix-r2
issue/carddav-read-r2
port/notes-float-devsync2
review/calendar-2
review/switcher-a-pills
port/notes-float-switcher-a
port/port-tables-2
review/switcher-ends
wip/whiteboard-s1-1114
port/port-tables
wip/mail1011-perfneutral
review/photo-tint
port/notes-float-shell
wip/local/collections-db
wip/local/mail-p1
wip/local/cold-growth-on-tiering
wip/local/tiering-v3-s1
wip/local/wal1051-cap
wip/local/tiering-v3-s1-resume
wip/local/index-position-startup-scan
port/notes-float-flat
port/notes-float-promote
wip/handover/mail1011-candidate
wip/handover/files-s1-candidate
port/notes-float-shell-only
port/notes-float-perf
feat/whiteboard-s1
feat/tiering-v5
fix/app-switch-hitch
wip/local/files-s1-dev-v4-final
feat/files-s1-dev-v4
fix/c2-glass-shared
feat/flat-lists
wip/handover/whiteboard-s1-resume
wip/att-lazy-861
feat/switcher-browse
wip/att-lazy-860
feat/tasks-float
recovered/flat-backup-candidate
perf/stalls-1054-kc
land/ai-toolbar
feat/collections-db
feat/collections-db-fixes
codex/mail-1011-redesign-20261111
fix/ai-toolbar
backup/macos-vm/st3-head
perf/trim-candidate-phonestack
feat/switcher-three
fix/1051-index-idle-checkpoint
perf/stalls-1054-kb
perf/stalls-1054-k
perf/stalls-1054-r3
fix/c2-contrast-tail
perf/stalls-1054-r3-preview
feat/collections-before
feat/tiering-v4
fix/timelog-caret
wip/local/tasks-actions
docs/tasks-writes-v2-plan
st3-r3
feat/pass8
review/calendar-2-before-1111
wip/tiering-v3-cold4
perf/stalls-1054-r2
fix/suite-A4
fix/suite-A5-probe
fix/suite-A6
fix/suite-A3
fix/suite-A2
fix/suite-A5
fix/suite-A1
wip/local/attachments-861-fix
feat/contrast
wip/local/ports-861
storage/wal-checkpoint-off-save-1051
wip/local/mail-1011-reconcile-20261110
feat/style-sheet-fixes
feat/money-round
perf/stalls-1054
wip/tiering-v3-cold5
t3/mail-1011-liveness
feat/iphone-fixes
feat/notes-approve
wip/local/shrow-work
feat/files-s1-identity
feat/quickfix
wip/tiering-v3-cold
wip/local/shared-row-swipes
backup/macos-vm/pfx-B
backup/macos-vm/pfx-C
backup/macos-vm/pfx-D
feat/contrast-r1
feat/tiering-v3-s2-tags
feat/folder-drop
t3/photos-s1
feat/tiering-v3-s1-namespace
wip/local/photos-s1
t3/photos-plan-slice-one
recovered/backup/p1b-61505
t3/paged-search-reconcile
t3/smooth-pane-transitions
t3/index-position-startup-scan
fix/private-staging-759b-r2
backup/macos-vm/hk/hk1009/pr877
backup/macos-vm/hk/hk1009/pr878
docs/undo-block-ids-plan
fix/undo-768
backup/macos-vm/hk/hk1009/pr875
backup/macos-vm/hk/hk1009/pr904
proto/block-identity-v7d
backup/macos-vm/hk/hk1009/pr846
backup/macos-vm/hk/hk1009/pr860
backup/macos-vm/hk/hk1009/pr861
backup/macos-vm/hk/hk1009/pr849
backup/macos-vm/hk/hk1009/pr848
backup/macos-vm/hk/hk1009/pr853
backup/macos-vm/hk/hk1009/pr957
backup/macos-vm/hk/hk1009/pr893
backup/macos-vm/hk/hk1009/pr889
backup/macos-vm/hk/hk1009/pr902
docs/imap-notes-plan
docs/quota-plan-2
fix/parallel-test-flakes
docs/calendar-backend-v2-plan
feat/calendar-ical-converter
backup/macos-vm/hk/hk1009/pr808
docs/contacts-import-v2-plan
issue/610-pm-midnight
feat/calendar-v2-s1-containment
backup/macos-vm/hk/hk1009/pr854
backup/macos-vm/hk/hk1009/pr845
backup/macos-vm/hk/hk1009/pr917
docs/dav-recorder-v2-plan
plan/previews-865
plan/save-log-durable-entry
backup/macos-vm/hk/hk1009/pr934
fix/e2e-data-on-ram
backup/macos-vm/hk/hk1009/pr888
feat/appwindow3
feat/appwindow2
feat/appwindow
feat/money-p1
feat/keys-sheet
review/calendar-2-themes
feat/smooth-cursor
fix/float-style
review/calendar-2-float
release/2026-11-06-hotfix
archive/port/rows-drop-code
archive/port/rows-actions
archive/port/rows
scratch/tasks-894-ui-gates
review/calendar-2-night-wip
recovered/flaky/toast-reduced
release/2026-11-05
archive/flaky/rows-drop-fixed
archive/flaky/rows-actions
archive/flaky/rows
sim/bm15-final
sim/bm15-bis-932
sim/bm15-bis-909
sim/bm15
sim/bm15-bis-887
perf/tiering-option-b
fix/sw-lazy-precache
archive/plan/save-log-durable-entry
mock/money-fix2
archive/fix/e2e-data-on-ram
mock/appearance-all
mock/pill-press
mock/pill-press-mac
backup/macos-vm/appearance-after
mock/auto-swipes
mock/mail-actions
backup/macos-vm/mock/mail-actions
mock/money-static
archive/review/standards-917
perf/tiering-761-fix
mock/type-audit
mock/third-pane
feat/contacts-import-v2-s1
perf/executor-hot-path
archive/port/hidden-blocks
archive/port/devices
scratch/executor-on-894
scratch/executor-spans2
scratch/executor-spans
archive/port/rows-drop
feat/tiering-761-d-scale
feat/tiering-761-c-index
feat/tiering-761-b-reader
archive/review/sharing-pr3-review-9fec3d1f
perf/ports-lazy-budgets
feat/tiering-761-a-migration
archive/review/sharing-pr3-review
archive/review/sharing-pr3-review-code
archive/plan/previews-865
archive/port/port-attachments-3
archive/port/contacts-merge
fix/motion-audit-859
fix/motion-audit-859-mac
archive/port/port-pickers
archive/port/port-tables-2
archive/port/port-tables
recovered/local/sharing-s1-pr2-room-snapshot-candidate
archive/fix/parallel-test-flakes-code-minipc01
docs/imap-766-readonly-slice
feat/dav-recorder-v3
research/788-diagnosis
archive/fix/parallel-test-flakes
archive/perf/pr792-cold-index-edit
docs/sharing-slice-1
recovered/feat/dav-recorder-v2
recovered/feat/dav-recorder-v2-edd7bbb
spike/imap-766-s0-cases
archive/fix/undo-768
recovered/feat/dav-recorder
recovered/feat/dav-recorder-901acd4
feat/contacts-import
perf/cold-growth-on-764
perf/cold-growth-on-tiering
recovered/feat/tasks-set-status
feat/tasks-move-reorder
feat/tasks-delete-promote-duplicate
feat/carddav-writes
perf/quota-on-tiering
perf/quota-simple
perf/cold-growth-on-quota-stack
recovered/perf/cold-growth-on-tiering
feat/calendar-identity
feat/calendar-event-parser
feat/calendar-props-maps
port/glass-when-ring
recovered/feat/tiering-761-s1-wip-8132a84
recovered/feat/tiering-761-s1-wip-9da4094
recovered/feat/tiering-761-s1-wip-724512c
recovered/feat/tiering-761-s1-wip-66e667e
recovered/feat/tiering-761-s1
wip/6by32-01-tier-761-s1-pause-20261030
spike/imap-766-s0
wip/6by32-02-calternal-pause-20261030
wip/8by64-01-review-688-pause-20261030
wip/6by32-01-verify-744-pause-20261030
wip/6by32-01-verify-742-pause-20261030
fix/private-staging-759b
wip/6by32-01-review-748-pause-20261030
wip/6by32-01-review-733c-pause-20261030
wip/6by32-01-review-733b-pause-20261030
review/calendar-month
wip/local/bm15-trash
plan/759b-staging
review/767b-tests
review/preview-2026-10-29
docs/tiering-731-plan
wip/c6b02-review-733d
wip/c6b02-bm1-full-a
docs/deploy-plan
fix/storage-owner-liveness-642
fix/storage-fix-7
feat/tiering-731
wip/tiering-731-first-attempt
perf/idle-honest-2
fix/storage-private-tmp-642-dev
fix/storage-exact-file-quarantine-642
perf/one-flush-save
review/calendar-static
review/indexing-ring
review/when-field-2
proto/block-identity-2-review
proto/block-identity-review
review/when-field
issue/tasks-create-ids
issue/tasks-create
review/combined
review/task-polish
review/top-buttons
review/q1-q5
archive/integ325-293
archive/integ325-ci
issue/calendar-adr
archive/old/train/2026-10-23bk2
archive/old/train/2026-10-23bk
issue/469-mockup-9a
issue/smart-tasks-mockup
issue/469-menus
issue/652-signout-flake
issue/652-history-fix7
issue/652-history-fix6
archive/old/issue/spring-check-perf
issue/spring-check-perf
issue/659-rename-fast
archive/old/train/2026-10-21ar
issue/search-hardening-3
issue/652-history-fix5
issue/660-port-sheets-glass
issue/652-history-fix4
issue/652-history-fix3
issue/652-history-fix2
issue/652-history-flake
train/2026-10-21an
issue/settings-admin-port
issue/search-port
train/2026-10-20am
issue/storage-split-fix2
issue/storage-split
archive/old/issue/folder-ids-fix
train/2026-10-20al
archive/old/issue/folder-ids
train/2026-10-20ak
issue/tables-mockup
train/2026-10-19aj
train/2026-10-19ai
issue/469-merge-fixes
issue/sidebar-band
archive/old/issue/608-settings-spec
train/2026-10-19ah
issue/swipe-offscreen
train/2026-10-19ag
archive/old/issue/590-nlp-adr
archive/old/issue/587-event-after-write-2
train/2026-10-19af
archive/old/issue/587-event-after-write
issue/469-pill-room-c
issue/469-pill-room
train/2026-10-19ae
issue/469-narrow-handle
issue/397-ios-swipe-2
issue/469-desk-fixes
archive/old/issue/auto-update-adr
issue/469-filter-gap
issue/469-port-1b
issue/442-opacity-flake
issue/327-web-fast-3
archive/old/issue/469-port-1
issue/469-port-1
issue/327-web-fast-2
archive/old/issue/327-web-fast
archive/old/issue/425-stt-bench-vq1
archive/old/issue/445-no-bleed
archive/old/issue/400-swipe-mockup-2
issue/426-client-review
issue/426-client-2
issue/426-client
archive/old/issue/476-safe-area-lab
archive/old/issue/445-top-light
issue/471-blocks-mockup
archive/old/issue/448-links-app-2
archive/old/issue/448-links-app
archive/old/issue/398-cold-links
issue/434-442-small-2
issue/434-442-small
archive/old/issue/398-unload
archive/old/issue/445-bottom-band
issue/445-bottom-band
issue/351-rem-3
issue/351-rem-2
issue/351-rem
archive/old/issue/327-first-note
issue/395-width-phone
archive/old/issue/327-typing
issue/396-ios-edges
issue/397-ios-swipe
archive/old/issue/327-notes-index
issue/345-347-contrast-empty-2
archive/old/issue/44-arenas
issue/44-arenas
archive/integ325
archive/old/issue/327-perf-harness
archive/old/issue/44-thp
issue/44-thp
archive/old/issue/285-sticky-pills
archive/old/issue/44-trim-3
issue/44-trim-3
archive/old/issue/165-cards
archive/old/issue/165-picker-2
archive/old/issue/212-multi-select
No results found.
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
kayg/calternal#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Find every way a note can get duplicated, lose text, resurrect deleted text, or be written without the user typing, before kayg ever sees it.
Sources: v0 issue history (git.kayg.org/kayg/calternal-v0), v0 audits, y-codemirror / Yjs / yrs known issues, CodeMirror 6 issues, and first-principles reasoning about our design (one Y.Text per file, server rooms, IndexedDB offline, watcher + outside writes, renames, migrations, multiple tabs and devices, agents via MCP/CLI).
Output, posted on this issue:
The catalogue becomes a permanent test suite. Already guarded by decision G1c: own-keystroke-only transforms, delete-vs-type, one room per id + /data lock, echo writes by hash, diff against last-written base, duplicate-id copies, all writes through the room, history before flush, no title ping-pong, idempotent migration, lists keyed by id, intentional repeats kept.
Corruption trap catalogue (round 1)
Format: trap: mechanism · v0 evidence · guard · proving test. "G1c" items are already decided. Test kinds: U unit, P property/fuzz, M multi-client fuzz (2-5 clients + server, random delays), K kill -9 / crash, B real browser, D disk fault injection.
A. Doc identity and seeding
insert(0, fileText)into an empty Y.Text, so the merged doc holds the text twice. This is the classic Yjs duplication (yjs forum, init guide). v0 #634, #1279. Guard: G1c server-only doc lineage; clients never insert file text, they only apply server state. Test: M (N fresh clients open a never-opened note at once), B.B. Writes nobody asked for
[[conversion and anchor insertion run in a view-update or focus callback, re-enter a half-built view and duplicate text. v0 #1440 (focus callback during DOM replacement), #1384. Guard: G1c transforms only on the user's own keystroke; a lint rule bansdispatchinside update listeners and focus handlers. Test: P (load arbitrary markdown, idle 5 s, zero transactions), B (Copy link on several blocks, then a byte-exact diff).C. Outside writers
D. Concurrency and retries
E. Text encoding
\r\nas 1 and Yjs as 2, so typing after a CRLF lands in the wrong place (y-codemirror.next#35). Guard: see Gap G5. Test: U, P on CRLF, mixed endings and BOM files.Note.mdandnote.mdcollide on case-insensitive clients. v0 #618 (case-only rename). Guard: see Gap G6. Test: U, DAV client test.F. Editor runtime
^idcreates two blocks with one id, so links become ambiguous. Guard: see Gap G10. Test: P.G. Durability
H. Server-originated edits and lifecycle
title:andlast edited:while the user edits frontmatter in source mode duplicates lines;last edited:updated by a flush triggers another flush (a loop). Guard: G1c no title ping-pong; see Gap G13. Test: M (source-mode typing in frontmatter during a title change)./data. Guard: G1c exclusive/datalock; see Gap G15. Test: K (deploy, rollback, deploy under typing).2026-10-13.md,2026-10-13 2.md) or two ids for one day. Guard: see Gap G17. Test: M offline/online.Gaps: no guard in the design yet
appendandpatchtools so they rarely need replace.OffsetKind::Utf16to match Yjs. Every server-side diff snaps to grapheme cluster boundaries. Fuzz with emoji and combining marks.\nonly. Each file's original ending and BOM go in room metadata and are restored on write. Mixed-ending files keep their bytes until the first user edit, then use the dominant ending (logged in history).ytext.toString(), rebuild editor state from the Y.Text; never write editor text into the Y.Text. A debug assert compares the two after every transaction in tests.compositionendor after 500 ms. Run the Android and iOS IME suite on every editor PR.^idthat already exists in the Home is replaced with a fresh id. Copy link never inherits an id from a duplicate.navigator.storage.persist(). Never show a local-only edit as saved. Show "Not saved yet" with its age when offline edits are older than a few minutes, and nudge to install the PWA (installed apps are exempt from eviction).server.last edited:is written only inside a flush caused by a user or agent change, so it never triggers a flush itself./datalock. Switching waits for the old process to flush and release the lock, with a bounded wait, and the new process refuses to serve writes until it holds it.calternal-idis derived from (user, date), e.g. UUIDv5, so two devices creating the same day offline open the same room and merge instead of making two files.Corruption trap catalogue, round 2: what the code has now
I checked every trap against
devate6a9b2b. That includes the work merged since round 1: #83 fan-out, #85 anchors and history, #78 rename, links and bulk edit, and #91 PWA. Trash (#98) is not covered.For each trap I looked for its guard and a test that proves it. Where a test was missing, I wrote it, and I fixed the real bugs those tests found. All of it is in PR #126, and I checked that each fix's test fails without the fix.
Status key:
Test kinds: U unit, P property, M multi-client fuzz, K kill -9, D disk fault injection, B real browser.
room/load.rs. Clients only apply server state:sync/client.ts.tests/rooms.rs::fresh_note_opened_by_many_at_once_is_not_doubled(M);sync.test.ts"never seeds" (U)room/sync.rs::join,live.ts). Offline changes are replayed as a diff (offline/replay.ts). The browser never knew its lineage: the server sends it with the join, and the fake test room put it in the document. Now learned on join and stored (note.ts). Replay also doubled a collaborator's text received since the last save; the base now follows confirmed state.acks.rs::an_older_lineage_is_refused…(U);traps.test.ts"does not double what a collaborator typed" (M);traps.spec.ts"knows which copy it holds" (B)Y.Docper open. Tabs sync over BroadcastChannel; there is no leader tab, unlike ADR 0020. A tab on the old lineage fed its whole text into a recovering tab. Tabs now share changes only with tabs of the same lineage (sync/client.ts).traps.test.ts"a tab still holding the old lineage…" (M);editor.spec.tstabs tests;traps.spec.ts"two tabs typing while the network is down" (B)touch), and are skipped when the hash is unchanged (room/save.rs).saving.rs::opening_never_writes;daily/tests.rs::no_file_until_the_first_keystroke(U)transforms/links.tsruns on input only, never while composing. Lists come from the keymap; tasks frommousedown.editor.test.ts"never transforms text that arrives from elsewhere";daily.test.ts(U)dispatchin update or focus handlers (no eslint or biome config)room/merge.rs::ingest).outside.rs::own_saves_are_not_outside_edits(U, real watcher)diff.rs), and is also 10–30× faster on large notes.outside.rs::outside_edit_while_typing_merges(U);writers.rs(M, 22 seeds, every writer at once, watcher on and off);diff.rs::an_inserted_line_starts_at_a_line_start(U)room/save.rs).outside.rs::missed_watcher_event_is_caught_before_saving;writers.rs(watcher off) (M)rooms.rs::typing_survives_a_concurrent_delete;rooms.rs::random_concurrent_editing…(M)lib.rs,watch.rs::id_for_key).engine/tests.rs(U);rooms.rs::retried_change_applies_once,retried_create_makes_one_note(U);notes_crash.rs(K, appends)room/edit.rs). A version could fail to match its text (see N1), and a replace built from it doubled text.rooms.rs::stale_replace_keeps_newer_typing(U);writers.rschecks version == text on every read (M)store.svelte.ts). Block actions carry a hash of the line (block_changed).links.spec.ts"a block that changed on another device" (B)OffsetKind::Utf16(ydoc.rs). Diffs work on whole graphemes. Patches that split a character are refused.diff.rsproptests;rooms.rs::patches_use_utf16_positions(U/P)\nonly; the style is restored on write (text.rs).text.rsproptest;saving.rs::line_endings_and_bom_are_kept\rstays in the live text; a mixed file is written in the majority stylefsio/names.rs: NFC, and collisions checked ignoring case and form. Case-only renames go through a temporary name.fsio/tests.rs(U)reattachrebuilds the editor from the Y.Text.editor.test.ts(U);inSync()in the Playwright multi-client tests (B)sync/gate.tsholds remote changes while composing.sync.test.ts(U);editor.spec.ts"remote changes wait… (IME)" (B, Chromium only)notes.undo.editor.test.ts;links.spec.tsUndo tests (B)duplicateBlockscopies the^id;blockLinkmakes a random id without checking it is unused; there is no paste handler. Note ids are fine (a copied file gets a fresh id).outside.rs::copied_note_gets_a_fresh_id(note ids only)fsio::write_atomic: temp file, fsync, rename, fsync the folder. A clippy lint bansfs::write,File::createandrename.fsio/tests.rs(U)OpenOptions,tokio::fs,fs::copyorremove_filenotes_crash.rs(K, HTTP appends);saving.rs::crash_*(simulated);notes_crash_typing.rs(K over the websocket: 3 tabs, 12 kills, about 3,000 words, none lost or doubled, file == note)not_saved. An error after the rename doubled the text: the folder fsync failed, and the next check took our own bytes for an outside edit. The file is now read back after a failed write.saving.rs::a_write_error_keeps_the_change(D, injected, so it also runs as root; the old permission test does nothing under CI's root);an_error_after_the_write_does_not_double_text(D)requestPersistentStorage(); "Not saved yet" with its age.editor.spec.ts,pwa.spec.tsoffline tests (B)persist()last editedhas a 60 s slack.saving.rs::saving_does_not_loop,title_and_h1_stay_in_stepversions.rsonly lists versions.DataLock(flock) inmain.rs.fsio/tests.rs::only_one_process_owns_a_data_folder(U, one process)migrate-v0anduser create/recoverdon't take the lock/liveor on join.day-YYYY-MM-DD; an existing day file is reused.daily/tests.rs::two_offline_devices…,opening_the_same_day_at_once…renames.rs::typing_in_a_linking_note_during_a_rename_is_kept,a_crash_mid_rename…;bulk/undo.rsproptestmigrate-v0 rules.rs::running_twice_gives_the_same_bytesroom/sync.rs,room/acks.rs). Parked changes are re-offered after every update (ydoc.rs).pending.rs(U: the yrs bug itself, and the fix in every order);writers.rs(M)Gaps left: design questions or larger changes (not in #126)
Server
^idinduplicateBlocksand on paste. HaveblockLinkcheck the id is unused. On the server, refuse to resolve an anchor that appears twice. Small, but it touches the editor UI.protocol: ntojoin. The server answers with its own version, and a mismatched client stops sending and reloads at a safe moment. A design choice on the wire format.baseafter history loss. Version numbers restart at 1 whenhistory.dbis lost. A patch or replace whosebasewas read before the loss then passes thebase <= versioncheck and merges against an unrelated state. Proposal: a base names its lineage too (base: {lineage, version}, or reject abaseread before the lineage's first seq). This changes the API.load.rsdiffs it against the older base, which doubles the text that was already written. Option: diff against the pending state when the disk shares more with it. Needs a decision on what to trust.to_string_lossy. Fix: keep the on-disk bytes for I/O, and use NFC only as the comparison key. Medium change inwatch.rs,scan.rsandindex.rs.OpenOptions::openfor writing,tokio::fs::write,fs::copyandremove_fileoutsidefsio. Separately,write_atomicreplaces a symlink with a plain file and resets file permissions.migrate-v0anduser create/recovertake the data lock.Client
T1, leader tab (A3). ADR 0020 says one leader tab owns IndexedDB. Today every tab has its own document and shares changes over BroadcastChannel. Without a leader:
deleteDatabaseduring recovery waits on other tabs' open connections, and typing in that window is lost.A design change: build the leader tab, or let only one tab run recovery (a Web Lock).
T2. Changes another tab hands over reach the server only when this tab reconnects. Meanwhile the other tab can show "Saved". All tabs also share one
pendingSincerecord.T3. Of the old fake room's bugs, only the lineage one is fixed. The fake room is still a JS stand-in for the Rust room; the two should be tested against the same cases.
T4, IME gate (F17). If
compositionendnever fires (the editor is torn down mid-composition, or some Android keyboards), remote changes queue forever and the note never syncs. Proposal: release the gate on blur, on destroy, and after a long timeout.T5, undo. "Block deleted → Undo" undoes whatever is on top of the stack.
reattachnever destroys the old UndoManager.T6, "Saved" after an offline reload (G23).
pendingSinceis written to IndexedDB asynchronously and isn't in the localStorage write-ahead list. So: type offline, close the tab at once, reopen offline, and the status says "Saved" for a change that exists only on this device. Fix: keeppendingSincein localStorage synchronously as well (it changes rarely).S1, the notes list is a second store (D12).
loadNotesandrefreshRecentoverwrite entries without comparing seq orupdated_ms. A slow response can bring back a deleted note or old fields.togglePinwrites!n.pinnedfrom that possibly stale map. This affects list fields only, not note text.Performance
Measured on the shared host, which was busy.
Typing path (
fanout_bench, release, no disk load; same with load):Outside edits and replaces (
diff::edits):kayg referenced this issue2026-11-05 23:21:12 +00:00