Notes storage and live rooms #6

Closed
opened 2026-10-13 15:01:13 +00:00 by kayg · 2 comments
Owner

Notes on disk and live rooms (ADR 0018, 0020, 0021, 0023, 0025).

  • Notes/<Title>.md with calternal-id, flat, ids.jsonl, exclusive /data lock.
  • One yrs room per note id, UTF-16 offsets, flush after 750 ms quiet through the single atomic write recipe, check-before-write, echo detection by hash, history-before-flush in history.db (author-tagged).
  • Watcher: outside edits diffed against the last-written base, outside renames by id, duplicate-id copies get fresh ids.
  • Frontmatter edits are key-level; last edited: only on real edits.
  • Every guard from #3 that lands here comes with its test (kill -9, multi-client fuzz, property tests).
Notes on disk and live rooms (ADR 0018, 0020, 0021, 0023, 0025). - `Notes/<Title>.md` with `calternal-id`, flat, ids.jsonl, exclusive `/data` lock. - One yrs room per note id, UTF-16 offsets, flush after 750 ms quiet through the single atomic write recipe, check-before-write, echo detection by hash, history-before-flush in history.db (author-tagged). - Watcher: outside edits diffed against the last-written base, outside renames by id, duplicate-id copies get fresh ids. - Frontmatter edits are key-level; `last edited:` only on real edits. - Every guard from #3 that lands here comes with its test (kill -9, multi-client fuzz, property tests).
Author
Owner

Progress: PR #24 is open for review (not merged), rebased on the new CI.

  • New crates calternal-fsio (atomic writes, data lock, names) and calternal-notes (rooms, history, saves, outside edits, index, watcher, actions); rooms ride the live websocket as binary frames.
  • Local gates: cargo fmt --check, clippy -D warnings, full workspace tests green; notes suite run 8 times in parallel without a flake.
  • kill -9 loop against the real binary: 30 kills, 458 confirmed appends each exactly once, 29 in-flight retries each exactly once, files never torn.

Waiting for CI on the PR. Deferred items are listed in the PR body.

Progress: PR #24 is open for review (not merged), rebased on the new CI. - New crates `calternal-fsio` (atomic writes, data lock, names) and `calternal-notes` (rooms, history, saves, outside edits, index, watcher, actions); rooms ride the live websocket as binary frames. - Local gates: `cargo fmt --check`, `clippy -D warnings`, full workspace tests green; notes suite run 8 times in parallel without a flake. - kill -9 loop against the real binary: 30 kills, 458 confirmed appends each exactly once, 29 in-flight retries each exactly once, files never torn. Waiting for CI on the PR. Deferred items are listed in the PR body.
Author
Owner

CI is green on db4308d.

The first two CI runs failed only in CI while everything passed locally. The likely cause is that the CI host can't start an inotify watcher (shared hosts run out of instances), so the watcher-based tests timed out. I couldn't read the job log to confirm. The second commit adds a polling fallback: without a system watcher, the notes Home compares note files' size and mtime every 5 s (tests: 100 ms) and reconciles what changed. It also moves watcher file reads off the async threads, and adds a test that forces polling mode (polling_finds_outside_changes). This matters in production too (network file systems, busy servers).

Ready for review. Not merged.

CI is green on `db4308d`. The first two CI runs failed only in CI while everything passed locally. The likely cause is that the CI host can't start an inotify watcher (shared hosts run out of instances), so the watcher-based tests timed out. I couldn't read the job log to confirm. The second commit adds a **polling fallback**: without a system watcher, the notes Home compares note files' size and mtime every 5 s (tests: 100 ms) and reconciles what changed. It also moves watcher file reads off the async threads, and adds a test that forces polling mode (`polling_finds_outside_changes`). This matters in production too (network file systems, busy servers). Ready for review. Not merged.
kayg closed this issue 2026-10-13 16:19:09 +00:00
Sign in to join this conversation.
No milestone
No project
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#6
No description provided.