Repository navigation
fix(docs): send guessed section and /en addresses to a real page - #3769
Merged
Merged
Conversation
People and language models guess docs addresses by trimming a page URL or by assuming an English prefix. The folders above pages (/platform/automations, /de/platform/admin/governance, /develop, …) have no page of their own, English lives at the root, and llms.txt exists once for every locale, so all of those guesses answered 404 even though every linked page resolves. Section folders now redirect to the first page under them in nav.json order, derived from the navigation rather than hand-maintained, with redirects.json taking precedence. An /en prefix and a locale-prefixed llms.txt or llms-full.txt resolve to the unprefixed address, landing on the final page in one hop. The prerender writes meta-refresh stubs for the derived folders like it does for moved pages. The tests guard that every section folder resolves in every locale, that no derived entry shadows a page on disk, and that no target chains into another redirect.
The feature story linked /agents and /quickstart on docs.tale.dev and the docs issue template suggested docs/getting-started.md and tale.dev/docs/setup; none of those exist. They now name the agents concepts page and the quickstart.
4 of 5 tasks
The redirect map carried its own nav.json walker and two copies of the slug-to-route collapse, next to flattenNav in lib/content/nav.ts and docPath in lib/content/paths.ts. Two walkers over the same file can drift, so the derived section folders now read flattenNav and every slug-to-URL mapping goes through one exported slugRoute helper. paths.ts imports site-url relatively, because the Bun-run server and prerender script now load it and Bun does not resolve the root tsconfig's configDir paths.
Language models are pointed at the per-page Markdown exports, and they guess those the same way readers guess section folders. A folder or a moved page answered its HTML address with a 301 but its .md twin with a 404. The redirect lookup now maps /<source>.md to /<target>.md through the shared md-paths helpers, including behind an /en prefix.
/en/<page> answered a bare 301 to the unprefixed page, which the server then negotiates again. A reader with a German or French locale cookie, or no cookie and a German Accept-Language, was sent on to /de/<page>, so the one address that names English landed on the German tree. The redirect now pins the English locale cookie (Cache-Control no-cache, so a browser does not reuse it without the cookie), exactly as a /de or /fr prefix refreshes its own. Locale-neutral targets such as llms.txt and .md exports get no cookie. The route moves into lib/redirect-route.ts so it is unit-tested, and @tale/ui/server exports isSecureRequest for its Secure flag. NAV-F17 covers the browser round trip.
The contributor contracts described redirects as coming only from docs/redirects.json. Section folders without a page now redirect to their first page in nav.json, so reordering nav.json moves that target, and the redirects suite gained three rules with their own fixes. The docs contract, the service README and the test-suite catalogue say so.
5 tasks done
This was referenced Oct 23, 2026
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
Guessed docs addresses now reach canonical content. Section folders such as
/platform/automationsredirect to the first navigation page beneath them. Their.mdexports follow too (/de/platform/automations.mdgoes to/de/platform/automations/concepts.md), and so do the.mdexports of moved pages./enaliases resolve to the English root tree, and localizedllms.txt/llms-full.txtaliases resolve to the shared root indexes. Explicit moves indocs/redirects.jsonstill win. Locale prefixes and query strings are preserved, and moved and derived folders get prerendered redirect stubs. The marketing story and the docs issue template now link to pages that exist.An
/en/<page>redirect also pins the English locale cookie (tale_locale=en,Cache-Control: no-cache). Before this, the unprefixed target was negotiated again, and a reader with a German cookie or a German Accept-Language was sent on to/de/<page>, so the one address that names English landed on the German tree. Locale-neutral targets (llms.txt,.md) get no cookie.Locale removal also refuses malformed paths that would become an external
Location:/en//outside.invalid/pagenow answers the local 404. Docs reuses the shared locale-prefix remover with an English-only selection. Its existing DE/FR default also protects single-tree sites such as UI docs. Percent-encoded separators stay encoded and same-origin. Normal locale routing is unchanged.The derived folder map reads the existing
flattenNav()walker, and every slug-to-URL mapping goes throughdocPathand one exportedslugRoutehelper, so there is no second nav walker. The contributor contracts now describe the derived redirects:docs/AGENTS.md, theservices/docsREADME, and thetests/AGENTS.mdrule catalogue with the three newsection-folder-*/derived-redirect-shadows-pagerules. They also note that reorderingnav.jsonchanges where a folder URL lands.Out of scope, noted as follow-ups:
/legal(a folder on disk that is off the navigation, holding only noindex pages) still answers 404. The derived map covers folders undernav.jsonpages only.Checklist
bun run checkpasses: not run locally. CI on this head is the gate. The scoped checks listed below pass.bun run lint:sastpasses: the Opengrep hook ran on every staged file in each commit.docs/{en,de,fr}/: N/A. No end-user page content changed. The contributor contractdocs/AGENTS.mdis updated.README.md/README.de.md/README.fr.md: N/A. Only theservices/docsREADME row changed.Test plan
At the current head:
services/docsvitest: 200 tests in 36 files. This includesredirects.test.ts(every section folder resolves in every locale, no chains, no shadowing,.mdexports of moved pages and folders follow them, including behind/en) and the newredirect-route.test.ts. That test covers the mount prefix and query being kept, an/enpage alias settingtale_locale=enwith Domain/Secure, a control case showing that a German cookie plus Accept-Language negotiates to/dewithout the pin, and no cookie for/en/llms.txt.packages/uiserver and i18n vitest: 131 tests.@tale/docsand@tale/uitypecheck pass, as do workspace oxlint--type-aware,oxfmt --check,bun run lint:manual, andcheck-guide.tsonnavigation.md.bun build server.tsbundles. Under the Bun runtime,lib/redirects.tsstill expands to 228 redirect pairs.startReactServerplus the new redirect route, temporary dist)./en/platform/workspace/skillswithCookie: tale_locale=deandAccept-Language: deanswered 301 withSet-Cookie: tale_locale=en. Following it with the cookie jar answered 200 with the English page. Without the pin, the same request answered 302 to/de/platform/workspace/skills./de/platform/automations.mdanswered 301 to/de/platform/automations/concepts.md.NAV-F16now includes the.mdguess. The newNAV-F17covers the browser round trip: a German browser that opens/en/...stays on English.At the previous head, before the review fixes (the redirect set is unchanged; 228 pairs, re-counted above):
/and/docs/(behind a prefix-stripping local proxy): 427 routes, 228 stubs, and every mapped redirect over GET and HEAD at both mounts. Real Chromium ran 26 cases in EN/DE/FR at 390px and 1280px, and the prerender SEO suite passed 9/9 at each mount.Not verified: a full site rebuild at this head (disk is nearly full on the verification machine), the
.mdredirects against a builtdist-seo, and a deployed production proxy.