fix(posts): link duplicate items to every post + prune bare shells #88
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The native Patreon backfill flooded the Posts feed with bare "Post <id> / (no description) / No images attached" shells — 1589 for one creator. Two related gaps:
PostAttachment.sha256was globally unique, so a non-art file reused across posts only ever linked to the first post;_capture_attachmentcreated the Post before that dedup check → bare shells (no image, no attachment).attach_in_placebefore_apply_sidecar, so the second post got noimage_provenancerow; and the feed rendered images only viaimage_record.primary_post_id(one post per image).What
Operator requirement — a duplicate item must show on every post it appears in — made this a link-not-suppress fix:
duplicate_hash/duplicate_phash(larger_exists), append animage_provenancerow for the new post (primary stays on the first). Both the download path (attach_in_place) and filesystem path (_import_media).post_feed_servicerenders thumbnails byimage_provenance ∪ primary_post_id, so cross-posted images show on every post (legacy primary-only images still show).UNIQUE(sha256), add partialUNIQUE(post_id, sha256)+ partialUNIQUE(sha256) WHERE post_id IS NULL(migration 0043);_capture_attachmentdedups per-(post, sha) over the shared sha-addressed blob.cleanup_service._bare_post_conditions()shared by preview/count/delete (preview/apply parity),/api/admin/posts/prune-bareendpoint, and a Post-maintenance card in the Cleanup view. Deletes only posts with zero image links (primary or provenance) and zero attachments.Notes
🤖 Generated with Claude Code