Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

docs: publish redirects to commit-check.com ahead of archiving - #14

Merged
shenxianpeng merged 3 commits into
mainfrom
claude/refresh-sample-output-602anc
Aug 4, 2026
Merged

docs: publish redirects to commit-check.com ahead of archiving#14
shenxianpeng merged 3 commits into
mainfrom
claude/refresh-sample-output-602anc

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Aug 4, 2026

Copy link
Copy Markdown
Member

Step 1 of retiring this repository. Merge and verify this before flipping the archive switch — see below for why the order is not interchangeable.

The problem with archiving first

Archiving makes a repository read-only and stops its Actions, but it does not unpublish its GitHub Pages site. Whatever was deployed last keeps being served indefinitely.

So archiving as the first step would leave a complete copy of the old site live at commit-check.github.io forever — competing with commit-check.com in search results, and serving pre-v2.13.0 content including rule names the tool no longer prints (subject_imperative rather than subject-imperative). And because Actions do not run on an archived repository, there would be no way to fix it without unarchiving.

Hence: redirects first, archive second.

What this does

Replaces the mkdocs build with scripts/build_redirects.py, which emits one redirect stub per URL the old site served.

The map was taken from that site's own build output, not from reading the config. All but one entry is the same path — the pages, the blog and its archive, author and category indexes carried over unchanged, and the posts kept their filenames and created dates, so the generated slugs match byte for byte:

Old URL Redirects to
/ commit-check.com/
/getting-started/ commit-check.com/getting-started/
/blog/, /blog/archive/2026/, /blog/author/team/, /blog/category/{announcements,updates}/ same paths
the four blog posts same paths
/projects/ commit-check.com/ — folded into the Ecosystem section of the new landing page

GitHub Pages has no server-side redirect table, so each stub is a rel=canonical plus a <meta refresh>. The canonical is what transfers search ranking; the script carries location.hash across so deep links keep their place, and uses location.replace so the stub does not trap a reader in the back button. A 404.html catches anything the map missed.

The guard

tests/redirects_test.py builds the old mkdocs site and compares its URLs against the map in both directions:

  • a URL the site serves with no redirect → a link that breaks permanently
  • a redirect for a URL the site never served → the map was hand-edited and drifted

CI runs it before the deploy step. Verified by deleting one entry: the test names the missing URL and fails.

This matters more than a usual test because the deploy is one-shot. After archiving, the artifact from the last successful run is what Pages serves for good.

What is kept

docs/ stays exactly as it is — this repository remains the historical source of the old site, it just no longer publishes it. mkdocs is still a CI dependency because the guard needs it to build the site it is checking against.

The README now leads with the migration notice and points at commit-check/commit-check.com. Worth noting the README cannot be edited after archiving, which is why the notice ships in this PR rather than later.

After merging

  1. Confirm the Pages deploy succeeded and spot-check a couple of URLs (/projects/ and one blog post are the interesting ones).
  2. Then archive the repository in Settings → General → Danger Zone.

Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Added static redirect pages for legacy site URLs, including project links.
    • Redirects preserve URL paths and fragments while sending visitors to the new site.
    • Added a fallback page for unmatched URLs.
  • Documentation
    • Updated the README to explain the archived site, redirect behavior, URL mappings, and the new destination.
  • Bug Fixes
    • Added validation to identify missing redirects and invalid redirect destinations.

The site moved to commit-check.com, but this domain still serves a full copy of
the old one. Archiving alone would not change that: it makes the repository
read-only and stops Actions, and does not unpublish Pages — whatever was
deployed last keeps being served. Archiving as the first step would freeze a
duplicate of the pre-v2.13.0 documentation online permanently, competing with
the real site and showing rule names the tool no longer prints.

So the redirects go up first, and the archive switch is flipped afterwards.
There is no second chance: Actions do not run on an archived repository.

Replaces the mkdocs build with scripts/build_redirects.py, which emits one stub
per URL the old site served. The map came from that site's own build output
rather than from reading the config, and all but one entry is the same path —
the pages, the blog and its archive, author and category indexes carried over
unchanged, and the posts kept their filenames and created dates, so the slugs
match exactly. /projects/ is the exception, folded into the Ecosystem section
of the new landing page.

GitHub Pages has no redirect table, so each stub is a rel=canonical plus a meta
refresh, and the script carries the fragment across so deep links keep their
place. A 404.html catches anything the map missed.

tests/ checks the map against a real mkdocs build in both directions, and CI
runs it before the deploy: a URL served with no redirect is a link that breaks
for good, and a redirect for a URL that was never served means the map drifted.
The docs/ directory stays as the historical source.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn
@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for commit-check-github-io ready!

Name Link
🔨 Latest commit 6e891ff
🔍 Latest deploy log https://app.netlify.com/projects/commit-check-github-io/deploys/6a71d8e7ec4a6b000806c51f
😎 Deploy Preview https://deploy-preview-14--commit-check-github-io.netlify.app
📱 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.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@shenxianpeng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9df82de3-f4c0-4e60-b7f0-9b48e830c46b

📥 Commits

Reviewing files that changed from the base of the PR and between 4291bc7 and 6e891ff.

📒 Files selected for processing (4)
  • README.md
  • netlify.toml
  • scripts/build_redirects.py
  • tests/redirects_test.py
📝 Walkthrough

Walkthrough

The repository now generates static redirect stubs, validates redirect coverage against the MkDocs site, deploys the generated redirects through GitHub Actions, and documents the repository’s archived status and redirect mappings.

Changes

Redirect deployment

Layer / File(s) Summary
Redirect generation and validation
scripts/build_redirects.py, tests/redirects_test.py
The generator creates redirect stubs, a fallback 404.html, and .nojekyll. Tests compare published MkDocs URLs with REDIRECTS in both directions.
Redirect deployment workflow
.github/workflows/deploy.yml
The workflow installs dependencies, runs redirect tests, generates the redirect site, and uploads the redirect artifact.
Archive and redirect documentation
README.md
The README documents the new site, legacy URL mappings, redirect behavior, implementation details, and deployment order.

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

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant RedirectTests
  participant MkDocs
  participant BuildRedirects
  participant GitHubPages
  GitHubActions->>RedirectTests: run redirect coverage tests
  RedirectTests->>MkDocs: build site and collect URLs
  RedirectTests->>RedirectTests: compare URLs with REDIRECTS
  GitHubActions->>BuildRedirects: generate redirect stubs
  BuildRedirects-->>GitHubActions: return site artifact
  GitHubActions->>GitHubPages: deploy redirect artifact
Loading
🚥 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 clearly summarizes publishing redirects to commit-check.com before repository archiving.
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 claude/refresh-sample-output-602anc

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.

The PR that switched the GitHub Pages deploy to redirects missed that this
repository is built by a Netlify project as well. That project has no config
in the repository, so its build command lives in Netlify's web UI, where a
change to .github/workflows/deploy.yml cannot reach it — it would have gone on
building and publishing the old mkdocs site regardless.

Two consequences, one of them visible right now: the deploy preview on this
pull request is the old site, which makes the redirects look broken to anyone
who clicks it, and any production deployment of that project is a third live
copy of the old site that neither the Pages redirects nor archiving would
touch.

Adds a netlify.toml so the build is defined in version control. It runs the
same redirect builder, and declares real 301s — Netlify can serve those, unlike
Pages — with the /projects/ rule ahead of the catch-all, since Netlify takes
the first match and that is the one page that did not survive as its own URL.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn

@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 `@scripts/build_redirects.py`:
- Around line 64-67: Remove the robots meta directive containing “noindex” from
the redirect HTML TEMPLATE, while preserving the canonical link, meta refresh,
and JavaScript location.replace redirect behavior.

In `@tests/redirects_test.py`:
- Around line 38-39: Update the MkDocs build failure handling in the redirect
deployment test to fail the test instead of calling pytest.skip when
result.returncode is nonzero. Preserve the existing stderr details in the
failure message so the deployment gate blocks when the legacy-site build cannot
complete.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2933a817-203b-4c97-8004-dff1bc6d4c68

📥 Commits

Reviewing files that changed from the base of the PR and between b405bde and 4291bc7.

📒 Files selected for processing (4)
  • .github/workflows/deploy.yml
  • README.md
  • scripts/build_redirects.py
  • tests/redirects_test.py

Comment thread scripts/build_redirects.py
Comment thread tests/redirects_test.py Outdated
…nical

Both from CodeRabbit's review, both real.

The coverage check called pytest.skip when the mkdocs build failed. A skip
exits pytest 0, so the workflow would have read it as a pass and deployed
redirects that had never been compared against the site they replace — on the
one deploy that cannot be redone afterwards. The skip bought a quieter local
run without mkdocs installed and paid for it with the entire point of the
check. It fails now; verified by moving mkdocs.yml aside, which turns both
tests red instead of green.

The stubs also carried robots: noindex, which contradicts the rel=canonical
sitting two lines above it — one asks a crawler to consolidate the page onto
the new URL, the other asks it to drop the page, and the second can stop the
first from being acted on or carry across to the target. The comment in this
file claimed the canonical was what moved search ranking while the markup was
undermining it. Removed, with a note on why it is not an oversight.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U9zFxq8V4qxG4aMzJhGBFn

Copy link
Copy Markdown
Member Author

Both review findings accepted and fixed in 6e891ff.

pytest.skippytest.fail — correct and the more serious of the two. A skip exits pytest 0, so the workflow would have treated a failed mkdocs build as a passing gate and deployed redirects that were never compared against the site they replace. On a one-shot deploy that cannot be redone after archiving, that is the worst possible failure mode. Verified by moving mkdocs.yml aside: both tests now go red where they previously went green.

robots: noindex removed — also right, and it contradicted this file's own comment. The comment said the canonical was what transfers search ranking; the markup two lines below then asked crawlers to drop the page, which can stop the canonical being acted on or carry the noindex across to the target. Added a note explaining why its absence is deliberate, so it does not get "tidied" back in.

One thing this review did not cover: the rate limit hit before netlify.toml could be looked at (commit 5157c71). It exists because this repository is also built by a Netlify project whose build command lives in Netlify's web UI, out of reach of the workflow — without it, Netlify would have gone on publishing the old mkdocs site after Pages had switched to redirects.


Generated by Claude Code

@shenxianpeng shenxianpeng added the documentation Improvements or additions to documentation label Aug 4, 2026
@shenxianpeng
shenxianpeng merged commit 056c83c into main Aug 4, 2026
7 checks passed
@shenxianpeng
shenxianpeng deleted the claude/refresh-sample-output-602anc branch August 4, 2026 12:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants