Skip to content

Serve a branded homepage fallback when the here.now shell is unavailable#85

Open
HMAKT99 wants to merge 1 commit into
Forward-Future:mainfrom
HMAKT99:feat/homepage-shell-fallback
Open

Serve a branded homepage fallback when the here.now shell is unavailable#85
HMAKT99 wants to merge 1 commit into
Forward-Future:mainfrom
HMAKT99:feat/homepage-shell-fallback

Conversation

@HMAKT99

@HMAKT99 HMAKT99 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

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:

const originResponse = await dependencies.fetch(originRequest);
if (!originResponse.ok) return originResponse;

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:

  • Keeps the site chrome (header/nav/footer) and theme.
  • Lists every published loop with working links, so nothing becomes unreachable during an outage.
  • Points agents at catalog.json and llms.txt (still live).
  • Preserves the real failure status — the upstream 5xx, or 502 when the shell is unreachable — so the outage stays honest, and marks the page noindex so 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 — new renderHomepageFallback(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.

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.
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