fix: 上游巡检允许已审查暂缓覆盖集合新增子技能 (#230)

## Why

`upstream-health-hold.json` could only cover `upstream-path-change` and
`outdated`. When the upstream head of a held collection adds children
that `children` does not declare, the `new-skill` finding stays
actionable even after maintainers have reviewed those children and
decided not to declare them, so the tracking issue (#213) can never
close. `skills/marketingskills` is in this state today: its two new
upstream children were reviewed in the 2026-10-27 round (#227), but
nothing can hold the finding.

## What changes

- `new-skill` is now a holdable status (`HOLDABLE =
("upstream-path-change", "new-skill", "outdated")`).
- A hold that lists `new-skill` also checks the undeclared children:
- the set of undeclared child paths at branch head must equal the set at
the reviewed `head`; otherwise `stale-hold: undeclared children changed
since <head> (added …; removed …)`;
- the staleness diff adds those undeclared child paths to the installed
scope (declared children plus root `LICENSE*`/`NOTICE*`/`COPYING*`), so
any change inside them gives `stale-hold: upstream changed within the
installed scope or undeclared children since <head>`;
- a network error while listing children at the reviewed head is
`unreachable`, not a stale hold.
- Holds without `new-skill` compare the same scope and keep every
existing message. The only wording change for them is the validation
error for an unholdable status, which now lists `new-skill` among the
holdable statuses.
- The discovery filter moves into `undeclared_children()`, which the
`new-skill` finding and the hold check share, so both always agree on
what is undeclared.
- The checker docstring, the tracking-issue guidance in
`.github/workflows/upstream-health.yml`, `README.md` and
`README.zh-CN.md` describe the extended hold.

## Tests

New cases in `scripts/catalog/test_check_upstream_health.py`:

- a valid `new-skill` hold is reported as `held`, and stays held after
an unrelated upstream change;
- a newly added undeclared child, and later the removal of the reviewed
ones, make the hold stale;
- a content change inside a held undeclared child makes the hold stale;
- an `outdated`-only hold on a collection still ignores changes to
undeclared children (existing behaviour);
- a network error while listing children at the reviewed head stays
`unreachable`.

The validation test now accepts `new-skill` and still rejects broken,
`unreachable`, `unpinned`, `held`, `stale-hold` and `ok`.

## Validation

- `scripts/i18n/test_validate_i18n.py`: 19 tests pass.
- `scripts/catalog/test_validate_catalog_metadata.py`: 51 tests pass.
- `scripts/catalog/test_collection_generator.py`: 10 tests pass.
- `scripts/catalog/test_check_upstream_health.py`: 47 tests pass (5
new).
- `validate_catalog_metadata.py --require-complete` and
`validate-i18n.py`: 0 errors, 103 existing warnings. `translate.py
--check`, `actionlint` and `git diff --check` are clean.
- Live run on `marketingskills` (entry and hold as on `main`, in a
scratch copy, not committed):
- with `new-skill` added to the 2026-10-27 hold, the result is
`stale-hold`, because upstream has since moved from `17772c7` to
`0cd9b3a` and changed declared children. The same hold without
`new-skill` is also stale, so this is not caused by the new check. The
two undeclared children are unchanged between those heads.
- with the reviewed head set to a commit whose tree equals the current
head, `new-skill` and `outdated` are both `held` and the summary reports
`actionable: false`.

## Follow-up

After this lands, the `marketingskills` hold can add `new-skill` to its
`statuses`. Its reviewed head needs a fresh review first, because
upstream has changed declared children since `17772c7`.

The pre-publication sensitive-token scan was run privately by the
maintainer and passed.

Refs #213.
This commit is contained in:
yige authored and GitHub committed 2026-10-28 20:08:36 +08:00
1 parent c8626c758e
commit 1ced701714
5 files changed
+121 -25

No files matched your search

+2 -2
View File
@@ -243,7 +243,7 @@ uv run scripts/catalog/check_upstream_health.py
路径检查以实际安装的快照为准。只有分支头删除路径、固定版本仍可用时,报告 `upstream-path-change`。`outdated` 表示安装内容不同,不表示一定发布了新版本;文件树完全相同的提交不会触发更新提醒。比较范围与安装时复制的内容一致:单技能子目录指针比较 `source.path`,集合比较已声明的子技能路径,两者都包含仓库根的 `LICENSE*`、`NOTICE*` 和 `COPYING*` 文件。因此,无关的资讯数据、网站、CLI 源码、测试或 changeset 更新不会反复要求改动固定提交;未声明的上游技能仍单独报告为 `new-skill`。位于仓库根目录的单技能、智能体和团队比较整个快照。`--summary-file <路径>` 将工作流使用的 `broken`、`actionable` 和 `unknown` 判定以及 `held` 发现数量写入 JSON。未固定版本仍属于待处理事项;网络状态未知时保留跟踪 Issue。
如果保留当前固定版本是经过审阅的决定,在 `entry.json` 旁添加 `<kind>/<id>/upstream-health-hold.json`:
如果保留当前固定版本,或暂不声明集合在上游新增的子技能,是经过审阅的决定,在 `entry.json` 旁添加 `<kind>/<id>/upstream-health-hold.json`:
```json
{
@@ -255,7 +255,7 @@ uv run scripts/catalog/check_upstream_health.py
}
```
只有 `upstream-path-change` 和 `outdated` 可以暂缓;失效状态、`unreachable`、`new-skill` 和 `unpinned` 一律不能暂缓。暂缓记录仅在 `ref` 等于条目的 `source.ref`,且上游分支头与 `head` 在安装范围内的内容完全相同时生效。被暂缓的发现报告为 `held`,列入“Reviewed holds”区块,不属于待处理事项,因此跟踪 Issue 可以关闭;关闭评论会说明仍有多少条被暂缓的发现。如果固定版本已变更、上游在安装范围内有新改动、已审阅的提交已不存在、文件无效,或已不存在被暂缓的发现,暂缓记录即失效:原有发现(如有)重新出现,并附带一条待处理的 `stale-hold`,要求重新审阅或删除该记录。检查已审阅提交时遇到网络错误会报告为 `unreachable`,不视为暂缓失效。CI 测试要求每个暂缓文件格式正确,且其 `ref` 与条目的 `source.ref` 一致,因此更新固定版本时必须同步更新或删除对应的暂缓文件。暂缓记录用于留存经过审阅的决定,不能用来掩盖已失效的条目。
只有 `upstream-path-change`、`new-skill` 和 `outdated` 可以暂缓;失效状态、`unreachable` 和 `unpinned` 一律不能暂缓。暂缓记录仅在 `ref` 等于条目的 `source.ref`,且上游分支头与 `head` 在安装范围内的内容完全相同时生效;列出 `new-skill` 的暂缓记录还要求上游分支头的未声明子技能路径与 `head` 完全一致,且这些目录的内容没有变化。被暂缓的发现报告为 `held`,列入“Reviewed holds”区块,不属于待处理事项,因此跟踪 Issue 可以关闭;关闭评论会说明仍有多少条被暂缓的发现。如果固定版本已变更、上游在安装范围内有新改动、被暂缓的未声明子技能有增删或改动、已审阅的提交已不存在、文件无效,或已不存在被暂缓的发现,暂缓记录即失效:原有发现(如有)重新出现,并附带一条待处理的 `stale-hold`,要求重新审阅或删除该记录。检查已审阅提交时遇到网络错误会报告为 `unreachable`,不视为暂缓失效。CI 测试要求每个暂缓文件格式正确,且其 `ref` 与条目的 `source.ref` 一致,因此更新固定版本时必须同步更新或删除对应的暂缓文件。暂缓记录用于留存经过审阅的决定,不能用来掩盖已失效的条目。
[校验工作流](.github/workflows/i18n-validate.yml)是 CI 行为的权威来源。它会检测相关路径,纯文档改动可能跳过目录校验。跳过后显示成功的任务,不代表 Markdown 链接或中英文文档已被检查;这些内容仍需单独审查。