Skip to content

fix(handbook): stop calling resolve('') in root-landing check - #172

Merged
nerdalytics merged 6 commits into
trunkfrom
fix/handbook-resolve-root-landing
Oct 13, 2026
Merged

nerdalytics merged 6 commits into
trunkfrom
fix/handbook-resolve-root-landing

Conversation

@nerdalytics

@nerdalytics nerdalytics commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

+layout.svelte computed isRootLanding with a second clause page.url.pathname === resolveHref(''). resolveHref forwards to $app/paths resolve(), which throws on any argument not starting with /. The validation is present in @sveltejs/kit 2.65.0 and 2.70.2; the earlier pinned 2.55.0 had none (resolve('') returned base + '/'). The lockfile first picked up a validating kit in b677828 (#149).

Consequences, reproduced locally with BASE_PATH=/beacon npm run build on kit 2.70.2:

  • Prerendering 500s on every page except the root redirect stub ([500] GET /beacon/latest ... Cannot use resolve(...) in the build log). prerender.handleHttpError: 'warn' in handbook/svelte.config.js downgraded those to warnings, so CI was green while the Pages artifact contained only index.html, 404.html, the redirect stubs and the .md/llms.txt endpoints (4 HTML files total). The currently published site, from the Sep 11 workflow_dispatch run, is in that state: /beacon/latest/ and /beacon/v2000.0.0/introduction return 404.
  • GitHub Pages serves the fallback 404.html with a 404 status for any missing route; the client app boots on it and the same resolve('') throws uncaught during render, leaving a blank page with Cannot use resolve(...) (got "") in the console.

The clause adds nothing even where it does not throw: in the client and during prerendering, resolve('/') already equals base + '/', the only value the second clause could ever match. This removes it.

The PR also contains:

  • DocLayout derived its version prefix by stripping base from page.url.pathname. During prerendering $app/paths base is relative (overridden per request), so the prefix came out empty and VersionLink emitted root-level hrefs — ../lens from /latest/select, ../migration from /v1000.0.0/introduction — the two 404s the crawl warned about. It now derives from page.route.id, which carries no base on server or client; the prev/next index comparison had the same mismatch and is fixed the same way.
  • 14 hardcoded absolute markdown links (](/latest/hooks-overview) and siblings) lacked base entirely: they 404 outside /beacon for users and fail the crawl's base check. They now go through VersionLink.
  • prerender.handleHttpError: 'warn' is removed, restoring the kit default 'fail': any non-OK response during prerendering, including 500s from render crashes, fails the build instead of shipping a hollow artifact green.

Verification, same build command, after all changes: exit 0, zero 404/500 lines during prerendering, 232 HTML files including latest.html and v2000.0.0/introduction.html; static-HTML anchors resolve inside base (e.g. ../latest/hooks-overview from /beacon/latest/state).

@nerdalytics
nerdalytics merged commit 662e023 into trunk Oct 13, 2026
12 checks passed
@nerdalytics
nerdalytics deleted the fix/handbook-resolve-root-landing branch October 13, 2026 13:50
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