Skip to content

Resilient authors: never crash on a missing profile#28

Merged
HumbleBee14 merged 1 commit into
mainfrom
fix/resilient-authors
Jul 15, 2026
Merged

Resilient authors: never crash on a missing profile#28
HumbleBee14 merged 1 commit into
mainfrom
fix/resilient-authors

Conversation

@HumbleBee14

Copy link
Copy Markdown
Member

Makes the site robust when an author profile is deleted or referenced without an existing file — it degrades to Guest instead of failing the build.

Before: authors: z.array(reference('authors')) validated author existence at build time, so deleting an author while a post still referenced it broke the whole build.

After:

  • Author fields are plain handle strings (z.string()); frontmatter format is unchanged (authors: [dinesh]).
  • One defensive resolver (resolveAuthors in src/lib/posts.ts): a missing profile logs a non-fatal build warning and falls back to the Guest Contributor profile (which has a real /authors/guest page — no broken links). If even guest.json is gone, it synthesizes a Guest so it still can't crash.
  • All byline/author-list consumers updated to the string-handle model.

Verified: temporarily deleted a referenced author (ana.json) — build now warns and completes green, crediting affected posts to Guest. Previously this was a hard build failure.

Note: this trades build-time reference validation for runtime resilience; broken handles are surfaced as build-log warnings rather than errors.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mlsystems with  Cloudflare Pages  Cloudflare Pages

Latest commit: 82e9f14
Status: ✅  Deploy successful!
Preview URL: https://68b53df4.mlsystems.pages.dev
Branch Preview URL: https://fix-resilient-authors.mlsystems.pages.dev

View logs

@github-actions

Copy link
Copy Markdown

@HumbleBee14
HumbleBee14 merged commit 2f269ca into main Jul 15, 2026
2 checks passed
@HumbleBee14
HumbleBee14 deleted the fix/resilient-authors branch July 15, 2026 02:22
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