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 @@ The upstream health check is read-only and exits non-zero when an entry is `gone
Paths are checked at the installed snapshot. A path removed only at branch head is reported as `upstream-path-change` while a valid pin remains usable. `outdated` means the installed content differs, not that a new release version exists; commits with identical trees do not trigger it. Comparison covers what an installation copies: `source.path` for a single-skill subtree pointer or the declared child paths for a collection, plus root `LICENSE*`, `NOTICE*` and `COPYING*` files. Unrelated feeds, websites, CLI sources, tests or changesets therefore do not trigger repins; undeclared upstream skills are still reported separately as `new-skill`. Root-level single skills, agents and teams compare the whole snapshot. `--summary-file <path>` writes the workflow's `broken`, `actionable` and `unknown` decisions and the `held` finding count as JSON. Unpinned entries remain actionable, and network uncertainty keeps the tracking issue open.
When keeping the current pin is a reviewed decision, add `<kind>/<id>/upstream-health-hold.json` beside `entry.json`:
When keeping the current pin, or leaving new upstream children of a collection undeclared, is a reviewed decision, add `<kind>/<id>/upstream-health-hold.json` beside `entry.json`:
```json
{
@@ -255,7 +255,7 @@ When keeping the current pin is a reviewed decision, add `<kind>/<id>/upstream-h
}
```
Only `upstream-path-change` and `outdated` can be held; broken statuses, `unreachable`, `new-skill` and `unpinned` never can. A hold applies only while `ref` equals the entry's `source.ref` and the installed-scope content at upstream head is identical to that at `head`. Held findings are reported as `held` in a "Reviewed holds" section and are not actionable, so the tracking issue can close; the closing comment states how many held findings remain. When a hold no longer applies because the pin changed, upstream changed within the installed scope, the reviewed head no longer exists, the file is invalid, or no held finding remains, any original findings return together with an actionable `stale-hold` that asks for re-review or removal. A network error while checking the reviewed head is reported as `unreachable`, not as a stale hold. CI tests require every hold file to be well-formed and its `ref` to match the entry's `source.ref`, so bumping a pin means updating or deleting its hold. A hold records a reviewed decision; it is not a way to silence a broken entry.
Only `upstream-path-change`, `new-skill` and `outdated` can be held; broken statuses, `unreachable` and `unpinned` never can. A hold applies only while `ref` equals the entry's `source.ref` and the installed-scope content at upstream head is identical to that at `head`. A hold that lists `new-skill` also requires upstream head to have the same undeclared child paths as `head`, with identical content in those directories. Held findings are reported as `held` in a "Reviewed holds" section and are not actionable, so the tracking issue can close; the closing comment states how many held findings remain. When a hold no longer applies because the pin changed, upstream changed within the installed scope, held undeclared children were added, removed or changed, the reviewed head no longer exists, the file is invalid, or no held finding remains, any original findings return together with an actionable `stale-hold` that asks for re-review or removal. A network error while checking the reviewed head is reported as `unreachable`, not as a stale hold. CI tests require every hold file to be well-formed and its `ref` to match the entry's `source.ref`, so bumping a pin means updating or deleting its hold. A hold records a reviewed decision; it is not a way to silence a broken entry.
The [validation workflow](.github/workflows/i18n-validate.yml) is the source of truth for CI. It detects relevant paths and can skip catalog validation for documentation-only changes. A green skipped job is not evidence that Markdown links or bilingual documentation were checked; review those separately.