Skip to content

Fix Markdown page actions on untranslated locale pages - #1990

Merged
David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/fix-fallback-page-markdown-actions
Nov 1, 2026
Merged

David Pine (IEvangelist) merged 1 commit into
mainfrom
aspireagent/fix-fallback-page-markdown-actions

Conversation

@davidfowl

Copy link
Copy Markdown
Contributor

Summary

On untranslated (fallback) locale pages, the Copy Markdown and View as Markdown page actions are broken. These pages show the English content, but starlight-page-actions builds the Markdown URL from the localized pathname (/de/fundamentals/telemetry.md). Only real source files are copied as .md, so that URL returns 404. Copy Markdown shows its error state, and View as Markdown opens a 404 page. Most locales only translate index.mdx, so this affects thousands of pages.

Live evidence (curl, aspire.dev):

  • /de/fundamentals/telemetry.md → 404, /de/get-started/install-cli.md → 404, /fr/get-started/install-cli.md → 404
  • /fundamentals/telemetry.md → 200, /ja/fundamentals/telemetry.md → 200 (this page is translated)

Root cause: PageActions.astro uses Astro.url.pathname for the copy data-path, the TOC data-path and the view href, without checking starlightRoute.isFallback.

Fix (in the existing patches/[email protected]): when isFallback is true, strip the /<locale> prefix so the actions point to the default-locale Markdown for the content that is actually shown. Translated pages are unchanged.

Third-party links and affiliations

None

Validation

  • New E2E regression test in api-markdown-routes.spec.ts. It checks /de/ (fallback) and /ja/ (translated) telemetry pages: the action paths and hrefs, that the .md file returns 200 text/markdown, and that clicking Copy Markdown puts the expected heading on the clipboard.
    • Before the fix it failed on desktop and mobile Chromium (expected /fundamentals/telemetry, received /de/fundamentals/telemetry).
    • After the fix it passed on desktop, tablet and mobile Chromium (3/3).
  • Related Markdown E2E tests (api-markdown-routes, mobile-ux Markdown copying), desktop and mobile: 28 passed, 2 skipped (skips declared in the spec).
  • Checked that bun 1.4.3 applies the regenerated patch to the published 0.7.0 package and produces the intended files.
  • vitest: 82 files, 1108 passed, 1 skipped. Lint (astro sync, skill digest check, eslint --max-warnings 0): clean. Prettier on the spec: clean.
  • No visual change, so there are no screenshots.

🤖 Posted by AspireAgent (AI Agent)

…Markdown

Fallback (untranslated) locale pages render the default-locale content, but the
starlight-page-actions Copy Markdown and View as Markdown actions used the
localized pathname, so they requested /<locale>/<slug>.md files that are never
emitted and returned 404.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #1990. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #1990 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review October 30, 2026 08:11
Copilot AI balanced review requested due to automatic review settings October 30, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the fallback-locale Markdown action changes.

No open issues 🎉

What changed in this PR

Fixes Copy Markdown and View as Markdown on untranslated locale pages by pointing them to the default-locale Markdown that matches the displayed content. Translated pages retain their localized Markdown URLs.

Changes:

  • Updates the page-actions patch to remove the locale prefix for fallback pages.
  • Adds regression coverage for fallback and translated pages, including action URLs, Markdown responses, and copied content.
  • Documents the expanded patch behavior.
File Description
src/​frontend/​tests/​e2e/​api-markdown-routes.spec.ts Tests Markdown actions on German fallback and Japanese translated pages.
src/​frontend/​patches/​[email protected] Corrects fallback Markdown paths for copy buttons and view links.
src/​frontend/​patches/​README.md Records the patch’s fallback-locale handling.

Review effort: Balanced

@IEvangelist

Copy link
Copy Markdown
Member

David Fowler (@davidfowl), can we get a PR into the starlight-page-actions repo for these changes so that we can eventually not rely on the patch, but rather the official release again?

@IEvangelist

Copy link
Copy Markdown
Member

Documentation applicability review

Reviewed all three changed files at 1fa7198abc64ac2a4a9c0de9b143fc55bd687605 (base: main) using the docs-PR-reviewer workflow.

Phase A - Claim verification: not applicable. There are no changed Aspire API, CLI, configuration, integration, or version-guidance claims to verify against microsoft/aspire, CommunityToolkit/Aspire, or Azure/azure-sdk-for-net. Applicable claims: 0; verified / nuanced / unverifiable / contradicted: 0 / 0 / 0 / 0. No external source repository was needed. The single maintenance README edit describes the dependency patch; its behavior belongs to the code review, not Aspire product-claim verification.

Phase B - Blind documentation testing: not applicable. No documentation page, tutorial, or example content changed, so there are no affected documentation sections to exercise as a new Aspire user. No doc-tester or unrelated documentation routes were run; this is an applicability result, not a claim that browser tests passed. The localized page-action behavior and new regression test are assessed separately in the code stage.

Phase C - Result: documentation applicability assessment complete; no documentation-accuracy findings. This conversation comment is not an approval or change-request verdict.

@IEvangelist

Copy link
Copy Markdown
Member

Project code review

Reviewed 1fa7198abc64ac2a4a9c0de9b143fc55bd687605 against main using .agents/skills/code-review/SKILL.md, after the documentation applicability stage.

No actionable high-confidence findings. The change looks correct and adequately covered for this site's configuration (root default locale, no deployment base path). I applied the complete PR patch to the published [email protected] package and reviewed the resulting component, its button/TOC consumers, the package's Markdown-copy generation, Starlight 0.41.3 fallback-route construction, and the site's component integration. Starlight supplies the requested locale alongside the default-language entry on fallback routes, so stripping exactly that prefix selects the Markdown corresponding to the displayed content. Both copy-button variants and the shared View Markdown option use the corrected path; translated and default-language pages retain their paths. Share/AI URLs and existing event-listener cleanup are unchanged.

Test coverage and verification

  • Local focused checks: git apply --check against the published package passed; applying the patch produced the expected runtime component. A dependency-free Node assertion harness evaluated the exact patched expression: 86 cases passed, covering fallback and translated paths across all 14 non-root configured locales, default-language behavior, nested/index-style paths, and a nonmatching locale-prefix guard. It also checked all three Markdown-path consumers. This is a focused logic/wiring check, not an Astro rendering or browser test.
  • E2E: the added test checks fallback German and translated Japanese action paths, View Markdown links, successful Markdown responses, and the actual copy handler's captured clipboard text. I inspected the merged Playwright artifact from CI run 41021501676, whose head SHA matches this review: the new test passed on desktop, tablet, and mobile Chromium, all with retry 0. Existing mobile-ux.spec.ts additionally covers repeated client navigation and failed Markdown fetches. Browser tests were not rerun locally; Bun is unavailable in this environment.
  • Unit/accessibility: no new committed unit test or targeted axe test is added. The new E2E regression covers the changed user-visible URL behavior; this patch does not change markup, focus handling, styling, or accessible names, so no additional accessibility-specific coverage is required for this delta. The existing WCAG suite remains unchanged.

No local production build was run. No PR files were changed, and this conversation comment is not an approval or change-request verdict.

David Pine (IEvangelist) pushed a commit that referenced this pull request Nov 1, 2026
## Summary

Fixes seven broken internal links in the English docs. Every locale
falls back to these pages, so each broken link appears on all 15
locales. The links validator didn't flag them because it never inspects
these two kinds of link:

- `starlight-links-validator` runs with `errorOnRelativeLinks: false`,
so it skips `./` and `../` links entirely.
- It only reads string `href` attributes. It can't see hrefs passed
through JSX expression props such as `cta={{ href: '…' }}` or
`capabilities={[{ href: '…' }]}`.

| Page | Link | Before | After |
|---|---|---|---|
| `/dashboard/` (2 `ImageShowcase` CTAs + 3 `CapabilityGrid` cards) |
Tracing / Structured logs / Metrics | `/dashboard/explore/#traces`,
`#structured-logs`, `#metrics`. These ids don't exist, so the link lands
at the top of a long page | `#traces-page`, `#structured-logs-page`,
`#metrics-page`, the same anchors that `dashboard/standalone.mdx` and
`data/dev-hub.ts` already use |
| `/reference/cli/commands/aspire-dashboard-run/` | Dashboard
configuration | `../../../dashboard/configuration/` →
`/reference/dashboard/configuration/` (**404**) |
`/dashboard/configuration/` |
| `/integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host/`
| Redis Hosting integration |
`../../../caching/redis/redis-host/#…-redis-insights` →
`/integrations/cloud/caching/redis/redis-host/` (**404**), and the
anchor was misspelled |
`/integrations/caching/redis/redis-host/#add-redis-resource-with-redis-insight`
|

The fixed links are absolute, so `starlight-links-validator` now checks
the two Markdown ones at build time. A new unit test,
`tests/unit/docs-internal-links.vitest.test.ts`, covers the gap for the
English docs. It resolves expression-prop `href:` values and `./`/`../`
Markdown links to an existing docs page and, when there's a fragment, to
an existing heading id. It follows the existing pattern in
`dev-glossary.vitest.test.ts` and slugs headings with `github-slugger`,
as Starlight does. Like the validator config, it skips `/reference/api/`
and `/hub/`.

### How this was found

I crawled main's CI `frontend-dist` artifact, the production build of
`29550055` from [run
41062457941](https://github.com/microsoft/aspire.dev/actions/runs/41062457941),
covering all 8,327 non-API HTML pages. I checked every internal `<a
href>` against the built files and ids. Before this change the live site
behaves as follows:

- `https://aspire.dev/reference/dashboard/configuration/` returns 404.
- `https://aspire.dev/integrations/cloud/caching/redis/redis-host/`
returns 404.
- `https://aspire.dev/dashboard/explore/` only has `id="traces-page"`,
`id="structured-logs-page"` and `id="metrics-page"`.

The crawl also found broken links that this PR leaves alone:

- Localized `.md` page-action links: covered by #1990.
- Localized glossary links: covered by #1989.
- Bare relative links in `whats-new/aspire-9-4.mdx` and
`aspire-9-5.mdx`: these files are being edited by open PRs #1933, #1896
and #1876.
- A typo in a synced sample README (`data/samples.json`): it comes from
the upstream samples repo.

## Third-party links and affiliations

None.

## Validation

- The regression test fails before the fix with exactly the 7 links
above, and passed in 3 of 3 runs after it. Before-fix output:
  ```
dashboard/index.mdx: /dashboard/explore/#traces points to a missing
heading #traces (×2)
dashboard/index.mdx: /dashboard/explore/#structured-logs points to a
missing heading #structured-logs (×2)
dashboard/index.mdx: /dashboard/explore/#metrics points to a missing
heading #metrics
integrations/cloud/azure/azure-cache-redis/azure-cache-redis-host.mdx:
../../../caching/redis/redis-host/#add-redis-resource-with-redis-insights
resolves to missing page /integrations/cloud/caching/redis/redis-host/
reference/cli/commands/aspire-dashboard-run.mdx:
../../../dashboard/configuration/ resolves to missing page
/reference/dashboard/configuration/
  ```
- On the 538 English docs the test reports nothing besides these 7, and
its findings match the built-output crawl for the link kinds it covers.
- `npx vitest run`: 84 files passed; 1,121 tests passed and 1 skipped.
- `npx eslint . --max-warnings 0` passes, and the new test file is
Prettier-formatted.
- Browser check with Playwright against `astro dev`, after the fix:
- `/dashboard/` renders the five `#*-page` hrefs, and each target id
exists on `/dashboard/explore/`.
  - The Dashboard configuration link returns 200.
- The Redis Hosting integration link returns 200, and its anchor exists.
- No visual change: only the link targets change, so the rendered pages
are pixel-identical and there are no screenshots.

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>

@IEvangelist David Pine (IEvangelist) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved following the completed Project docs applicability and clean code review at this unchanged head, approval recommendation, and passing CI. Approval and merge authorized by the user.

@IEvangelist
David Pine (IEvangelist) merged commit ad51f4e into main Nov 1, 2026
20 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the aspireagent/fix-fallback-page-markdown-actions branch November 1, 2026 20:34
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.

3 participants