Repository navigation
fix(docs): keep every docs address answering and lint every link - #3986
Merged
Merged
Conversation
The two documentation sites answer missing and moved addresses the same way, so the machinery moves into the shared docs frame: - `@tale/ui/docs/redirects`: the redirect map out of services/docs (slug maps, derived section folders, locale expansion, `.md` exports), now also taking an https target for a page that moved to another site. - `@tale/ui/docs/near-miss`: the page a guessed address means, scored on slugs and titles in every locale. Language models guess addresses from titles (`/de/verwaltung/mitglieder-und-rollen`); an exact alias or a clear fuzzy winner is answered, anything else stays a 404. The 404 page's "did you mean" list ranks with the same scorer. - `@tale/ui/docs/published`: the append-only ledger of published slugs. - `@tale/ui/docs/links`: the link rules, reading a page with the renderer's own parser and judging each link against what its site answers. They replace the i18n framework's two weaker copies (`markdown-link-target`, `markdown-anchor-parity`) and its drifted heading-slug function; heading ids now come from one pure module. - `startReactServer` gains a `resolveNotFound` hook, asked only for a plain miss before the 404 page.
359 of the 932 docs addresses ever published answered 404: pages that moved or were deleted without a redirect, the retired de-CH, de-AT and fr-CH trees, Mintlify-era pages, and legal texts that moved to tale.dev. ui.tale.dev answered 404 for /docs and every section folder, which only the client redirected. - docs/redirects.json maps the 116 lost slugs to the page that replaced each (rename history first, then content), the legal texts to https://tale.dev in the reader's locale, and the old Inbox pages to the Platform page that documents Home. - docs/published.json and services/ui-docs/content/published.json record every slug either site ever served; the content builds append new pages. The published suites fail when a recorded slug stops answering in any locale, so a page can no longer go away without a redirect. - Both servers answer what is still missing just before their 404 page: a retired regional tree, capitals or `index`/`.html` noise fold onto the real address (301); a guessed address, such as the German titles Tale's own chat agent turned into slugs, lands on the page that clearly wins (302). Junk and missing assets stay 404. - ui-docs answers /docs, section folders and moved guides with a 301 from the server, from the same shared redirect machinery as the docs.
The old checks read inline Markdown links only, resolved them against
the locale root instead of the page, skipped anything with an extension,
never looked at ui-docs content, and left links into the docs from the
rest of the repository to "grep the monorepo".
- Each site describes what it answers (scripts/link-site.ts: pages,
files, artifacts, redirects), and its link suite judges every link a
page renders (the renderer's own parser, so component attributes and
reference links count and code never does) against it: no 404, no link
through a redirect, every fragment an id the target renders, translated
pages kept in their locale. anchors.test.ts folds into it.
- tools/lint-links (`bun run lint:links`, CI's Format job and `bun run
check`) judges the same way every absolute docs address in every other
file, and the docs paths code builds (`${TALE_DOCS_URL}/…`, the
marketing site's docs lists). It found the marketing site still linking
a moved chat page.
- `@tale/e2e/crawl` serves a built site with its own server and follows
every address the prerendered pages, llms.txt, the sitemap and the
Markdown exports carry. Both sites run it in `test:prerender`, now in
CI's Build job, catching the links the docs frame builds.
- turbo hashes the shared rules and the crawler for the tasks that read
them, and caches dist-seo/ with the build, so neither a rule change nor
a cache hit can replay a stale green.
RoutedMarkdown and Card sent every internal href through TanStack Router, including `/llms.txt`, a page's `.md` export or an image. The router knows only pages, so a click on such a link rendered the SPA's not-found page instead of fetching the file. A link whose last segment names a file now renders as a plain anchor, so the server answers it; an external link keeps opening in a new tab.
llms.txt listed English addresses only and said nothing about the German and French trees, so a model answering in German guessed, and translated the path (`/de/verwaltung/mitglieder-und-rollen`). The index now says, in the spec's place for how to read it, that every page lives under `/de` and `/fr` with the same path, never translated, and to open only listed addresses. The shared SEO pipeline carries an optional preamble through both the precompiled and the on-demand builders.
- The data processing agreement pointed its subprocessor list at /legal/subprocessors on tale.dev, a 404 in every locale. The list is published on the docs site, so the agreement now links it there. - The chat page's "Agents in chat" link went through the redirect of a merged docs page; it now links the page that redirect lands on. Both were found by `bun run lint:links` and the tale.dev crawl.
The published suites only saw the tree as it is. An agent that met `published-address-lost` could delete the ledger line, or the line and its redirect together, and the lost address would pass. `lint:links` now compares a change with its base commit: - `retired-page-404`: a page file the change deletes or renames leaves its old address answering 404. One finding per page, naming the `redirects.json` line to add (with the new slug for a rename). - `published-line-removed`: a slug the ledger held before the change is gone. The ledger is append-only. The base is `LINT_LINKS_BASE`, else `HEAD^1` in GitHub Actions (a pull request's merge commit has the base branch as its first parent; the Format job now checks out with `fetch-depth: 2`, and a missing parent is an error, never a skip), else the merge base with origin/main. Page existence in the lint now comes from the content files rather than the generated manifest, so a page deleted without regenerating it still reads as gone, and a "did you mean" never names an address that is missing itself. docs/AGENTS.md gains the step-by-step retirement procedure. The ui-docs content contract, the write-docs skill (whose description now names moving and deleting pages), the repo contract and the published-suite messages point at it.
CI's Unit job timed out `every link under en/ lands` at vitest's 5 s default: on a two-core runner beside other suites, parsing the whole corpus with the renderer's parser takes seconds, and it grows with every page. Each page was also parsed twice, once as a source for its links and again as a target for its anchors. The site modules now parse a page once per run and answer both from it (the suite drops from ~1.6 s to ~1.1 s per locale locally), and the corpus-wide cases carry an explicit 60 s timeout. The near-miss test no longer asserts a wall-clock bound, which a loaded runner could break; the word cap is asserted by its outcome.
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
Readers and agents hit many 404s on the docs sites. The live link graph was clean. The 404s came from addresses that used to exist: 359 of the 932 docs.tale.dev URLs ever published answered 404. They were moved or deleted pages, the retired
de-CH/de-AT/fr-CHtrees, Mintlify-era pages, and legal texts that moved to tale.dev. Agents made it worse by guessing: Tale's own chat agent built URLs from page titles and translated folders (/de/verwaltung/mitglieder-und-rollen,…/automation-concepts,…/retention-limits). On ui.tale.dev,/docsand every section folder answered 404 from the server; only the client redirected.This PR fixes the 404s and makes them unable to come back:
docs/redirects.jsonmaps the 116 lost slugs to the page that replaced each; legal pages go tohttps://tale.dev/…in the reader's locale. Append-only ledgers (docs/published.json,services/ui-docs/content/published.json) record every slug either site ever served. A page that goes away without a redirect now fails CI.@tale/ui/docs/near-miss). Retired regional trees and case,indexor.htmlnoise fold onto the real page (301). A title-shaped or translated guess lands on the page that clearly wins (302). Junk and missing assets stay 404. The 404 page's "did you mean" list uses the same scorer. ui-docs answers/docs, section folders and moved guides with a 301 from the server.@tale/ui/docs/links, replacing three divergent copies). Links are read with the renderer's own parser: component attributes and reference links count, code never does. They resolve against the page URL like a browser does and are judged against what each site actually answers: no 404, no link through a redirect, every fragment an id the target renders, translated pages kept in their locale. ui-docs content is now covered.bun run lint:links(tools/lint-links, CI Format job,bun run check) judges every absolute docs address in the repo and the docs paths code builds (${TALE_DOCS_URL}/…, the marketing site's docs lists).lint:linkscompares the working tree with the change's base commit:HEAD^1in CI (a PR's merge commit), with the Format job checking out atfetch-depth: 2; locally the merge base withorigin/main. It refuses a deleted or renamed page whose old address now 404s (retired-page-404), naming the exactredirects.jsonline to add, and a line removed from apublished.jsonledger (published-line-removed), so an agent can't make the published suite pass by deleting the ledger line.docs/AGENTS.mdnow has the step-by-step "Retire, rename or merge a page" procedure, and the ui-docs content contract, the write-docs skill and the repo contract point at it.@tale/e2e/crawlservesdist/with each site's own server and follows everything the pages,llms.txt, the sitemap and the.mdexports carry (test:prerender, now in CI's Build job)./llms.txt,*.md) no longer go through the client router.llms.txtnow says German and French live under/deand/frwith the same, never-translated path.Commits are atomic; see each body for detail.
Checklist
bun run checkpasses. Ran format:check, lint:conflicts, lint:links, lint:manual, knip, and turbo lint, typecheck and test for@tale/ui,@tale/docs,@tale/ui-docs,@tale/e2e,@tale/lint-linksand@tale/web. Also typechecked@tale/platformand@tale/marketing-uiand ran their i18n, SEO and markdown tests. The full platformtest/test:uirun is left to CI.bun run lint:sastpasses (467 rules, 0 findings).llms.txtis one English index for every locale.docs/{en,de,fr}pages (no product behaviour changes). Contributor docs are updated:docs/AGENTS.md,services/docs/tests/AGENTS.md, the service READMEs, the ui-docs content contract,.agents/repo.md, and the write-docs skill. Manual boxesNAV-F18–F20andSEO-12/13are added,NAV-B1/F9updated, and the automation registers extended.Test plan
Everything below was run locally against production builds of this branch, served by each site's own server:
resolve-urls.ts: all 932 historic docs URLs resolve to a 200 page (live v0.5.63: 359 × 404). All 20 historic ui-docs URLs resolve.services/docs/tests/near-miss.test.ts./docs,/docs/componentsand/components/buttonanswer 301;/docs/buttonand/docs/components/butonanswer 302;/docs/components/selectand/assets/missing.jsstay 404./platform/chat/zzzz.llms.txtlinks do a full load.test:prerendercrawls are green.retired-page-404naming the missing redirect, plus every inbound link (docs pages, READMEs,SCREENSHOTS.md, the marketing catalogs). Also deleting its ledger line addspublished-line-removed. Agit mvrename names the exact entry ("platform/chat/voice-mode": "platform/chat/voice"). Done right (redirect added, line kept), both rules pass and the inbound links are flaggedlink-via-redirectuntil they point at the new page.tools/lint-links/tests/git.test.tscovers base resolution against a real repository.<Card href>, reference definition, image, locale switch, a README link,${TALE_DOCS_URL}/develop/api-refrence) are each reported with a fix suggestion. Code samples and../relativelinks are judged correctly.Deploy note: merging doesn't deploy the sites. The live 404s stay until the next release builds the docs images.