arroba icon indicating copy to clipboard operation
arroba copied to clipboard

when creating new repo, emit `#sync` before first `#commit`

Open snarfed opened this issue 7 months ago • 3 comments

For new repo, send #sync before storing or emitting any commits. Background: #52, https://github.com/bluesky-social/proposals/tree/main/0006-sync-iteration#staying-synchronized-sync-event-auto-repair-and-account-status

snarfed avatar May 10 '25 21:05 snarfed

From https://github.com/snarfed/arroba/issues/52#issuecomment-2816324912 :

if you can send a #sync at account creation time, when the repo is empty, that is helpful. same time as a first #commit is sent; if you can do the #sync before the #commit, but after any identity/account events, that is best

snarfed avatar May 12 '25 22:05 snarfed

We're now emitting this, just not at quite the right time. Our firehose event order for new repos is #commit, #account, #identity, #sync, but the commit should actually be at the end, not at the beginning.

Unfortunately I suspect fixing that will largely depend on #34. (Which would be good to do! Just, nontrivial.)

snarfed avatar May 14 '25 22:05 snarfed

This is in Repo.create. Next step here is to pull sequence number allocation out of Storage.commit so that we can change our order of operations to first allocate the sequence number and emit #sync, then commit.

...except even trickier, if I understand right, we probably need to have the commit stored before emitting #sync. So the order needs to be 1 commit, 2 emit #sync, 3 emit #commit. Ugh.

snarfed avatar Sep 27 '25 14:09 snarfed