Serve a branded homepage fallback when the here.now shell is unavailable#85
Open
HMAKT99 wants to merge 1 commit into
Open
Serve a branded homepage fallback when the here.now shell is unavailable#85HMAKT99 wants to merge 1 commit into
HMAKT99 wants to merge 1 commit into
Conversation
The homepage is rendered by fetching the here.now shell, injecting the catalog, and serving it. When that fetch throws or the shell returns a 5xx, the Worker passed the upstream failure straight through (loop-routes.js), so visitors hit an unbranded, catalog-less dead end even though the Worker already holds every loop record in its own database. Render a minimal branded fallback homepage from that catalog instead: it keeps the site chrome, lists every published loop with working links, and points agents at catalog.json and llms.txt. The real failure status is preserved (the upstream 5xx, or 502 when the shell is unreachable) so the outage stays honest and the page is marked noindex. Covered by two tests.
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.
Summary
The homepage is served by fetching the here.now shell, injecting the catalog, and returning it (
loop-routes.js). When that origin fetch throws or the shell returns a 5xx, the Worker passed the upstream failure straight through:So during a shell/here.now hiccup, visitors hit an unbranded, catalog-less dead end — even though the Worker already holds every loop record in its own database and renders detail pages from it.
Change
When the shell is unavailable on the homepage, render a minimal branded fallback from the catalog the Worker already has, instead of leaking the upstream error:
catalog.jsonandllms.txt(still live).502when the shell is unreachable — so the outage stays honest, and marks the pagenoindexso the degraded view isn't indexed.Behavior is unchanged on the happy path and for non-5xx responses (4xx still passes through as before). Detail pages already render from the DB, so they're unaffected.
Files
worker/src/render-loops.js— newrenderHomepageFallback(loops).worker/src/loop-routes.js— serve it on a thrown fetch (502) or upstream 5xx (status preserved).worker/test/loop-routes.test.js— two tests (5xx → branded 503 fallback, not the upstream body; unreachable → 502).Verification
npm --prefix loop-library/worker run check→ 49/49 pass.node loop-library/scripts/check.mjs→ "Loop Library database-only checks passed."git diff --check→ clean.Happy to adjust or close if you'd rather the homepage stay strictly shell-driven on failure — this is meant as a resilience nicety, leaning on the fact that the Worker is now the source of truth for loops.