bluesky-social / atproto

Social networking technology created by Bluesky
Other
5.77k stars 407 forks source link

Default to cascading deletes on duplicate records #567

Open dholms opened 1 year ago

dholms commented 1 year ago

Duplicate records - ie two follows of the same person or two likes on the same post - can exist in the repo. On delete, we should default to deleting all duplicates, with an optional flag to only delete the specific record mentioned

pfrazee commented 1 year ago

Is this special-cased logic in the com.atproto.repo.deleteRecord method for follows, or where is this located?

devinivy commented 1 year ago

There's precedent for this in two places that I know of.

There's a flag for this in the record processor, but it's only relative to indexing, that is the cascade does not actually delete additional records from repos: https://github.com/bluesky-social/atproto/blob/3a6d785ae086ab68376096a45a7d0cf1d25c1bf4/packages/pds/src/services/record/processor.ts#L85

Then setVote is special-cased to clean-up duplicates at the repo level: https://github.com/bluesky-social/atproto/blob/3a6d785ae086ab68376096a45a7d0cf1d25c1bf4/packages/pds/src/api/app/bsky/feed/setVote.ts#L44-L53

My understanding of what @dholms wants to do is take the latter and generalize it into the repo.deleteRecord method.

dholms commented 1 year ago

yup basically^^

Not special-cased to follows, it'd be a generic flag for backlinks. Although now that I think about it, this probably makes more sense to do off of a new "backlink table" (PDS construct) than it does off of the existing "duplicate-records table" (AppView construct)

devinivy commented 1 year ago

Agree, we could sneak this in now, but it would make a lot more sense with a backlinks table already in place.