docs(contributing): 按现状改写链接门禁分工,换掉三条死的"正确示例"路由 (#3570) - #3585
Merged
Conversation
Documentation 一节两处与仓库现状不符: 1. "Validating Links" 把周扫的外链检查说成了 PR 门禁,又完全略去真正的 门禁。改写为如实的分工:PR 门禁是 check-doc-links.mjs(docs-links.yml, pull_request → main/develop,离线读 checkout,无 paths 过滤所以纯文档 PR 也被检查),lychee(check-links.yml)只挂周 cron + workflow_dispatch, 从不上 PR —— #3213 的有意取舍。按机制描述、不枚举扫描面,免得 #3572 合并后又过期。 2. "✅ Correct Link Patterns" 里三条路由被 routeExists() 判死 (/docs/reference/api/core、/docs/reference/protocol/overview、 /docs/architecture/component),换成逐条验证过的真实路由。紧邻的 "❌ Incorrect" 块原先把"正确写法"注成同样不存在的路由,一并改正 —— 不改它,新的 ✅ 块会和它自相矛盾。那三条死路由现在改作反面例子: /reference/、/architecture/、/spec/ 这三个顶层段确实不存在。 这些示例落在 stripCode() 的结构性盲区里(围栏内代码在扫描前被抹成空格), 任何门禁都看不见,故加一句诚实提示要求改动时手工核对,不为它造新门禁。 Fixes #3570
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
yinlianghui
marked this pull request as ready for review
August 7, 2026 14:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3570
只动
CONTRIBUTING.md的 Documentation 一节。与同批在飞的 #3572(改scripts/check-doc-links.mjs)零文件相交。1.
Validating Links—— 门禁描述与现状对不上原文一句话把周扫的外链检查说成了 PR 门禁,又把真正的门禁完全略去。改写为如实的分工,每条都对着当前 workflow 文件核过:
632c07c5b)scripts/check-doc-links.mjs,由docs-links.yml跑.github/workflows/docs-links.yml:26-27(pull_request: branches: [main, develop])、:61-62(run: node scripts/check-doc-links.mjs)docs-links.yml:54-56头注释 "Reads the checkout and nothing else, so no install is required"paths过滤 → 纯文档 PR 也被检查docs-links.yml:18-19,并由scripts/__tests__/docs-links-workflow.test.ts钉住pull_request.github/workflows/check-links.yml:21-36(workflow_dispatch+schedule: '17 4 * * 0')、:38-48(两个触发器被注释掉并标 "⛔ Do NOT enable … #3213's ruling B still stands")pnpm docs:check-linkspackage.json:45一处与派单描述的偏差,已按实测写: 派单说 lychee 是
continue-on-error。它不是 ——check-links.yml全文没有continue-on-error,只有fail: true(:76-77)。所以我写的是「它确实会让自己那次定时运行变红,只是从不让你的 PR 变红」,而不是「continue-on-error」。这两种说法的门禁结论相同,但机制不同,照抄会成为下一个过期陈述。按派单要求按机制描述、不枚举扫描面:结尾一句把「哪些文件被扫」指回
SCAN_ROOTS表和check-links.yml的args,所以 #3572 把扫描面从 3 根扩到 6 根之后,这段散文不需要跟着改。2.
✅ Correct Link Patterns—— 三条死路由用检查器自己的
routeExists()+collectSiteRoutes()逐条验证(#3571 的探针法,离线只读):两个方向都验了:正例真的能解析,反例真的死 —— 否则「反面教材」会意外指向一个能用的路由。
顺带改了紧邻的
❌ Incorrect块(派单文件面之内,但比 PM 裁定多一处,故显式说明):它原先把/api/core的"正确写法"注成/docs/reference/api/core、把/spec/component注成/docs/architecture/component—— 教的是同样不存在的路由(issue 正文已点名)。不改它,新的 ✅ 块会和紧挨着的 ❌ 块自相矛盾。现在那三条死路由改作反面例子本身:/reference/、/architecture/、/spec/这三个顶层段确实不存在于content/docs/,正好是这次错误的历史来源。issue 问的「曾经存在还是从来虚构」:曾经存在。
git ls-tree ce779c7ea -- docs/reference docs/architecture列出docs/reference/api/core.md、docs/reference/protocol/overview.md、docs/architecture/component.md等 20 个文件 —— 是历次文档重构搬走的。但全仓已无第二处引用:grep -rn '/docs/reference/\|/docs/architecture/'(排除 node_modules)命中 6 行,全部在CONTRIBUTING.md本文件内,即本 PR 改掉的这 6 行。没有"别处还有同样引用"要跟进。3. 一句诚实提示,不造门禁
这些示例写在 markdown 代码围栏里,而
stripCode()在扫描前把围栏块和行内代码抹成空格(这是必需的,见该文件 "Code spans are stripped before scanning" 一节),所以即便 #3572 把 CONTRIBUTING.md 纳入SCAN_ROOTS,这些示例路由仍然没有任何门禁看得见。实测确认:对本文件跑stripCode()后只剩 15 条链接,示例块里的路由一条都不在其中。按 PM 裁定加了一句提示要求改动时手工核对,未为它造新门禁。
验证
SCAN_ROOTS在本 PR 基线上仍是 3 根(content/docs、examples、README.md)—— #3572 尚未合并,所以本文件此刻还不在扫描面内,上面的 exit 0 并不代表它被验过。为此额外做了前瞻模拟:在内存里往SCAN_ROOTS追加{ path: 'CONTRIBUTING.md', rule: 'disk' }再跑collectBrokenLinks(),结果 0 broken —— 即本 PR 不会给 #3572 埋雷。#3572 若先落地,重跑真实门禁即可。无 changeset(根目录文档,非
packages/用户可见变更)。未触碰content/docs/releases/。越界记录
同一节
CONTRIBUTING.md:414「All docs are indocs/」也已过期(站点源是content/docs/,见apps/site/source.config.ts:6;根docs/是 ADR/审计内部树)。不在本单文件面内(PM 裁定只授权那两处 + 一句提示),按 Prime Directive #10 未在本 PR 修,查重后另立 #3584(未认领,留给 PM 分诊)。