Commit graph serverpod-offline-sync/packages/serverpod_offline_sync_server
Author SHA1 Message Date
6fdd926cf0
perf: Send the changes a peer lacks as they are read, on the server
Collecting pending changes ran in one repeatable-read transaction and
handed nothing out until every change was read. A device's first sync of
a large space thus heard nothing from the server until the end: on a home
server, a library of 56,621 rows took about 100 s, so the client's idle
timeout (40 s, its pings unanswered meanwhile) closed the stream first,
and every attempt started over. Reading the rows in batches made that
shorter, not bounded.

An engine may now hand each change out as soon as it is read
(streamCollectedChanges), the collection's transaction staying open until
the last is out or the listener cancels; cancelling ends the collection
and its transaction, and an error, an integrity violation among them,
reaches the listener once the transaction rolled back, recorded as before.
The server's initializeOfflineSync switches it on: PostgreSQL's snapshot
only reads. A device's engine keeps it off, since Serverpod's SQLite
transactions are write transactions and would hold off the device's own
writes for as long as the peer takes to receive. A receiver merges a batch
only once its end arrives, so a stream broken halfway still merges
nothing.

The new tests collect 600 inserts and 300 renames for a peer behind: as
read, the first change arrives before the renamed rows are read; whole, once
all are; both merge into the author's rows. On embedded PostgreSQL, a row
written by another session during the streamed collection stays out of it,
the changes are a whole collection's, in order, and a listener stopping
after the first lets the next collection run. The orphan-insert violation
test runs both ways. Every PostgreSQL test file passes alone; run together,
the files bind the same port, the two already there as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-11 12:40:44 +01:00
Marcelo Mendonça Soares
de3498aa20
chore: Bump version to 0.0.10 and update CHANGELOG (#167) 2026-10-08 23:34:54 -03:00
Marcelo Mendonça Soares
ee000e348c
fix: Author the column default an upsert writes for a null foreign key (#164)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-08 22:48:47 -03:00
Marcelo Mendonça Soares
e12c9dc9f0
fix: Drop invalid SetNull and SetDefault test models (#165)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Marcelo Mendonça Soares <marcelomendoncasoares@users.noreply.github.com>
2026-10-08 18:21:10 -03:00
Marcelo Mendonça Soares
65bcfb72d7
chore: Bump version to 0.0.9 and update CHANGELOG (#154) 2026-09-30 16:07:43 -03:00
Marcelo Mendonça Soares
a0304938e8
chore: Bump version to 0.0.8 and update CHANGELOG (#144) 2026-09-17 11:09:52 -03:00
Marcelo Mendonça Soares
962b247099
chore: Bump version to 0.0.7 (#136) 2026-09-16 11:48:50 -03:00
Marcelo Mendonça Soares
0f4b8116f4
fix: Close generated sync sessions and expose the shared demo (#135) 2026-09-16 11:40:42 -03:00
Marcelo Mendonça Soares
4789f650be
fix: Preserve harness transactions for non-synced row updates (#133) 2026-09-16 11:12:42 -03:00
Marcelo Mendonça Soares
27d875ee39
chore: Prepare 0.0.6 for Serverpod 4.0.0 (#129) 2026-09-14 17:06:48 -03:00
Marcelo Mendonça Soares
b89725f6ea
refactor!: Rename sync APIs and ownership spaces (#128) 2026-09-14 13:39:07 -03:00
Marcelo Mendonça Soares
2a6d66c79e
chore: Update Serverpod and prepare the release (#117) 2026-09-04 22:10:53 -03:00
Marcelo Mendonça Soares
519a8efca0
fix: Rebuild foreign key and unique projection from authored facts (#115) 2026-09-04 15:37:09 -03:00
Marcelo Mendonça Soares
fbad5c61fe
chore: Prepare the release of 0.0.4 with serverpod-4.0.0-rc.1 support (#113) 2026-08-31 21:15:35 -03:00
Marcelo Mendonça Soares
852c81c64a
chore: Update to Serverpod 4.0.0-beta.4 (#112) 2026-08-25 11:25:48 -03:00
Marcelo Mendonça Soares
c04bde5e6f
chore: Bump version to 0.0.2 and update CHANGELOG (#111) 2026-08-11 09:23:10 -03:00
Marcelo Mendonça Soares
6b22199272
chore: Fix stale Serverpod refs on the overrides (#108) 2026-08-04 12:14:07 -03:00
Marcelo Mendonça Soares
9f2ce4d9e6
refactor: Move the core implementation to the shared package with no manual queries (#107) 2026-08-04 11:04:04 -03:00
Marcelo Mendonça Soares
40dbd7a73a
chore: Upgrade Serverpod to 4.0.0-beta.1 (#105) 2026-07-27 23:25:23 -03:00
Marcelo Mendonça Soares
8e7e6551e0
fix: General tests improvements and misc small fixes (#104) 2026-07-22 14:28:14 -03:00
Marcelo Mendonça Soares
a24faf39af
chore: Publish version 0.0.1 of the packages (#103) 2026-07-10 13:16:43 -03:00
Marcelo Mendonça Soares
20b23a1a9c
chore: Add the generated code and migrations that were gitignored (#102) 2026-07-09 11:25:28 -03:00
Marcelo Mendonça Soares
ace841de73
chore: Transfer the package license to Serverpod (#99) 2026-07-09 01:16:49 -03:00
Marcelo Mendonça Soares
d89118a43a
feat: Implement the scope management interface (#96) 2026-07-07 11:48:19 -03:00
Marcelo Mendonça Soares
8acfa7f269
feat: Implement shared scopes with role enforcement (#90) 2026-07-03 01:25:15 -03:00
Marcelo Mendonça Soares
517abde4a1
fix: Make the CrdtDatabase class ephemeral (#82) 2026-06-24 01:18:23 -03:00
Marcelo Mendonça Soares
84cfbadc45
feat: Require scopeId on domain tables to ensure user isolation (#73) 2026-06-18 01:05:24 -03:00
Marcelo Mendonça Soares
4580326956
feat: Implements foreign key handling (#68) 2026-06-10 17:31:05 -03:00
Marcelo Mendonça Soares
60cca9cc85
fix: Fix missing entries when syncing multiple nodes (#58) 2026-06-02 01:42:34 -03:00
Marcelo Mendonça Soares
b8ae05c76d
feat: Replace the isDeleted flag by an int CLFlag (#55)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-31 14:17:59 -03:00
Marcelo Mendonça Soares
f85239c3a4
feat: Implement the sync protocol (#54)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-29 01:54:23 -03:00
Copilot
d04a56520c
feat: Implement merge changes method (#38)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Marcelo Soares <marcelo.me.soares@gmail.com>
2026-05-07 00:42:23 -03:00
Marcelo Mendonça Soares
3545bbba1d
refactor: Replace drift by serverpod as core engine (#33) 2026-05-03 09:09:23 -03:00