Skip to content

Remove stale guests and hosts when re-syncing a show - #2328

Merged
wesbos merged 1 commit into
mainfrom
fix/sync-stale-show-guests
Nov 23, 2026
Merged

wesbos merged 1 commit into
mainfrom
fix/sync-stale-show-guests

Conversation

@wesbos

@wesbos wesbos commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Episode 1057 (Write Once, Deploy Everywhere) shows Michael Arnaldi as a guest. The Effect.ts episode was originally published as 1057 and later renumbered to 1056 (#2320). The sync only ever adds ShowGuest rows and connects hosts, so the guest link on syntax_podcast_show_1057 survived when today's episode overwrote that row.

Fix (src/server/shows.ts)

  • After saving frontmatter guests, delete any ShowGuest rows for that show whose guest isn't listed. Skipped if any guest failed to save, so a failed import can't drop a real guest.
  • On update, hosts use set instead of connect when the file has a hosts key, so removed hosts are unlinked too. Files without hosts are untouched.

After deploy

The changed-shows sync will skip 1057 since its hash already matches. Run the full import from admin (or touch the 1057 markdown) to clear Michael off it.

🤖 Generated with Claude Code


Note

Medium Risk
Changes podcast sync behavior for relational data; incorrect pruning logic could drop valid host/guest links, though guest deletion is gated on successful imports.

Overview
Show import from markdown now treats front matter as the source of truth for hosts and guests, so renumbered or edited episodes don't leave old associations in the database.

On update, host links use Prisma set instead of connect, replacing the host list when a hosts key is present (create still connects). After guests are upserted, ShowGuest rows for that show that aren't in the saved list are deleted—but only if every guest import succeeded, so a partial failure won't unlink real guests.

Reviewed by Cursor Bugbot for commit 5fd35a4. Bugbot is set up for automated code reviews on this repo. Configure here.

The show sync only ever added ShowGuest rows and connected hosts, so when
an episode was renumbered (Effect.ts 1057 -> 1056) its guest stayed linked
to the old number and showed up on the next episode that took it.

Guests not listed in the frontmatter are now unlinked from the show (only
when every listed guest saved successfully), and hosts are replaced with
`set` on update when the file has a hosts key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
syntax-website Ready Ready Preview Nov 23, 2026 1:59pm UTC

Request Review

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 8.99MB (100.0%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
website-__sveltekit_yc6xi2.app-server-esm 6.61MB 6.61MB (100%) ⬆️⚠️
website-__sveltekit_yc6xi2.app-client-esm 2.38MB 2.38MB (100%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: website-__sveltekit_yc6xi2.app-client-esm

App Routes Affected:

App Route Size Change Total Size Change (%)
/(site)/system/colors (New) 44.13kB 44.13kB 100% 🚀
/(site)/admin (New) 3.83kB 3.83kB 100% 🚀
/(site)/admin/submissions (New) 6.93kB 6.93kB 100% 🚀
/(site)/admin/cache (New) 1.49kB 1.49kB 100% 🚀
/(site)/admin/shows (New) 4.79kB 4.79kB 100% 🚀
/(site)/guest/[name_slug] (New) 1.43kB 1.43kB 100% 🚀
/(site)/sickpicks (New) 1.24kB 1.24kB 100% 🚀
/(site)/admin/shows/[show_number] (New) 3.75kB 3.75kB 100% 🚀
/(blank)/links (New) 3.17kB 3.17kB 100% 🚀
/(site)/videos/[p_slug] (New) 1.19kB 1.19kB 100% 🚀
/(site)/shows (New) 4.81kB 4.81kB 100% 🚀
/(site)/system/typography (New) 3.3kB 3.3kB 100% 🚀
/(site)/admin/videos/import (New) 2.7kB 2.7kB 100% 🚀
/(site)/spooky (New) 1.78kB 1.78kB 100% 🚀
/(site)/search (New) 828 bytes 828 bytes 100% 🚀
/(site)/suggest (New) 543 bytes 543 bytes 100% 🚀
/(site)/guests (New) 3.28kB 3.28kB 100% 🚀
/(site)/system/components (New) 1.75kB 1.75kB 100% 🚀
/(site)/admin/transcripts (New) 1.97kB 1.97kB 100% 🚀
/(site)/videos (New) 2.9kB 2.9kB 100% 🚀
/(site)/about (New) 7.87kB 7.87kB 100% 🚀
/(site)/snackpack (New) 1.98kB 1.98kB 100% 🚀
/(site)/snackpack/[issue_id] (New) 1.75kB 1.75kB 100% 🚀
/(blank)/og/[show_number_or_title] (New) 8.75kB 8.75kB 100% 🚀
/(site) (New) 47.11kB 47.11kB 100% 🚀
/(site)/show/[show_number]/[slug] (New) 13.88kB 13.88kB 100% 🚀
/(site)/oss (New) 1.94kB 1.94kB 100% 🚀
/(site)/show/[show_number]/[slug]/transcript (New) 20.3kB 20.3kB 100% 🚀
/(site)/system/layout (New) 1.45kB 1.45kB 100% 🚀
/(site)/pages/[page] (New) 653 bytes 653 bytes 100% 🚀
/(site)/admin/videos (New) 1.75kB 1.75kB 100% 🚀
/(site)/system (New) 994 bytes 994 bytes 100% 🚀
/(blank) (New) 665 bytes 665 bytes 100% 🚀
/(site)/videos/[p_slug]/[v_slug] (New) 1.67kB 1.67kB 100% 🚀
/(site)/system/theme (New) 2.18kB 2.18kB 100% 🚀
/(blank)/embed/[show_number] (New) 4.35kB 4.35kB 100% 🚀
/(site)/login (New) 2.83kB 2.83kB 100% 🚀
/ (New) 1.46kB 1.46kB 100% 🚀
/(site)/potluck (New) 1.43kB 1.43kB 100% 🚀
/(site)/admin/videos/[playlist_id] (New) 1.42kB 1.42kB 100% 🚀
view changes for bundle: website-__sveltekit_yc6xi2.app-server-esm

App Routes Affected:

App Route Size Change Total Size Change (%)
/(site)/system/colors (New) 3.51kB 3.51kB 100% 🚀
/(site)/admin (New) 6.84kB 6.84kB 100% 🚀
/(site)/[...number] (New) 1.53kB 1.53kB 100% 🚀
/(site)/admin/submissions (New) 9.49kB 9.49kB 100% 🚀
/(site)/admin/cache (New) 3.29kB 3.29kB 100% 🚀
/(site)/admin/shows (New) 10.82kB 10.82kB 100% 🚀
/(site)/guest/[name_slug] (New) 3.58kB 3.58kB 100% 🚀
/(blank)/keyboard (New) 907 bytes 907 bytes 100% 🚀
/(site)/sickpicks (New) 4.39kB 4.39kB 100% 🚀
/(site)/admin/shows/[show_number] (New) 7.76kB 7.76kB 100% 🚀
/(blank)/links (New) 3.68kB 3.68kB 100% 🚀
/(site)/svg/grit.svg (New) 2.81kB 2.81kB 100% 🚀
/(site)/videos/[p_slug] (New) 3.11kB 3.11kB 100% 🚀
/api/transcripts/[number=show_number] (New) 1.96kB 1.96kB 100% 🚀
/(site)/admin/videos/import (New) 11.05kB 11.05kB 100% 🚀
/(site)/shows (New) 8.11kB 8.11kB 100% 🚀
/(site)/system/typography (New) 3.6kB 3.6kB 100% 🚀
/(site)/spooky (New) 3.48kB 3.48kB 100% 🚀
/(site)/search (New) 1.01kB 1.01kB 100% 🚀
/(site)/svg/wave.svg (New) 4.5kB 4.5kB 100% 🚀
/(site)/suggest (New) 864 bytes 864 bytes 100% 🚀
/(site)/guests (New) 4.93kB 4.93kB 100% 🚀
/api/57475/3v3n7 (New) 1.31kB 1.31kB 100% 🚀
/api/57475/script.js (New) 1.09kB 1.09kB 100% 🚀
/(site)/system/components (New) 2.78kB 2.78kB 100% 🚀
/(blank)/shop (New) 896 bytes 896 bytes 100% 🚀
/(site)/admin/transcripts (New) 4.16kB 4.16kB 100% 🚀
/(site)/videos (New) 5.82kB 5.82kB 100% 🚀
/(site)/about (New) 9.58kB 9.58kB 100% 🚀
/(site)/snackpack (New) 6.07kB 6.07kB 100% 🚀
/content.json (New) 1.43kB 1.43kB 100% 🚀
/(site)/snackpack/[issue_id] (New) 3.79kB 3.79kB 100% 🚀
/(blank)/og/[show_number_or_title] (New) 10.61kB 10.61kB 100% 🚀
/(site) (New) 29.53kB 29.53kB 100% 🚀
/(site)/show/[show_number]/[slug] (New) 20.53kB 20.53kB 100% 🚀
/(site)/oss (New) 3.65kB 3.65kB 100% 🚀
/api/shows (New) 1.39kB 1.39kB 100% 🚀
/(site)/show/[show_number]/[slug]/transcript (New) 10.07kB 10.07kB 100% 🚀
/(site)/pages/[page] (New) 77.12kB 77.12kB 100% 🚀
/api/seed.json (New) 2.81kB 2.81kB 100% 🚀
/sitemap.xml (New) 4.61kB 4.61kB 100% 🚀
/(site)/admin/videos (New) 4.12kB 4.12kB 100% 🚀
/(site)/system/layout (New) 1.74kB 1.74kB 100% 🚀
/robots.txt (New) 1.15kB 1.15kB 100% 🚀
/api/shows/[number=show_number] (New) 1.62kB 1.62kB 100% 🚀
/(site)/system (New) 1.45kB 1.45kB 100% 🚀
/webhooks/refresh (New) 1.25kB 1.25kB 100% 🚀
/(blank) (New) 1.01kB 1.01kB 100% 🚀
/(site)/videos/[p_slug]/[v_slug] (New) 4.56kB 4.56kB 100% 🚀
/(site)/system/theme (New) 4.08kB 4.08kB 100% 🚀
/api/oauth/github (New) 1.63kB 1.63kB 100% 🚀
/(blank)/embed/[show_number] (New) 5.03kB 5.03kB 100% 🚀
/(site)/login (New) 3.05kB 3.05kB 100% 🚀
/api/errors (New) 1.94kB 1.94kB 100% 🚀
/api/shows/latest (New) 1.34kB 1.34kB 100% 🚀
/(blank)/og/[show_number].jpg (New) 2.73kB 2.73kB 100% 🚀
/ (New) 1.9kB 1.9kB 100% 🚀
/webhooks/ai (New) 2.93kB 2.93kB 100% 🚀
/(site)/admin/videos/[playlist_id] (New) 4.14kB 4.14kB 100% 🚀
/(site)/potluck (New) 2.94kB 2.94kB 100% 🚀
/webhooks/transcripts (New) 2.02kB 2.02kB 100% 🚀
/(site)/show/[...all] (New) 1.53kB 1.53kB 100% 🚀
/api/oauth/github/callback (New) 3.34kB 3.34kB 100% 🚀

@wesbos
wesbos merged commit 8e5213d into main Nov 23, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 5fd35a4a Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant