Skip to content

refactor: move note writes behind projection events - #193

Merged
h4yfans merged 1 commit into
mainfrom
memry/phase4-projection-write-separation
Apr 9, 2026
Merged

refactor: move note writes behind projection events#193
h4yfans merged 1 commit into
mainfrom
memry/phase4-projection-write-separation

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

What

Move normal note and journal write paths fully onto domain-event/projector flows instead of draining projections inline.

Why

Phase 4 was marked complete, but local note and journal mutations still awaited projector execution and rename/repair compatibility paths could still mutate index state directly.

How

  • removed inline flushProjectionEvents() waits from local note CRUD and journal IPC mutation handlers
  • routed duplicate note-ID repair in notes.ts through deleteNoteFromCache and syncNoteToCache instead of direct cache/canonical writes
  • changed rename-tracker to detect and emit rename events only, and replayed markdown renames through syncNoteToCache in the watcher
  • switched watcher, journal sync apply, and CRDT writeback paths to queue projection draining with void flushProjectionEvents()
  • added regression coverage to lock in the non-inline projection behavior
  • left the indexer rebuild awaits unchanged because concurrent rebuild duplicate detection still depends on note_cache visibility

Type

  • feat — new feature
  • fix — bug fix
  • refactor — restructure without behavior change
  • style — visual/UI only
  • perf — performance improvement
  • test — adding or updating tests
  • chore — tooling, deps, config
  • docs — documentation only
  • ci — CI/CD changes

Test plan

  • Unit tests added/updated

  • Integration tests added/updated

  • Manual testing (describe below)

  • pnpm exec vitest run --config config/vitest.config.ts --project main src/main/ipc/journal-handlers.test.ts src/main/vault/notes.test.ts src/main/vault/rename-tracker.test.ts src/main/vault/watcher.test.ts

  • pnpm typecheck:desktop

Screenshots

N/A

Checklist

  • Self-reviewed the diff
  • No hardcoded secrets or credentials
  • Files stay under ~500 LOC
  • Follows immutable data patterns

@h4yfans
h4yfans changed the base branch from memry/inbox-domain-extraction to main April 9, 2026 22:20
@h4yfans
h4yfans merged commit 37db108 into main Apr 9, 2026
2 checks passed
@h4yfans
h4yfans deleted the memry/phase4-projection-write-separation branch April 9, 2026 22:24
h4yfans added a commit that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant