ritual sync push — forge.db → Postgres via Electric-sql bridge #2

Closed
opened 2026-06-29 14:48:56 +00:00 by peterswimm · 0 comments
Owner

Wish: ceb6b6c9 — ritual sync push — forge.db → Postgres (Electric-sql bridge)

What

Build a sync bridge from the local forge.db (SQLite, CRSQLite) to the forge's PostgreSQL backend using Electric-sql. This is the local-first persistence layer — forge.db is the source of truth offline; sync pushes to Postgres when connected.

Tasks

  • Integrate Electric-sql client into forge-core (or as a sidecar)
  • Wire CRSQLite change tracking on forge.db tables (wishes, frames, ruses, etc.) to Electric-sql sync
  • Implement ritual sync push subcommand that drains pending changes to Postgres
  • Handle conflict resolution: last-write-wins per CRDT semantics, flag conflicts for manual review
  • Add pending_sync drain to ritual sync push and clear pending_sync_dlq on success

Key context

  • Tags: forge, electric-sql, phase-3b, local-first
  • forge.db already has crsql_* tables (CRSQLite change-tracking infrastructure)
  • pending_sync and pending_sync_dlq tables exist in forge.db

Acceptance criteria

  • ritual sync push drains all pending_sync rows to Postgres without data loss
  • Conflict entries appear in pending_sync_dlq rather than silently overwriting
  • Works offline (queues) and online (drains immediately)

Forge wish: ceb6b6c9

> **Wish:** `ceb6b6c9` — ritual sync push — forge.db → Postgres (Electric-sql bridge) ## What Build a sync bridge from the local `forge.db` (SQLite, CRSQLite) to the forge's PostgreSQL backend using Electric-sql. This is the local-first persistence layer — forge.db is the source of truth offline; sync pushes to Postgres when connected. ## Tasks - [ ] Integrate Electric-sql client into forge-core (or as a sidecar) - [ ] Wire CRSQLite change tracking on `forge.db` tables (wishes, frames, ruses, etc.) to Electric-sql sync - [ ] Implement `ritual sync push` subcommand that drains pending changes to Postgres - [ ] Handle conflict resolution: last-write-wins per CRDT semantics, flag conflicts for manual review - [ ] Add `pending_sync` drain to `ritual sync push` and clear `pending_sync_dlq` on success ## Key context - Tags: `forge`, `electric-sql`, `phase-3b`, `local-first` - `forge.db` already has `crsql_*` tables (CRSQLite change-tracking infrastructure) - `pending_sync` and `pending_sync_dlq` tables exist in `forge.db` ## Acceptance criteria - [ ] `ritual sync push` drains all `pending_sync` rows to Postgres without data loss - [ ] Conflict entries appear in `pending_sync_dlq` rather than silently overwriting - [ ] Works offline (queues) and online (drains immediately) _Forge wish: `ceb6b6c9`_
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
Toilville/forge-core#2
No description provided.