Repository navigation
Keep a listing when its record is deleted but a duplicate survives - #71
Open
hipstersmoothie wants to merge 1 commit into
Open
hipstersmoothie wants to merge 1 commit into
hipstersmoothie wants to merge 1 commit into
Conversation
An owner whose create was retried can end up with two listing.detail records for one listing. If they delete the one the store row points at, Tap ingest deleted the row, taking an approved listing off the store (along with its favorites and reviews) even though the other record was still live. That's what happened to ZelkTV. Now the delete handler looks for another live record in the same repo with the row's slug (or product URL) and moves the row onto it, keeping its moderation status and recording the deleted URI in prior_at_uris. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ZelkTV disappeared from the store after being approved. The owner had two
listing.detailrecords for it, created 4 minutes apart (likely a retried create), both with slugzelk-tv. The approved row pointed at the first one. Once that record was deleted from their PDS, Tap ingest's delete handler removed the row by repo + rkey. The second record was still live, but the listing went to a 404 and its favorites cascaded away with the row.Fix
Before deleting,
markListingRemovedFromTaplists the repo's livelisting.detailrecords. If another one still describes the listing (same slug, otherwise same product URL), it does three things instead of deleting:at_uri/rkey)prior_at_uris, so favorites and reviews written against it still resolveIf there's no survivor or the PDS can't be listed, it deletes as before. The in-app delete paths remove the row themselves first, so they're unaffected.
Prod
ZelkTV is already restored by hand: rehydrated from the surviving record, marked verified, old URI added to
prior_at_uris, and both favorites re-ingested.Testing
findSurvivingListingRecord(vitest run src/lib/atproto/tap-listing-sync.test.ts)tsc --noEmitand oxlint are clean on the changed files🤖 Generated with Claude Code