Skip to content

feat(link-resolver): update release links to point to stable URLs for… - #722

Open
shhdgit wants to merge 4 commits into
masterfrom
operator-url-rule
Open

feat(link-resolver): update release links to point to stable URLs for…#722
shhdgit wants to merge 4 commits into
masterfrom
operator-url-rule

Conversation

@shhdgit

@shhdgit shhdgit commented Jul 29, 2026

Copy link
Copy Markdown
Member

… tidb-in-kubernetes

Summary by CodeRabbit

  • Bug Fixes
    • TiDB Operator /releases/* links now resolve to TiDB-in-Kubernetes stable release notes (not development).
    • Stable resolution from TiDB-in-Kubernetes main release-note URLs is now correctly applied.
    • Release links without a leading slash continue to preserve URL hash fragments.
    • Non-release and unrelated TOC links keep the expected development routing.
  • Documentation
    • Updated published guidance for URL- and link-resolution rules, including stable/main behavior.
  • Tests
    • Expanded link- and URL-resolution coverage for stable/main and TOC-based release navigation.

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website-docs Error Error Jul 29, 2026 9:46am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

TiDB-in-Kubernetes release notes from main now resolve to stable URLs. Operator release links also target stable, with language, version, and hash-fragment behavior covered by tests. URL-mapping documentation reflects the new rules.

Changes

Release URL Mappings

Layer / File(s) Summary
Build-time release mapping
gatsby/url-resolver/config.ts, gatsby/url-resolver/__tests__/url-resolver.test.ts, gatsby/URL_MAPPING_ARCHITECTURE.md
Release notes under TiDB-in-Kubernetes main map to stable, while other main pages continue mapping to dev; tests and build-time documentation are updated.
Runtime operator release links
gatsby/link-resolver/config.ts, gatsby/link-resolver/__tests__/link-resolver.test.ts, gatsby/URL_MAPPING_ARCHITECTURE.md
Operator and TOC release links resolve to TiDB-in-Kubernetes stable pages, preserving language, version, and hash fragments.
TOC navigation validation
gatsby/__tests__/get-files-from-tocs.test.ts, gatsby/__tests__/toc.test.ts
TOC selection, stable release-link generation, and release-file extraction receive additional coverage.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TOC
  participant linkResolver
  participant PublishedURL
  TOC->>linkResolver: resolve release-note link
  linkResolver->>PublishedURL: map main or operator release to stable
  PublishedURL-->>TOC: return resolved URL with preserved context
Loading

Suggested reviewers: qiancai

Poem

A rabbit hops through branches bright,
From main to stable, paths take flight.
Operator links now land just right,
Hashes tucked safely, kept in sight.
The docs bloom fresh in morning light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: updating release links to resolve to stable URLs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch operator-url-rule

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gatsby/URL_MAPPING_ARCHITECTURE.md`:
- Line 405: Update the wildcard mapping examples in the architecture
documentation, including both occurrences of the release mapping, to use an
unambiguous literal form such as release-* → v* or inline code. Preserve the
mapping’s meaning and the surrounding documentation.

In `@gatsby/url-resolver/config.ts`:
- Around line 142-148: Update the TOC-filtered node processing in createDocs to
deduplicate entries by their resolved path before cpMarkdown and createPage run,
retaining the main release-note source over the stable source when both resolve
to the same path. Preserve the existing URL resolver behavior and add
resolver/build integration coverage for both main and stable inputs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 81e04eca-74ea-48ec-b22d-188a73ed8109

📥 Commits

Reviewing files that changed from the base of the PR and between 9c64020 and fe2117e.

📒 Files selected for processing (5)
  • gatsby/URL_MAPPING_ARCHITECTURE.md
  • gatsby/link-resolver/__tests__/link-resolver.test.ts
  • gatsby/link-resolver/config.ts
  • gatsby/url-resolver/__tests__/url-resolver.test.ts
  • gatsby/url-resolver/config.ts

Comment thread gatsby/URL_MAPPING_ARCHITECTURE.md Outdated
Comment on lines +142 to +148
// tidb-in-kubernetes release notes from main
// Release notes from main override the copies from the stable release branch.
// /en/tidb-in-kubernetes/main/releases/{filename} -> /en/tidb-in-kubernetes/stable/{filename}
{
sourcePattern: "/{lang}/tidb-in-kubernetes/main/releases/{filename}",
targetPattern: "/{lang}/tidb-in-kubernetes/stable/{filename}",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 4 'createPage|calculateFileUrl|filterNodesByToc' \
  gatsby/create-pages/create-docs.ts gatsby -g '*.ts'

rg -n -C 2 'tidb-in-kubernetes/(main|stable)/releases' \
  docs/markdown-pages gatsby

Repository: pingcap/website-docs

Length of output: 50376


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- config rule ---\n'
sed -n '120,180p' gatsby/url-resolver/config.ts

printf '\n--- calculateFileUrl implementation ---\n'
sed -n '136,220p' gatsby/url-resolver/url-resolver.ts
sed -n '300,330p' gatsby/url-resolver/url-resolver.ts

printf '\n--- createDocs creation path ---\n'
sed -n '50,165p' gatsby/create-pages/create-docs.ts

printf '\n--- toc filter relevant implementation ---\n'
sed -n '130,225p' gatsby/toc-filter.ts

printf '\n--- existing tidb-in-kubernetes main/stable release resolver tests ---\n'
sed -n '360,405p' gatsby/url-resolver/__tests__/url-resolver.test.ts

Repository: pingcap/website-docs

Length of output: 249


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- config rule ---'
sed -n '120,180p' gatsby/url-resolver/config.ts

echo
echo '--- calculateFileUrl implementation ---'
sed -n '136,220p' gatsby/url-resolver/url-resolver.ts
sed -n '300,330p' gatsby/url-resolver/url-resolver.ts

echo
echo '--- createDocs creation path ---'
sed -n '50,165p' gatsby/create-pages/create-docs.ts

echo
echo '--- toc filter relevant implementation ---'
sed -n '130,225p' gatsby/toc-filter.ts

echo
echo '--- existing tidb-in-kubernetes main/stable release resolver tests ---'
sed -n '360,405p' gatsby/url-resolver/__tests__/url-resolver.test.ts

Repository: pingcap/website-docs

Length of output: 13819


Prevent both main and stable release notes from creating the same page.

main/releases/{filename} maps to /stable/{filename} using the first matching rule, but createDocs still iterates all TOC-filtered nodes before cpMarkdown and createPage. If a stable release note exists for the same file, publishing order can override the intended main-source override. Deduplicate by resolved path, keep a preferred source (main > stable), and cover both sources in a resolver/build integration test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gatsby/url-resolver/config.ts` around lines 142 - 148, Update the
TOC-filtered node processing in createDocs to deduplicate entries by their
resolved path before cpMarkdown and createPage run, retaining the main
release-note source over the stable source when both resolve to the same path.
Preserve the existing URL resolver behavior and add resolver/build integration
coverage for both main and stable inputs.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gatsby/__tests__/get-files-from-tocs.test.ts`:
- Around line 116-131: Update the mocked nodes created in the getFilesFromTocs
test with mdxAST link children representing toc-only and operator-releases-only,
rather than relying on makeNode’s empty children. Preserve the existing TOC
paths and ensure the links expose the filenames that the assertion expects.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b39e0ec3-3671-42a0-834e-933307082ee0

📥 Commits

Reviewing files that changed from the base of the PR and between fe2117e and 25bafc3.

📒 Files selected for processing (6)
  • gatsby/URL_MAPPING_ARCHITECTURE.md
  • gatsby/__tests__/get-files-from-tocs.test.ts
  • gatsby/__tests__/toc.test.ts
  • gatsby/link-resolver/__tests__/link-resolver.test.ts
  • gatsby/link-resolver/config.ts
  • gatsby/url-resolver/__tests__/url-resolver.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • gatsby/link-resolver/config.ts
  • gatsby/url-resolver/tests/url-resolver.test.ts

Comment on lines +116 to +131
const graphql = jest.fn().mockResolvedValue({
data: {
allMdx: {
nodes: [
makeNode(
"en/tidb-in-kubernetes/main/TOC",
"docs/markdown-pages/en/tidb-in-kubernetes/main/TOC.md"
),
makeNode(
"en/tidb-in-kubernetes/main/TOC-tidb-operator-releases",
"docs/markdown-pages/en/tidb-in-kubernetes/main/TOC-tidb-operator-releases.md"
),
],
},
},
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Populate the mocked TOCs with link nodes.

At Lines [120-127], both nodes use makeNode, which supplies mdxAST: { children: [] } at Lines [28-34]. getFilesFromTocs therefore extracts no filenames, but the assertion expects toc-only and operator-releases-only; this test will fail before validating TOC selection.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gatsby/__tests__/get-files-from-tocs.test.ts` around lines 116 - 131, Update
the mocked nodes created in the getFilesFromTocs test with mdxAST link children
representing toc-only and operator-releases-only, rather than relying on
makeNode’s empty children. Preserve the existing TOC paths and ensure the links
expose the filenames that the assertion expects.

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