Files
market/scripts/catalog
mashagua 61148f2e73 feat(market): 自动核验上游技能更新并记录审核证据 (#237)
## 问题与结果 / Problem and outcome

原流程每周检查上游并更新跟踪 Issue,更新候选的版本、来源和审核记录仍需人工准备。本 PR 增加以下处理:

| 项目 | 本 PR 的行为 |
| --- | --- |
| 1. 检查与候选 | 每天检查上游;每轮最多处理 5 个去重的 Skill 更新候选。自动核验仅接受固定 Git
快照,并要求旧快照已有许可和准入证据。 |
| 2. 核验范围 |
比较实际安装范围、根目录及嵌套许可证/Notice、结构化依赖、名称简介、兼容性声明和合集成员。包自身版本可以递增;依赖或脚本声明变化须人工复核。核验阶段不执行上游代码。
|
| 3. 核验通过 | 同步 entry 和 sidecar 的来源 ref、可确认的上游版本;写入机器审核身份、真实日期和
`upstream-audit.v1.json`,将证据绑定到来源 URL、新旧
ref、内容路径、许可摘要和检查结果。目录、本地化、翻译新鲜度及适用的合集校验通过后,才创建普通 PR。 |
| 4. 无法确认或校验失败 |
保留旧审核记录,创建带具体原因的草稿;不会将旧审核标记为新快照已通过。缺失版本不编造,版本回退被阻止,未知发布日期保持未知。 |
| 5. 重复与失败处理 | 保留已有更新 PR 和 hold 决策;同一快照已有关闭 PR 时不重复创建。提交、推送或 PR API
失败时保留覆盖报告,并以失败退出。所有更新均不自动合并。 |
| 6. 覆盖报告 | 为顶层 Skill、合集子项和内置内容输出更新状态或阻碍原因。当前 145 个顶层条目加 302 个子项,共 447
条库存记录;这不是 447 次运行验收。ZIP/Web 仅收录条目保持准入阻碍,缺新版发现依据时明确说明。 |

机器核验仅确认有限范围的来源、许可与结构化元数据一致性。非结构化依赖、行为变化、实际运行和安全性仍需结合差异人工复核;不代表上游背书。

The weekly issue-only check becomes a daily pipeline with at most five
deduplicated Skill candidates per run. Eligible immutable Git snapshots
receive bounded source/license/structured-metadata verification and
explicit machine receipts. Catalog and localization checks must pass
before a normal PR is created; blocked candidates remain drafts with the
old review intact. Existing proposals and holds are preserved, failures
retain coverage reports, and nothing auto-merges or claims
runtime/security certification.

## Copilot 审核邀请:改动与当前状态 / Copilot review invitation

1. **原失败原因**:旧邀请任务使用 `pull_request` 上下文,请求审核时返回 `403 Resource not
accessible by
integration`。[失败记录](https://github.com/desirecore/market/actions/runs/41067055993/job/124101102218)属于旧提交
`732cc2a`。
2. **本 PR 的改动**:邀请流程改用 `pull_request_target` 和受信任的 base 上下文,仅调用 PR 元数据
API,不检出或执行 PR 代码。返回 422 时,必须确认当前 head 已有 Copilot 审核记录,才能按已审核处理;其他错误仍失败。
3. **生效范围**:该流程监听 opened、reopened、ready_for_review,未监听
synchronize。邀请修正需合入默认分支后,再在适用事件上验证;本 PR 的推送不能证明新邀请流程已在线生效。
4. **当前实际审核状态**:截至下方验证快照,没有审核记录,也没有待处理审核邀请。`Wait for Copilot review`
运行成功,但日志显示等待约 8 分钟后超时,按现有规则放行,**不代表 Copilot 已审核**。该等待规则未在本 PR
中修改。[等待任务日志](https://github.com/desirecore/market/actions/runs/41309461885/job/124856608594)

The old invitation failed with HTTP 403. This PR moves metadata-only
invitation requests to the trusted base context and verifies a
current-head review before treating HTTP 422 as already reviewed. The
change still needs post-merge validation on a supported event. There are
currently no submitted or pending review requests; the green waiting job
reflects timeout fallback, not an actual Copilot review.

## 验证快照 / Validation snapshot

验证对应提交:`24183e240c945fd72cd0c8a6b10730b18db6d1f3`,2026-11-01。

- **已修复的 CI 错误**:`test_audit_skill_update.py` 曾向 `validate_sidecar`
传入空校验器字典,触发 `KeyError: 'skill'`。现加载真实 Skill client schema,并在两处调用中传入
`ClientEntryValidator`;原测试断言保持不变。
- **本地测试**:自动核验 15、候选发布 9、目录校验器 62、合集生成器 10、上游检查 47、审核邀请流程 1、i18n 校验器
19、Office launcher 11,共 **174 项通过**。
- **本地数据检查**:目录和 i18n 校验均为 0 errors、103 条既有 warnings;翻译新鲜度与 diff 空白检查通过。
- **GitHub CI**:[`i18n
Validate`](https://github.com/desirecore/market/actions/runs/41309461898)全部通过,包括目录、翻译新鲜度和联网合集检查;[`i18n
Auto-Translate`](https://github.com/desirecore/market/actions/runs/41309461185)成功;[`Wait
for Copilot
review`](https://github.com/desirecore/market/actions/runs/41309461885)成功,但属于上述超时放行。
- **合并状态**:GitHub 返回 `mergeable: true`、`mergeStateStatus:
CLEAN`;当前提交没有失败检查。PR 尚未合并。
- **尚未做的验证**:未触发真实定时更新批次、未批量创建新版 PR、未执行上游代码;新邀请流程权限和真实审核仍待验证。

All 174 local tests pass. Catalog/localization validation reports zero
errors and 103 existing warnings. Current-head CI is green, including
generated collection checks; GitHub reports CLEAN. Copilot review
itself, the revised invitation's online permissions, and a real
scheduled publication batch remain unverified.

## 发布前提与关联改动 / Operation and related changes

- Actions 自动创建 PR 需要仓库设置允许;本 PR 未调整仓库管理员设置。
- 默认 `GITHUB_TOKEN` 创建的 PR
通常不会触发其他工作流,因此发布候选前会执行目录和本地化检查;合并前仍需核对实际检查与审核结果。
- 客户端同版本内容交付及 Kimi
独立官方包维护:[desirecore#5526](https://github.com/desirecore/desirecore/pull/5526);关联文档:[desirecore-docs#864](https://github.com/desirecore/desirecore-docs/pull/864)。这些链接表示关联范围,不表示本
PR 合并即可发布客户端能力。
2026-11-05 16:56:29 +08:00
..