Skip to content

ci: 加宿主版本兼容腿,把 peer 声明的 0.1.x 两段真跑一遍 - #348

Open
modusensus wants to merge 1 commit into
mainfrom
ci/host-matrix
Open

modusensus wants to merge 1 commit into
mainfrom
ci/host-matrix

Conversation

@modusensus

@modusensus modusensus commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

问题

peerDependencies 声明覆盖三段宿主版本:

>=0.1.0-rc.6 <0.2.0 || >=0.1.5-rc.0 <0.3.0 || >=0.2.0-rc.0 <0.3.0

但 CI 只用 lockfile 里那一版(当前 0.2 线)。也就是说 0.1.x 那两段一直是「声明支持却没人验证」——这正是 #344 的由头,只不过 #344 修的是开发依赖那一侧,peer 里的 0.1.x 分支还悬着。

改动

新增 test-host-legacy 作业,把 0.1.x 的两段各真跑一遍全量测试:

矩阵值 代表性
0.1.0-rc.8 #344 之前本仓库实际开发/测试的那一版(peer 的 0.1.0 段)
0.1.7-rc.2 0.1 线最新(老桌面端 2.0.14 内置的 0.1.7-rc.1 属同一段)

关键设计决定:为什么另开作业,而不是给 test 加一个 matrix 维度

test 的四个作业名(test (ubuntu-latest, 22) 等)是分支保护的 required status checks。给 matrix 加一个维度,作业名会变成 test (ubuntu-latest, 22, 0.1.0-rc.8)——原名消失,所有 PR 立刻被卡住无法合并。

所以新作业完全另起名字,一个必需检查都不碰。这条腿目前不阻断合并;想让它阻断,去 Settings → Branches 把 test-host-legacy (*) 加进 required 即可(一个点击,不需要改代码)。

其它实现要点

  • 必须删掉 lockfile 重新解析:带着 0.2 的锁降级会被 peer 链拦死(dsh-tools 的 peer 要求同版本的 dsh-agent,而锁里是 0.2.x)。因此这条腿的树是全新解析的——它只回答宿主 API 面是否兼容,不回答依赖版本一致性(那由 test 腿的 npm ci 负责)。
  • 解析与安装分两步(先 --package-lock-only 再 npm ci):解析失败与下载失败能区分开,且安装结果严格等于解析出的锁。
  • 新增断言步骤:目标版本没真正装上就响亮失败,避免出现「其实测的是别的版本」的假绿。
  • 全新解析会把运行时闭包也换成当前最新,而 runtime-manifest.json 由 lockfile 生成 → 先重建清单再跑测试,否则那条清单一致性用例必红,且与本腿要问的问题无关。
  • 只跑 ubuntu + node 24 单分片:这条腿问的是宿主 API 面,与 OS / Node 无关。
  • 顺带同步 AGENTS.md 闸门清单里对 CI 矩阵的描述。

验证

项 证据
0.1.0-rc.8 全量测试 本地实测全绿:1441 项 / 1440 通过 / 0 失败 / 1 跳过
0.1.7-rc.2 依赖解析 本地实测成功:整棵树解析为单一版本 0.1.7-rc.2
0.1.7-rc.2 安装 + 全量测试 本地安装阶段反复被本机网络的 ECONNRESET 打断(非兼容性问题),交由本 PR 的 CI 实跑验证
断言守卫 变异双向验证:期望值正确 → exit 0;期望值错误 → exit 1 并逐个报出实际版本
YAML pyyaml 解析通过,作业结构如预期

这条腿的耗时比 test 单分片长(要重新解析整棵依赖树,本地实测解析约 3–4 分钟),换来的是 peer 声明不再只是纸面承诺。

Summary by CodeRabbit

  • 测试
    • CI 新增宿主兼容性测试,覆盖两个 0.1.x 版本段,并在测试前验证宿主依赖版本。
  • 文档
    • 更新检查清单,说明自动化测试包含宿主兼容性验证。

peerDependencies 声明覆盖三段(0.1.0-rc.6+ / 0.1.5-rc.0+ / 0.2.0-rc.0+),但 CI
只用 lockfile 里那一版(当前 0.2 线)——「声明支持却从没人验证」正是 #344 的由来。
新增 test-host-legacy,把 0.1.0-rc.8 与 0.1.7-rc.2 各跑一遍全量测试。

为什么另开作业、而不是给 test 加一个 matrix 维度:test 的四个作业名
(test (os, node))是分支保护的 required status checks,加维度会让名字变成
test (os, node, host)、原名消失 → 所有 PR 立刻卡死无法合并。另开作业完全不碰那
四个必需检查;若要让这条腿也阻断合并,去 Settings → Branches 把
test-host-legacy (*) 加进 required 即可。

实现要点:
- 换掉四个宿主 devDeps 后必须删掉 lockfile 重新解析:带着 0.2 的锁降级会被 peer
  链拦死(dsh-tools 的 peer 要求同版本的 dsh-agent,而锁里是 0.2.x)。因此这条腿
  的树是全新解析的,它只回答宿主 API 面是否兼容;依赖版本一致性仍由 test 腿的
  npm ci 负责。
- 解析与安装分成两步(先 --package-lock-only 再 npm ci):解析失败与下载失败能
  区分开,且安装结果严格等于解析出的锁。
- 新增断言步骤:目标版本没真正装上就响亮失败,避免出现「其实测的是别的版本」的
  假绿。
- 全新解析会把运行时闭包也换成当前最新,而 runtime-manifest.json 由 lockfile
  生成 → 先重建清单再跑测试,否则那条「清单与 lockfile 一致」的用例必红,且与
  本腿要问的问题无关。
- 只跑 ubuntu + node 24 单分片:这条腿问的是宿主 API 面,与 OS / Node 无关(那些
  由 test 腿的四个分片覆盖),单分片足够且最省。
- 顺带同步 AGENTS.md 闸门清单里对 CI 矩阵的描述。
Copilot AI lite review requested due to automatic review settings September 30, 2026 12:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: slow-stack/mneme/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d5de280b-355a-489f-81e7-8fd9f47a79f6

📥 Commits

Reviewing files that changed from the base of the PR and between f7b7df7 and 27ee9ff.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • AGENTS.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

CI 新增 test-host-legacy 作业,分别测试两个 0.1.x 宿主版本。该作业固定宿主开发依赖版本、验证安装结果、重建 runtime manifest 并运行完整测试。门禁清单同步补充此测试任务的说明。

Changes

宿主兼容性测试

Layer / File(s) Summary
旧版宿主 CI 测试
.github/workflows/ci.yml, AGENTS.md
CI 新增两个宿主版本的测试分片。每个分片固定四个宿主开发依赖的目标版本,重新解析并安装依赖,检查实际版本,重建 runtime manifest 并运行完整测试。CI 注释和门禁清单说明同步更新。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to 27ee9

此次变更新增旧版宿主兼容性测试,不改变现有必需检查或运行时行为。未发现需要阻止合并的具体问题;正常 CI 检查通过后可合并。

Security Architecture Review

Security architecture risk: 🔵 Low · up to 27ee9

The compatibility tests run separately from the existing checks and introduce no new repository permissions or secret references. Fresh dependency resolution adds limited supply-chain exposure within CI, but generated files remain isolated from production and other test jobs.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Compromised freshly resolved dependencies could execute within a legacy CI runner. The demonstrated authority is the CI workspace and read-only repository access; the added job provides no production deployment or secret-bearing downstream step.

Trust Boundaries and Controls

  • observed — The selected host version comes from two fixed workflow matrix values. Registry dependency resolution remains an external trust boundary; npm ci and direct installed-version assertions constrain tree installation and compatibility targeting, but do not establish that dependency code is trustworthy.

Resilience and Maintainability Implications

  • inferred — Concurrent shards and reruns receive separate hosted-runner checkouts. Partial failure or interruption can leave synthetic files locally, but no workflow step publishes them or transfers them into the locked lane. The configured npm download cache is distinct from workspace state; concurrent cache behavior was not empirically observed.
🚥 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 标题准确概括了主要变更:新增 CI 宿主版本兼容测试,并验证 peer 声明支持的两个 0.1.x 版本段。标题具体、清晰,且与变更内容一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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 unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants