Skip to content

fix(contracts): 契约文档链接与 schema $id 检查对齐 lithe-plugin-docs 同步规则 - #1643

Merged
xiaoyumuxi merged 1 commit into
previewfrom
fix/1581-contract-mirror-links
Nov 1, 2026
Merged

xiaoyumuxi merged 1 commit into
previewfrom
fix/1581-contract-mirror-links

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

#1581 合并后,在 lithe-plugin-docs 运行 node scripts/contract.mjs sync --revision ef6e70c3c… 被拒,报错是:

proposals/toolchains/README.md: link fixtures/ leaves the contract; upstream must use an absolute URL.

docs 的同步规则要求:契约目录里每个 Markdown 的相对链接都指向副本里的文件,每份 schema 的 $id 等于它的发布地址。主仓库的 verify-shared-contracts.sh 只检查顶层 README,而且允许链接指向目录,所以这个问题在合并前没被发现。本 PR 修掉这条链接,并把主仓库的检查收紧到和 docs 一致,以后同类问题在主仓库 CI 就会失败。

改动

  1. shared/contracts/plugins/v1/proposals/toolchains/README.md:文件表里 [fixtures/](fixtures/) 改成代码文本 `fixtures/`。raw 地址取不到目录,docs 不接受指向目录的链接。契约内容没有其他变化。
  2. scripts/architecture/verify-shared-contracts.sh:
    • 链接检查从只查 README.md,扩大到契约目录下的每个 .md(包括 toolchains.md、proposals/toolchains/*.md)。相对链接按所在文件的目录解析,必须指向目录内的文件;指向目录或目录外,都会失败。
    • 新增:目录下每个 *.schema.json 的 $id 必须等于 published_plugin_schema_base/<目录内路径>。原来只检查顶层三份,proposals/toolchains/ 的 5 份 schema 没有检查。三份顶层 schema 原有的检查保留不动。
  3. .agents/notes/implemented/architecture/2026-10-23-plugin-contract-publishing.md:把“两份 schema”“契约 README”更新为目录下全部 schema 和 Markdown;写明相对链接不能指向目录、两边规则必须一致,并记录这次同步被拒的原因。

功能矩阵

没有用户可见的变化:只改了一处契约文档链接和一个 CI 校验脚本。verify-platform-feature-matrix-change 会因为动了 shared/contracts 而要求更新矩阵,请 reviewer 确认后加 matrix-exempt。

验证(本地)

  • ./scripts/architecture/verify-shared-contracts.sh:通过。
  • 反向验证,每次都临时改坏一处,跑完恢复:
    • 把 fixtures/ 改回目录链接:检查失败,报 proposals/toolchains/README.md: link fixtures/ must be absolute or name a file inside shared/contracts/plugins/v1。
    • 把 proposals/toolchains/query.schema.json 的 $id 改成顶层地址:检查失败,报出期望的完整地址。
  • ./scripts/agent-notes/verify-agent-notes.sh:188 篇通过。
  • 用 lithe-plugin-docs 真实的 contract.mjs sync --checkout <本分支> 对本 PR 的提交做试同步:76 个文件同步成功;contract.mjs verify 和 node --test scripts/*.test.mjs(15/15)都通过。试同步的结果已经丢弃,不会提交。

合并后

在 lithe-plugin-docs 用本 PR 合并后的 preview commit 运行 sync,提交契约同步 PR。

- proposals/toolchains/README.md 文件表里指向 fixtures/ 目录的链接改为代码文本;lithe-plugin-docs 的 contract.mjs sync 要求相对链接指向副本里的文件,这条链接让 #1581 合并后的同步被拒
- verify-shared-contracts.sh 检查契约目录下每个 Markdown 文件(原来只查顶层 README),相对链接必须指向目录内的文件,不能指向目录
- verify-shared-contracts.sh 检查目录下每个 *.schema.json 的 $id 等于 docs 发布地址(原来只查三份顶层 schema)
- 更新契约发布 Agent Note,写明两边规则一致的要求和这次被拒的原因
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 1, 2026
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 1, 2026 15:41
@xiaoyumuxi xiaoyumuxi added the matrix-exempt Reviewed non-user-visible refactor; skips platform feature matrix update label Nov 1, 2026
@xiaoyumuxi
xiaoyumuxi merged commit 589116e into preview Nov 1, 2026
16 of 22 checks passed
@xiaoyumuxi
xiaoyumuxi deleted the fix/1581-contract-mirror-links branch November 9, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

matrix-exempt Reviewed non-user-visible refactor; skips platform feature matrix update review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant