Repository navigation
fix: 统一 GitHub API 版本来源并接入官方更新发现 - #309
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
The change has unresolved moderate and critical issues: it uses a nonexistent GitHub versions endpoint, hard-codes an API version in tests, and is incompatible with the controller revision pinned by release templates.
3 open issues
What changed in this PR
This PR centralizes GitHub REST API versioning in config/github-api.json, updates API consumers and health checks to use the shared source, and adds Renovate-based version discovery.
Changes:
- Updated Node.js, Python, PowerShell, Worker, and runner consumers to read the canonical API version.
- Added workflow-source configuration loading and validation for health checks.
- Added Renovate configuration and test coverage for API-version discovery and failure handling.
This pull request requires changes.
| File | Summary | Review status |
|---|---|---|
tools/template/delivery.py |
Template delivery now reads the shared API configuration. | No finding |
services/settings-events/src/index.mjs |
Settings Events Worker uses the shared API version. | No finding |
scripts/repository-bootstrap.mjs |
Repository bootstrap requests use the shared version. | No finding |
scripts/release-record.mjs |
Release record requests use the shared version. | No finding |
scripts/release-candidate.mjs |
Release candidate requests use the shared version. | No finding |
scripts/quality-language-summary.mjs |
Quality API requests use the shared version. | No finding |
scripts/governance-promotion.mjs |
Governance promotion requests use the shared version. | No finding |
scripts/ghcr-package-state.ps1 |
GHCR metadata requests read the shared configuration. | Critical — The release template still pins an older controller SHA without config/github-api.json, so the new helper will fail and existing jobs will continue using the old hard-coded version. (1 vote) |
packages/runner/test/native-health.test.ts |
Adds health-check configuration-source and failure-path coverage. | Moderate — The fixture hard-codes 2026-03-10, causing tests to fail after a configuration-only version update. (2 votes) |
packages/runner/test/ghcr-first-package.test.ts |
Adds the API configuration fixture for PowerShell GHCR tests. | No finding |
packages/github/src/api-version.ts |
Exports the API version from the shared configuration. | No finding |
config/github-api.json |
Defines the canonical GitHub REST API version. | No finding |
.github/workflows/sync-managed.yml |
Loads the API configuration from the workflow source commit. | Moderate — Validation checks only the date shape, allowing invalid calendar dates such as 2026-13-40 to reach API operations. (1 vote) |
.github/workflows/release.yml |
Loads the API configuration from the workflow source commit. | Moderate — Validation checks only the date shape, allowing invalid calendar dates such as 2026-13-40 to reach API operations. (1 vote) |
.github/renovate.json |
Adds custom Renovate discovery for GitHub REST API versions. | Moderate — The configured https://api.github.com/versions endpoint is not an official GitHub REST endpoint for listing API versions, so the datasource will not discover upgrades. (2 votes) |
Review effort: Lite
There was a problem hiding this comment.
🟡 Changes recommended
Several tests hard-code the canonical value instead of reading the shared configuration, so a future Renovate-only update would cause pre-request test failures and block the automated update path.
1 open issue
请求头测试硬编码 API 版本,阻断配置自动更新 · New
2 resolved since last review
Review effort: Lite
## 摘要 为共享旧运行时的普通维护 PR 提供中央受信原生检查,支持工作流、调用者、测试及工具版本在同一 PR 中更新。变更类型:构建与依赖、测试。 ## 变更原因 PR307 的一次性身份合同不能接收日常维护;候选自身的同名检查也不能替代固定中央来源。普通工作流更新应由受信原生扫描验证,无需先另合一个允许变更的结构或 SHA 合同。 ## 主要改动 - source/final 分别核对同仓 PR、准确 base/head/merge、有效签名、平台 workflow 来源及新鲜 refs;候选测试在独立只读 job 执行。 - 复用中央文件发现、jactionlint、zizmor、mise 锁和官方 Actions 锁验证器,扫描候选真实 YAML、本地调用与复合 Action;候选 npm/mise/ignore 配置不能决定扫描器。 - 普通工作流增删、改名、命令、needs/matrix 与同项目 Action SHA 更新不再依赖精确结构清单或另一份 SHA 批准表。原生项目许可、完整 SHA、安全扫描、审查及必要配置交接继续适用。 - Node/npm 读取维护声明并可同 PR 更新;npm 由维护 package-lock 中的 devDependencies.npm 锁定,必须与 packageManager 一致,bootstrap 后使用该 CLI 执行检查。API 复用 #309 唯一 helper/config,不新增发现器。 - PR307 evaluator 和原恢复合同仅保留历史字节。候选业务测试是自检,不能替代可信扫描;检查器自身升级沿旧 P 检查候选、合入验证后提升来源的既有机制。 ## 关联事项 相关 #307、#309。本 PR 只交付中央入口;维护树适配和原生 required-workflow 采用另按准确阶段交接。维护树须先具备 npm 工具锁、Actions 锁和原生扫描兼容性,不能直接把历史树视为已接入。 ## 验证结果 - Windows Node26.12.1:独立 Node 6项、Vitest 2项通过;真实扫描覆盖普通路径增改/改名、matrix/命令、完整 SHA 变化,错误 needs 与候选 ignore/命令注入仍拒绝;类型/源码边界、中央18文件原生扫描及官方 Actions 锁检查通过。 - 配套维护树11工作流经真实 jactionlint/zizmor通过,exceptions为空;原生锁验证通过,runner dist逐字节验证通过。相关历史合同及新入口回归已验证;准确 Node24.22.0/npm11.19.1 全量84文件、1969项通过、5项既有跳过。配套维护改动不包含在线部署。 - 当前 H6e0779a8 已由 GitHub 原生 update-branch 同步主线 b87eb99,签名 valid、相对 main 仍7文件;本地6项Node/2项扫描测试通过,新H Native42878150571 attempt1 success(最终job130055158443);同head Copilot无未解决问题、Codex code completed/false、security completed/null=UNKNOWN。实际运行P=f1796f9;待F来源提升后按有效规则、merge eligibility和受影响实现判断结果适用性,不自动重跑或冒称新P。此前 a8f1112 的 Native42865688367成功及完整AI终态仅保留为历史,不替代新head验收。 ## 影响分析 仅 contents/pull-requests read,无 Environment、生产秘密、迁移或部署权限。source/final不执行候选业务代码,候选自检不自动证明测试语义可信,测试/依赖修改仍由完整PR审查承担。security null保留未知;同名status不能替代ruleset来源绑定。 ## 发布与迁移 中央代码完成审查/CI并采用后,固定required workflow来源,再以真实维护PR验证适配并交接必需检查。保留strict、标题、签名、人工审批和线程解决。受信来源、必需检查、特权身份或未批准外部项目变化仍需准确原生配置交接。业务Worker保持未部署。 ## 回退方式 线上采用前可回退本源码PR;采用后先恢复已验证的受信来源并保持检查,不关闭规则绕过。无持久业务数据修改。 ## AI 使用声明 本次贡献由AI编程助手代理生成;人类批准任务范围,审查状态以本PR实际记录为准。 ## 补充材料 接入边界见 docs/maintenance-validation.md。维护实际required workflow运行与服务切换分别验收,不以本地检查替代。


变更原因
GitHub REST API 日期分散在 SDK、脚本、模板递送、事件 Worker 和健康检查中,现有依赖更新器不能统一发现和递送协议升级。将活跃声明集中为
config/github-api.json,保持当前正式版本2026-03-10。主要改动
github.workflow_sha对应的公开 JSON,来源不可读或格式错误时停止,不执行下载内容。/versions,采用日期比较并允许 major;升级 PR 提示同步检查官方 breaking changes、调用端和构建产物。验证结果
最终候选基于
d3072502e03da1e0be054985d7530d91dac1d30f,保留最新已采用的官方 mise-action、发布恢复修复与初始化入口;初始化入口和App认证组合25项通过。整合后重新 build/typecheck/verify:dist 通过;GHCR 与受影响的恢复/内容测试 44 项通过,46 项 Linux shell 测试在 Windows 跳过,最终跨平台结果由本 PR 原生 CI 补齐。远端 20 文件完整 Git tree 与本地准备结果一致,7 个提交均经 GitHub 原生验证为 valid,最终 head 为324ad1ade4e2eb36841d835670368433d57a2219。最终 head 原生 Linux CI 已通过:110 个测试文件通过、1 个跳过;2,180 项测试通过、8 项跳过。CodeQL、治理扫描、依赖、文档与标题检查通过;Windows 同样通过:110 个测试文件通过、1 个跳过,2,139 项测试通过、49 项跳过。最终原生 SPLRAD Validation run42493733414 completed/success。旧 PR Validation Gate 的 CONTRACT_RUN_ABSENT 单列为旧入口缺口,不宣称全检查绿灯。
以下为整合前同一 API 修复的分层验证,不能替代最终 head CI:
已通过类型检查、build、逐字节
verify:dist、任务独占 mise 锁环境的verify:config与工作流检查,以及官方gh actions-lock --verify。Worker 15 项(含 workerd)、相关 53 项测试通过;独立 Linux 48 项 health/budget 正反例通过。完整 Vitest 首轮 2093 项通过、6 项失败、49 项跳过;失败均因 GHCR 临时夹具遗漏新配置,补齐真实配置文件后该 6 项复测全部通过。Python 模板完整套件 54 项全部通过。Renovate
44.222.4官方本地 lookup 从隔离旧值2022-11-28发现当前2026-03-10(major),当前值查询没有更新。Windows 本地 RE2 曾回落 RegExp,不能据此声称托管原生提取已通过。完整npm run verify在 Windows 的嵌套 npm PATH 前提处失败,已分别执行实际检查;未修改检查门槛。影响与采用
当前 API 版本、业务数据格式及权限保持;不调用模型,不部署服务。health 增加对准确提交的公开 raw JSON 读取,失败时不会执行后续 API 操作。Mend 真实托管提取尚待本 PR 正常采用后,在准确默认分支作业中验证;本地 lookup 不代表生产更新链签收。后续 API 升级仍须同一受审事务适配调用端、测试和产物。仍固定旧 controller SHA 的消费者尚未采用本 PR,须经 controller 后续递送验收,不能宣称全消费者已采用。
回退方式
如统一来源或托管提取发生故障,保留原生失败证据并正常 revert 本变更或在同一范围修复;不删除版本头回退默认协议,不改历史发行字节。
AI 使用声明
本次代码由 AI 编程助手代理生成。最终 head 的 Copilot 与 Codex 代码/安全审查均已 completed;Codex code 两个 findings 字段 false,security 字段 null,不表述为零发现。采纳测试夹具硬编码意见并补跑 Linux 46 项全部通过;另外两项经官方端点及准确 controller 原文复核后回复依据并解决,4 条线程均 resolved。