Skip to content

fix(redirects): redirect bare API paths and renamed API pages - #1017

Merged
ysyneu merged 1 commit into
mainfrom
fix/api-path-redirects
Oct 6, 2026
Merged

ysyneu merged 1 commit into
mainfrom
fix/api-path-redirects

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Problem

Requests to bare API operation paths on the docs domain return 404, for example:

  • /safari/mcp/server/update
  • /calendar/event/delete
  • /monit/datasource/delete

Each API reference page embeds its operation path as a root-relative string in the rendered page data ("path":"/safari/mcp/server/update"). Crawlers resolve that string against docs.flashduty.com and request it, but every page lives under /zh/ or /en/.

A second group of 404s are API pages whose slug was renamed while the operation stayed, e.g. /zh/api-reference/ai-sre/artifacts/artifact-gallery-read-get (now artifact-read-get).

Change

  • scripts/api_path_redirects.py derives one redirect per operation path from the zh API navigation in docs.json plus each operation's x-mint.href, and rewrites that block of redirects. Managed entries = source without a locale prefix and destination under /zh/api-reference/; hand-written redirects are untouched. --check exits 1 when the block is stale.
  • docs.json: 338 generated redirects (bare path -> zh reference page; zh is the default locale, / already goes to /zh/home), plus 14 redirects (7 per locale) for renamed API page slugs.
  • openapi-lint.yml runs api_path_redirects.py --check and now also triggers on docs.json, so spec or navigation changes that leave the redirects stale fail CI. After regenerating specs, run python3 scripts/api_path_redirects.py.

Endpoints retired from the API (old monitor rule/rule-set/service-map, environment, channel notify-rule endpoints, etc.) are intentionally left as 404: they have no replacement page.

Verification

  • python3 scripts/api_path_redirects.py --check -> exit 0; python3 scripts/lint_openapi.py -> no violations
  • mint validate -> build validation passed; mint broken-links -> no broken links found
  • All 338 redirect destinations and all 14 rename destinations return 200 on the current production site
  • mint dev: /safari/mcp/server/update, /calendar/event/delete, /monit/datasource/delete, /incident/comment-type/reorder, /enrichment/mapping/schema/info, /safari/artifact/gallery/file-state, /monit/prometheus/api/v1/label/{label_name}/values (raw and percent-encoded braces) and /en/api-reference/on-call/status-pages/statuspage-read-page-list redirect to the expected pages; /zh/api-reference/monitors/service-map/monit-servicemap-read-status stays 404

…erence pages

Each API reference page embeds its operation path (e.g.
/safari/mcp/server/update) as a root-relative string in the rendered page
data. Crawlers resolve it against the docs domain and request it, which
returns 404 because every page lives under /zh/ or /en/.

- Add scripts/api_path_redirects.py, which derives one redirect per
  operation path from the zh API navigation in docs.json and the
  x-mint.href of each operation, and rewrites that block of redirects.
  `--check` fails when the block is out of date; the OpenAPI lint
  workflow now runs it.
- Add the generated 338 redirects (bare path -> /zh/api-reference/...).
- Redirect 7 API pages per locale whose slugs were renamed while the
  operation stayed (artifact gallery, IM war room list, status page list)
  to their current slugs.

Endpoints that were retired from the API keep returning 404.
@ysyneu
ysyneu merged commit 04b3255 into main Oct 6, 2026
2 checks passed
@ysyneu
ysyneu deleted the fix/api-path-redirects branch October 6, 2026 02:11
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