feat(catalog): 增加过期草稿轮换、非可安装条目跳过与静态位图预算分档规则 (#430)

## 概述 / Summary

在**不放松任何安全/供应链审核红线**的前提下,为每日 `Upstream Health` 工作流落地 3 条减少无效 Draft
堆积的安全规则:

1. **规则 A — 过期自动草稿自动轮换 & 放宽重审预算(`propose_upstream_updates.py`)**:
- 已有 PR 重审预算从 `args.limit`(5)提升至 `max(args.limit * 4, 25)`,避免 15+ 个打开的
Draft PR 互相饿死。
- 当已有自动生成的 Draft PR(经 `_is_automated_draft_only`
确认无人工提交或额外文件)落后于上游新提交,且**新提交按最新 `main` 规则已通过全部审核**时,自动关闭旧草稿(留注释说明)并直接为新
SHA 创建正式 Ready PR(解决 `#396`、`#398` 这类卡在旧 SHA 草稿上的问题)。
2. **规则 B — 非 `installable` 条目不白建必然失败的 Draft
PR(`propose_upstream_updates.py`)**:
- `catalog-metadata.v1.json` 中 `governance.availability` 明确非
`installable`(例如 `listing-only`)的条目,直接在覆盖报告记为
`governance-blocked`,不再创建注定失败的 Draft PR 噪音(覆盖
`#402`/`#403`/`#410`/`#411`/`#423` 同类场景)。
3. **规则 C — 静态位图单文件预算分档(`audit_skill_update.py`)**:
- 非可执行静态位图(`mode=100644` 的 `.png`/`.jpg`/`.jpeg`/`.webp`)单文件预算放宽至 `5
MiB`(`MAX_STATIC_IMAGE_BYTES`),减少演示截图误伤;
   - 脚本、代码、`.svg`(可能含脚本)、文档与二进制仍严格维持 `1 MiB` 上限,且超预算报错明确输出具体文件路径与字节数。

## 变更 / Changes
- `scripts/catalog/propose_upstream_updates.py`:新增
`_non_installable_availability`、`rotate_stale_automated_draft_pr`、扩大
`recheck_budget`
- `scripts/catalog/audit_skill_update.py`:新增 `MAX_STATIC_IMAGE_BYTES` /
`STATIC_IMAGE_EXTENSIONS` 分档预算与精确路径报错
- `docs/verified-update-automation.md`:同步更新规则说明
- `scripts/catalog/test_propose_upstream_updates.py` &
`scripts/catalog/test_audit_skill_update.py`:新增 3 项单测覆盖规则 A/B/C

## 验证 / Validation
- `uv run --offline --quiet
scripts/catalog/test_propose_upstream_updates.py`
- `uv run --offline --quiet scripts/catalog/test_audit_skill_update.py`
- `uv run --offline --quiet scripts/catalog/validate_catalog_metadata.py
--require-complete`
- `uv run --offline --quiet scripts/i18n/validate-i18n.py`
- `uv run --offline --quiet scripts/i18n/translate.py --check`
- `git diff --check`
This commit is contained in:
mashagua authored and GitHub committed 2026-12-03 21:27:26 +08:00
1 parent f6d1eccf70
commit 599de06444
5 files changed
+157 -23

No files matched your search

+9 -1
View File
@@ -107,7 +107,15 @@ target SHA passes fresh re-audit under updated `main` policy/special-review
records (with zero manual human commits/files on the draft branch), the proposer
merges `main` normally (no rebase/force-push), re-runs all catalog/i18n
validators, updates the receipt/body, and marks the PR Ready (`gh pr ready`).
Discovery/audit/validation failures retain old admission and
When upstream has moved to a newer SHA that passes fresh re-audit and the older
open Draft PR is bot-authored only (no manual edits), the proposer closes the
stale Draft PR with a comment and opens a fresh Ready PR for the new SHA (with an
expanded re-audit budget of `max(limit * 4, 25)` so open Drafts do not starve).
Non-installable entries (`availability != "installable"`, such as `listing-only`)
are reported as `governance-blocked` in coverage rather than opening doomed Draft
PRs. For single-file size budgets, non-executable raster images (`.png`, `.jpg`,
`.jpeg`, `.webp`) are permitted up to 5 MiB while scripts, code, SVGs, docs, and
other files remain strictly capped at 1 MiB. Discovery/audit/validation failures retain old admission and
become drafts/manual findings. Nothing automatically promotes listing-only.
## Offline checks