Skip to content

fix: add .mdx suffix to ~190 bare relative links that break on SPA click#1946

Merged
Piotr1215 merged 10 commits intomainfrom
devops-775/fix-bare-relative-links
Apr 17, 2026
Merged

fix: add .mdx suffix to ~190 bare relative links that break on SPA click#1946
Piotr1215 merged 10 commits intomainfrom
devops-775/fix-bare-relative-links

Conversation

@Piotr1215
Copy link
Copy Markdown
Contributor

@Piotr1215 Piotr1215 commented Apr 16, 2026

Content Description

Adds .mdx suffix to bare relative markdown links across vcluster/ (main) and vcluster_versioned_docs/version-0.33.0/ that break on SPA click due to the Docusaurus SSR-vs-CSR URL resolution mismatch documented in the DOC-1311 post-mortem. Also commits the detection scanner to scripts/find-spa-broken-links.py and adds a CI linter workflow that blocks PRs introducing new bare relative links.

Changes:

  • Scanner (scripts/find-spa-broken-links.py): detects relative links without .mdx/.md suffix that would 404 on SPA click. Includes known-exceptions allowlist for links that cannot take .mdx without breaking the build (auto-generated CLI pages, numbered-prefix filenames, removed directories).
  • Link fixes in v0.33.0: fixed bare relative links in versioned docs
  • Link fixes in main docs: same bug class in vcluster/
  • CI linter (.github/workflows/validate-mdx-links.yml): runs scanner on PRs, exits non-zero on any new bare relative link

Not fixed in this PR (pre-existing issues that require separate work):

  • Fragment/partial links (17): Docusaurus resolves .mdx links from the fragment file location, not the embedding page — adding .mdx breaks the build
  • Self-assessment links (10): target files have numbered prefixes (1-control-plane-components.mdx) but links reference bare names
  • CLI links (2): target files are auto-generated at build time, no source .mdx exists
  • quick-start link (1): target directory was removed

Preview Link

Internal Reference

Closes DEVOPS-775

AI review: mention @claude in a comment to request a review or changes. See CONTRIBUTING.md for available commands.

FORK LIMITATION: @claude does not work on pull requests opened from forks. GitHub Actions cannot access the required secrets for fork-originated PRs. To use AI review, push your branch directly to this repository.

@netlify /docs

…e links

detects relative markdown links without .mdx/.md suffix that break on
SPA navigation due to Docusaurus SSR-vs-CSR URL resolution mismatch.
same bug class as DOC-1311.

Closes DEVOPS-775
… SPA click

docusaurus only resolves relative markdown links at build time when
they end in .mdx/.md. without the suffix, the raw string survives
into the compiled bundle and the browser resolves it against
window.location at click time — producing 404s on SPA navigation.

fixes all LIVE-BROKEN links and coincidental-match links found by
the scanner in version-0.33.0 versioned docs. also fixes directory
targets by appending README.mdx where appropriate.
same bug class as the v0.33.0 fix — bare relative links without .mdx
suffix break on SPA click due to docusaurus SSR-vs-CSR URL resolution
mismatch. mechanical fix: append .mdx to leaf files, README.mdx to
directory targets.
… partials

fragments are embedded via import into parent pages, so their relative
links resolve from the embedding page's directory. same bug class —
without .mdx suffix, docusaurus skips build-time resolution and browser
click-time resolution diverges from file-path resolution.

reviewed all 7 fragment files across both main and v0.33.0 — all 17
links confirmed broken from their embedding contexts.
without a CI gate, bare relative links regress faster than they land —
AI-assisted doc authoring inconsistently applies .mdx suffix (PR #1889
got it right on 3 links and wrong on 9 in the same file). this workflow
runs the scanner on PRs touching .mdx files and exits non-zero on any
bare relative link missing the suffix.
@Piotr1215 Piotr1215 requested a review from a team as a code owner April 16, 2026 06:57
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 16, 2026

Deploy Preview for vcluster-docs-site ready!

Name Link
🔨 Latest commit 3c266a9
🔍 Latest deploy log https://app.netlify.com/projects/vcluster-docs-site/deploys/69e1ef465079880008f4e31e
😎 Deploy Preview https://deploy-preview-1946--vcluster-docs-site.netlify.app/docs
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread vcluster/deploy/control-plane/binary/manage.mdx Outdated
Comment thread vcluster_versioned_docs/version-0.33.0/deploy/control-plane/binary/manage.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

three categories of links can't take .mdx suffix:
- fragment/partial links: docusaurus resolves from the fragment's own
  directory, not the embedding page, so .mdx suffix causes file-not-found
- auto-generated targets: cli/ pages don't exist as source files
- numbered-prefix files: self-assessment links to 1-control-plane-components
  but the link says control-plane-components (filename mismatch, pre-existing)

these are left bare (no .mdx) to avoid regressing the build. they were
already broken on SPA click before this PR — the scanner still flags them.
CLAUDE.md was modified by a linter, platform/monitoring.mdx was an
artifact from a build comparison, settings.local.json is local-only.
none belong in this PR.
some bare relative links cannot take .mdx suffix without breaking the
docusaurus build: auto-generated CLI pages (no source file), numbered
filename prefixes (1-control-plane-components vs control-plane-components),
and removed directories (quick-start). the scanner now skips these
known exceptions so CI passes while still catching new regressions.
@Piotr1215 Piotr1215 requested a review from djwfyi April 16, 2026 07:37
Copy link
Copy Markdown
Collaborator

@djwfyi djwfyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Only lingering question is how do we remember to update this when we release the next version and need to be checking more than just 0.33 docs?

Comment thread .github/workflows/validate-mdx-links.yml Outdated
vale Loft.exclude-please flagged line 99. While editing, also fixed
"follow this processes" grammar and added the missing period.

Applied to main and v0.33.0 copies.
djwfyi asked how this workflow would handle v0.34.0 without manual
edits. The answer: don't hardcode the version. Each release cut
snapshots vcluster/ (already enforced) into a new version-X.Y.Z
folder, so discovering the highest-numbered folder at runtime picks
up new versions automatically.

Pre-existing broken links in older versions (0.28-0.32) are out of
scope for this gate — scanning them would fail CI on unrelated PRs.
@Piotr1215 Piotr1215 merged commit f06beba into main Apr 17, 2026
15 checks passed
@Piotr1215 Piotr1215 deleted the devops-775/fix-bare-relative-links branch April 17, 2026 08:43
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.

2 participants