Skip to content

refactor: move data operations into the daemon - #61

Merged
birdmanmandbir merged 16 commits into
mainfrom
feat/daemon-first-data-boundary
Aug 10, 2026
Merged

refactor: move data operations into the daemon#61
birdmanmandbir merged 16 commits into
mainfrom
feat/daemon-first-data-boundary

Conversation

@orga-agent

@orga-agent orga-agent Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make the daemon the sole application/data host; CLI and MCP use a mandatory protocol-v2 typed Unix-socket API and never open SQLite
  • permanently retire remote-cluster PgWire/managed mode, DATABASE_URL routing, capability negotiation, PostgreSQL SQLx features, and managed lifecycle branches
  • make remote note creation return the canonical short ID, write the full confirmed row into the local cache, and skip only marker-tagged redundant PowerSync PUTs
  • replace cross-process WAL watching with in-process may-write signals while retaining startup CRUD drain and WAL checkpoints
  • align with flick-backend PR #399 by removing the retired keyterm domain and safely consuming pre-upgrade queued CRUD
  • split the daemon monolith into runtime, connector, upload, storage-maintenance, remote, app-domain, and IPC ownership modules; move private tests beside their owners
  • move MCP to the standard Send async stack, remove blocking file reads from daemon async paths, and remove dead/defaulting RPC branches
  • permanently enforce too_many_lines, cognitive_complexity, large_futures, and future_not_send through one workspace/all-target/all-feature Clippy command in just, hooks, PR CI, and main CI

Safety and races

  • remote create uses stable UUIDs, same-ID create-only retries, and typed unknown/partial outcomes
  • marked remote-confirmed inserts never issue a stale backend upsert; malformed or unsupported markers fail closed
  • sync-first local races use insert-if-absent; confirmed extraction subsets are committed and reported precisely
  • transient upload failures retry without requiring another write trigger
  • protocol/version readiness and PID executable identity are checked before lifecycle actions
  • existing PowerSync databases preserve project rows while retiring keyterm schema; old queued keyterm CRUD is consumed and retired project fields are stripped

Verification

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features — 318 tests passed
  • SQLX_OFFLINE=true cargo check --workspace --all-targets --all-features
  • just sqlx-prepare
  • just check
  • cargo build --workspace
  • git diff --check
  • lefthook run pre-commit
  • lefthook run pre-push

Authorized dev smoke confirmed invalid DATABASE_URL still starts local protocol 2, note add → immediate detail/MCP get, text upload, editor round-trip, project CRUD upload, empty ps_crud, and advancing WAL checkpoint. Test notes/project were archived and the original installed daemon was restored. The dev share endpoint returned an external 404, so live share/unshare could not be completed; application/IPC share contracts remain covered by automated tests.

Observed pre-existing follow-up: an immediate note add against a just-created project can race the project's asynchronous upload and receive backend FK 23503. Recorded as FlickNote deferable #1791; no arbitrary delay or temporary upload barrier was added to this refactor.

@birdmanmandbir
birdmanmandbir merged commit a37539a into main Aug 10, 2026
9 checks passed
@orga-agent
orga-agent Bot deleted the feat/daemon-first-data-boundary branch August 10, 2026 02:20
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