mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 11:39:26 +08:00
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 合并即可发布客户端能力。
This commit is contained in:
1 parent
fa90724a45
commit
61148f2e73
13 files changed
+946
-12
No files matched your search
@@ -1,7 +1,8 @@
|
||||
name: Auto-request Copilot review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# 仅操作主仓 PR 元数据;本流程不检出或执行 PR 代码。
|
||||
pull_request_target:
|
||||
types: [opened, reopened, ready_for_review]
|
||||
|
||||
permissions:
|
||||
@@ -17,6 +18,7 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
set -e
|
||||
if gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" \
|
||||
@@ -25,15 +27,17 @@ jobs:
|
||||
echo "Copilot already requested as reviewer."
|
||||
exit 0
|
||||
fi
|
||||
# 422 here usually means Copilot has already submitted a review (so the
|
||||
# request slot is gone). Treat that as benign.
|
||||
# 422 也可能是功能未启用等错误,必须核对真实审核记录,不能直接报成功。
|
||||
if ! resp=$(gh api -X POST \
|
||||
"repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers" \
|
||||
-f 'reviewers[]=copilot-pull-request-reviewer[bot]' 2>&1); then
|
||||
echo "$resp"
|
||||
if echo "$resp" | grep -q '"status":"422"'; then
|
||||
echo "POST returned 422; Copilot likely already reviewed."
|
||||
exit 0
|
||||
if gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER/reviews" --paginate \
|
||||
| jq --arg head "$PR_HEAD_SHA" -r '.[] | select(.commit_id == $head) | .user.login' | grep -qE '^(Copilot|copilot-pull-request-reviewer\[bot\])$'; then
|
||||
echo "Copilot review exists for the current head."
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
;;
|
||||
esac
|
||||
changed=$(git diff --name-only "$range" || true)
|
||||
if echo "$changed" | grep -qE '^(skills/|agents/|teams/|schemas/|manifest\.json$|categories\.json$|scripts/i18n/|scripts/catalog/|scripts/office/|scripts/gen-collection-children\.py$)'; then
|
||||
if echo "$changed" | grep -qE '^(skills/|agents/|teams/|schemas/|manifest\.json$|categories\.json$|scripts/i18n/|scripts/catalog/|scripts/office/|scripts/gen-collection-children\.py$|\.github/workflows/auto-request-copilot-review\.yml$)'; then
|
||||
echo "relevant=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "relevant=false" >> "$GITHUB_OUTPUT"
|
||||
@@ -72,6 +72,9 @@ jobs:
|
||||
uv run --quiet scripts/catalog/test_validate_catalog_metadata.py
|
||||
uv run --quiet scripts/catalog/test_collection_generator.py
|
||||
uv run --quiet scripts/catalog/test_check_upstream_health.py
|
||||
uv run --quiet scripts/catalog/test_propose_upstream_updates.py
|
||||
uv run --quiet scripts/catalog/test_audit_skill_update.py
|
||||
uv run --quiet scripts/catalog/test_review_workflow.py
|
||||
|
||||
- name: Validate catalog metadata
|
||||
if: steps.changes.outputs.relevant == 'true'
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
name: Upstream Health
|
||||
|
||||
# Weekly check that every external pointer (skills/agents/teams entry.json)
|
||||
# Daily check that every external pointer (skills/agents/teams entry.json)
|
||||
# still resolves upstream. Results go to one tracking issue labelled
|
||||
# `upstream-health`, which is updated in place and closed once nothing is
|
||||
# actionable. Fixing an entry stays a normal reviewed PR; this workflow never
|
||||
# rewrites catalog files.
|
||||
# rewrites the default branch. Verified Skill updates get normal PRs; blocked audits remain explicit drafts.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "23 1 * * 1" # Mondays 01:23 UTC
|
||||
- cron: "23 1 * * *" # Daily 01:23 UTC
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: upstream-health
|
||||
@@ -23,7 +24,7 @@ jobs:
|
||||
check:
|
||||
if: github.repository == 'desirecore/market'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
id: check
|
||||
run: |
|
||||
set +e
|
||||
uv run --quiet scripts/catalog/check_upstream_health.py --format markdown --summary-file summary.json > report.md
|
||||
uv run --quiet scripts/catalog/check_upstream_health.py --format markdown --summary-file summary.json --results-file results.json > report.md
|
||||
code=$?
|
||||
set -e
|
||||
if [ "$code" -gt 1 ]; then
|
||||
@@ -87,6 +88,16 @@ jobs:
|
||||
gh issue close "$issue"
|
||||
fi
|
||||
|
||||
- name: Propose reviewed-source updates
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
uv run --quiet scripts/catalog/propose_upstream_updates.py results.json --publish --limit 5 --coverage-file coverage.json
|
||||
- name: 展示所有技能的覆盖与阻碍
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f coverage.md ]; then cat coverage.md >> "$GITHUB_STEP_SUMMARY"; else echo '覆盖报告未生成,来源核验未完成。' >> "$GITHUB_STEP_SUMMARY"; fi
|
||||
|
||||
- name: Fail when an entry is broken
|
||||
if: steps.check.outputs.broken == 'true'
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user