Commit graph

114 commits

Author SHA1 Message Date
b5450353b9
perf: Skip the projection pass after a local delete that cannot change it
insteadOfDelete ran the full foreign key projection after every local
delete. Its closure follows edges both ways, so it loads every row
connected to the deleted one, which in a schema whose tables all hang off
one another is nearly the whole database: one deleted row of a person's
8,000 flashcards loaded 56,000 of 56,350 CRDT rows and took about 8 s on
the calling isolate, most of it deserialising rows. Inserts and updates
have had a proof that the pass is unnecessary
(canLeaveLocalProjectionUnchanged); deletes had none.

canSkipProjectionAfterLocalDelete proves it for a delete: every table
the delete can cascade into is reached by cascade edges on id only, none
of them restricts its parent (a deleted child can release a parent
delete held back by it), none has a unique index (a released claim can
bring a contestant back) or lies in a component with a SET DEFAULT edge,
and no attempted value is pending in the connected tables. The delete's
own cascade (applyDeleteActions) then is the whole projection; otherwise
the full pass runs as before. applyDeleteActions also asks for the
visible children of a whole batch of parents at once for cascades by id,
instead of one query per parent.

On that database a single delete now takes 6-63 ms, a card with its
revisions, tags and reviews 46-145 ms instead of 28-39 s. The new tests
cover a restrict child deleted locally releasing a merged parent delete
(on the person tables, and on the chain tables, where the shortcut is
asked and declines: the test fails with the restrict condition removed)
and a cascade child deleted locally through the shortcut, its parent
then deleted by a merged remote delete. The core, server, integration
and simulation suites pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 14:38:40 +02:00
0345f56787
feat: Report merges of inbound changes apart from pushes
onMergeSuccess is called for every space a sync touched, also for one
this peer only sent changes of, so a client re-read its data after every
sync that pushed. onInboundMerge is called only for a space whose
changes from the remote peer were merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 14:38:35 +02:00
1dce863e72
Never publish this fork
Halkyon Learn uses this fork as a git dependency, from
https://code.halkyon.app/project-halkyon/serverpod-offline-sync. The package name
serverpod_offline_sync belongs to its author on pub.dev, so `dart pub publish`
should refuse outright rather than depend on pub.dev refusing the upload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
2026-10-12 13:29:55 +02:00
7eea8c66b0
perf: Compare byte values directly and parse only UUID-shaped values
projectionValuesEqual took a Uint8List (how a bytea column arrives) down
its List branch and compared it byte by byte, and tryUuidValue parsed
every value as a UUID by throwing and catching an error when it was none.
Each byte of a payload thus cost a thrown TypeError, about 18 µs: two
payloads of 2 KB took 36 ms to compare. A sync whose projection loaded a
few thousand rows with payloads kept the server's isolate busy for
minutes, during which it answered no other request and the client's
method stream timed out, so the client sent the same changes again.

Byte values are now compared as bytes, and tryUuidValue only parses what
can hold a UUID (a UuidValue, 16 bytes, a 36-character string), returning
null for anything else without throwing. A UUID compares with its string
and its bytes as before. Longer byte values are no longer read as the
UUID of their first 16 bytes, which made canonicalProjectionValue group
payloads with the same beginning together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
2026-10-12 13:29:50 +02: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
4bf2359dda
fix: Capture outbound changes in a consistent snapshot (#166) 2026-10-08 20:32:24 -03:00
Marcelo Mendonça Soares
3a4ada5baf
fix: Prevent web deadlocks in transactional membership reads (#161) 2026-10-08 19:00:44 -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
f59a90bc97
fix: Correct checkpoint progress and add delta DST coverage (#158) 2026-10-07 15:49:15 -03:00
Marcelo Mendonça Soares
e42075cdd9
perf: Batch projection reads and engine writes (#157) 2026-10-03 00:27:56 -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
96271a25ab
fix: Refresh node clocks across sync wrappers (#152) 2026-09-21 16:52:03 -03:00
Marcelo Mendonça Soares
51ce999af0
fix: Repair foreign keys on columns that also carry a unique claim (#151) 2026-09-21 13:56:58 -03:00
Marcelo Mendonça Soares
f3c462b5d3
chore: Add a continuous deterministic simulation hunt (#149) 2026-09-18 15:45:20 -03:00
Marcelo Mendonça Soares
fc6aaa7b4c
fix: Preserve space state across export round trips (#148) 2026-09-18 15:33:24 -03:00
Marcelo Mendonça Soares
811145eda6
fix: Author column values written by set-based updates (#147) 2026-09-17 16:18:18 -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
ad3e1a49e4
test: Harden DST authored-state checks and workloads (#123) 2026-09-17 10:39:07 -03:00
Marcelo Mendonça Soares
16d15eebe5
chore: Fix publish pipeline (#137) 2026-09-16 17:14:17 -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
1f5501ff97
fix: Preserve shared model and SQLite value types during sync (#118) 2026-09-16 00:07:51 -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
4331daf661
perf: Reduce redundant projection and metadata reads (#124) 2026-09-14 10:53:25 -03:00
Marcelo Mendonça Soares
574f8d067a
test: Make the DST more robust (#116) 2026-09-14 10:26:56 -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
Kasper Overgård Nielsen
c78af247fe
test: Add a DST and tests reproducing found failures (#110)
Co-authored-by: Marcelo Soares <marcelo.me.soares@gmail.com>
2026-09-04 13:09:20 -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
1ddfef2988
refactor: Improve the code separation (#109)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 13:01:29 -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
92a8e22d04
chore: Fix demo pubspec override (#106) 2026-07-27 23:29: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
e89f9f8561
docs: Add documentation on how to manage scopes to the README (#101) 2026-07-09 02:09:51 -03:00
Marcelo Mendonça Soares
41fe0a27bc
docs: Update the tutorial on the README to use workspaces (#100) 2026-07-09 01:39:13 -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
d3b9a66efd
fix: Fix sync once hanging forever when opened again too quickly after closing (#98) 2026-07-09 01:15:19 -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
467df68a69
feat: Add support for the upsert and upsertRow ORM methods (#94) 2026-07-04 21:17:08 -03:00
Marcelo Mendonça Soares
c6a873d04c
fix: Require unique FK columns to be nullable (#95) 2026-07-04 21:16:37 -03:00
Marcelo Mendonça Soares
a9fa6b6b91
fix: Fix the demo app when migrations mismatch (#93) 2026-07-03 17:08:54 -03:00