-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firehose tombstones #1017
firehose tombstones #1017
Conversation
(test on its way...) |
it actually totally had to do with time 😅 we just have a million small things to do that would only take 20 min a piece, but haven't gotten around to Besides getting the invalidation logic in here, it looks good! thanks for doing this! |
f207bce
to
5a21854
Compare
packages/pds/src/sequencer/events.ts
Outdated
@@ -151,6 +167,10 @@ export const invalidatePrevHandleOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['handle']) | |||
} | |||
|
|||
export const invalidatePrevOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['append', 'handle', 'rebase']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enumerating all the different event types here feels sort of bad and prone to breaking next time an event type is added. i guess i could change the db query in invalidatePrevSeqEvts
to just not have a where eventType =
clause for this case? thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yknow what I just realized?
We actually delete all the repo_seq events for a user when they delete their account, so there won't be any events to invalidate 😅
I think you're actually good the way it was. Sorry about that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to prevent a potential footgun where we clear out all of an account's repo_seqs after we create the tombstone op, maybe we add a where eventType != 'tombstone
on the repo_seqs deletion in the repo service
if ( | ||
(frame.header.t === "#commit" && (frame.body as CommitEvt).repo === userDid) | ||
|| (frame.header.t === "#handle" && (frame.body as HandleEvt).did === userDid) | ||
|| (frame.header.t === "#tombstone" && (frame.body as TombstoneEvt).did === userDid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here wrt enumerating all the types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though in this situation i don't think there's a better way to extract a did from body without doing this
H |
hey @jesopo wondering if you're planning on getting back to this or if i should get it over the line? |
what's missing |
The comments I left here: #1017 (comment) I led you astray earlier & we actually don't need to invalidate events on the stream, we fully delete them on account deletion. Sorry about the confusion on this! Plus, Adding in the extra check on account deletion to ensure that we don't delete the |
ah yeah sorry missed that. I'll look at it shortly |
08b9769
to
06f240c
Compare
@dholms how's that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup this looks good! thanks for putting this together
running tests then i'll merge & deploy soon
|
||
const tombstoneEvts = getTombstoneEvts(evts.slice(-2)) | ||
verifyTombstoneEvent(tombstoneEvts[0], baddie1) | ||
verifyTombstoneEvent(tombstoneEvts[1], baddie2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after adding in invalidation - an extra check in this test to ensure that it properly invalidates previous handle & commit events would be cool 👌
packages/pds/src/sequencer/events.ts
Outdated
@@ -151,6 +167,10 @@ export const invalidatePrevHandleOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['handle']) | |||
} | |||
|
|||
export const invalidatePrevOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['append', 'handle', 'rebase']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yknow what I just realized?
We actually delete all the repo_seq events for a user when they delete their account, so there won't be any events to invalidate 😅
I think you're actually good the way it was. Sorry about that!
packages/pds/src/sequencer/events.ts
Outdated
@@ -151,6 +167,10 @@ export const invalidatePrevHandleOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['handle']) | |||
} | |||
|
|||
export const invalidatePrevOps = async (db: Database, did: string) => { | |||
return invalidatePrevSeqEvts(db, did, ['append', 'handle', 'rebase']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to prevent a potential footgun where we clear out all of an account's repo_seqs after we create the tombstone op, maybe we add a where eventType != 'tombstone
on the repo_seqs deletion in the repo service
oh i see, your last round of comments were not actually submitted yet and now they are. i shall take a look |
(also, i will fix tests) |
are you sure about this? |
atproto/packages/pds/src/services/account/index.ts Lines 400 to 419 in 95252dd
I don't see |
yeah that delete happens in the repo service
i'll have to check this out to see where the hiccup is happening 🤔 |
race you 🏃 |
06f240c
to
7874d72
Compare
figured it out - my test was only calling account delete, not repo delete |
(I think CI should start running automatically for your PRs after this one lands) but in the mean time, mind running |
& then we'll finally get this in! |
done(?) |
i believe this won't send tombstones for account takedowns. i imagine that's desired behaviour anyway, but just wanted to check |
(don't hate me there's a merge conflict) I actually tried to resolve this myself & some of the tests are failing 🤔 I'm really not sure why as none of your changes affect sequencing logic, need to look into it more... Similar failures as over here: #1173 |
I'll check this eve :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* firehose tombstones * return tombstones from sequencer requestSeqRange * firehose tombstone test * oops semicolons :3 * yes this can be const * fix verifyTombstoneEvent func signature * invalidate all sequence events upon tombstone * don't manually purge all seqs, test for tombstone after delete * actually fully delete account * fix linting --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
* firehose tombstones * return tombstones from sequencer requestSeqRange * firehose tombstone test * oops semicolons :3 * yes this can be const * fix verifyTombstoneEvent func signature * invalidate all sequence events upon tombstone * don't manually purge all seqs, test for tombstone after delete * actually fully delete account * fix linting --------- Co-authored-by: Devin Ivy <devinivy@gmail.com>
to be honest this change seems so simple that i assume the reason it wasn't implemented yet is less to do with spare time and more to do with technical details that need to be worked out, but i thought i'd try my luck anyway