mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-12-05 22:59:28 +08:00
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:
5 files changed
+121
-25
No files matched your search
@@ -66,7 +66,7 @@ jobs:
|
||||
{
|
||||
echo "_Updated by [Upstream Health]($RUN_URL) on $(date -u +%Y-%m-%d)._"
|
||||
echo
|
||||
echo "Fix entries through a normal PR: repoint or remove \`gone\` entries, correct \`bad-*\` paths, and review upstream changes before bumping \`source.ref\` for \`outdated\` entries (rerun \`scripts/gen-collection-children.py\` for collections); a reviewed decision to keep the current pin can be recorded in \`<kind>/<id>/upstream-health-hold.json\`. \`unreachable\` means a network error, not a confirmed failure."
|
||||
echo "Fix entries through a normal PR: repoint or remove \`gone\` entries, correct \`bad-*\` paths, and review upstream changes before bumping \`source.ref\` for \`outdated\` entries (rerun \`scripts/gen-collection-children.py\` for collections); a reviewed decision to keep the current pin or to leave new upstream children undeclared can be recorded in \`<kind>/<id>/upstream-health-hold.json\`. \`unreachable\` means a network error, not a confirmed failure."
|
||||
echo
|
||||
cat report.md
|
||||
} > body.md
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
+2
-2
@@ -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 链接或中英文文档已被检查;这些内容仍需单独审查。
|
||||
|
||||
|
||||
@@ -16,28 +16,32 @@ script looks at each upstream and reports, without rewriting anything:
|
||||
bad-path source.path, the root SKILL.md, or a declared child path is missing at
|
||||
the installed snapshot (source.ref, or branch head when unpinned)
|
||||
unreachable network error other than "not found"; treated as unknown, not broken
|
||||
stale-hold a reviewed hold no longer applies (invalid file, pin or installed upstream
|
||||
content changed since review, or nothing left to hold); re-review it
|
||||
stale-hold a reviewed hold no longer applies (invalid file, pin, installed upstream
|
||||
content or held undeclared children changed since review, or nothing
|
||||
left to hold); re-review it
|
||||
new-skill branch head has collection children that `children` does not declare
|
||||
(same discovery rules as scripts/gen-collection-children.py)
|
||||
upstream-path-change a declared path moved at branch head but the pin still works
|
||||
outdated pinned content differs from branch head; review before updating
|
||||
unpinned entry follows a moving branch without source.ref
|
||||
held upstream-path-change / outdated finding covered by a reviewed hold
|
||||
held upstream-path-change / new-skill / outdated finding covered by a reviewed hold
|
||||
ok nothing to report
|
||||
|
||||
Path checks distinguish the installed snapshot from changes at branch head.
|
||||
Only skills get path checks; agents and teams are AgentFS repositories.
|
||||
|
||||
Maintainers who review an upstream change and deliberately keep the current pin
|
||||
record that decision next to entry.json in `upstream-health-hold.json`:
|
||||
Maintainers who review an upstream change and deliberately keep the current pin,
|
||||
or leave new upstream children undeclared, record that decision next to
|
||||
entry.json in `upstream-health-hold.json`:
|
||||
|
||||
{"statuses": ["upstream-path-change", "outdated"], "ref": "<source.ref>",
|
||||
"head": "<reviewed upstream commit>", "reviewedAt": "YYYY-MM-DD", "reason": "..."}
|
||||
|
||||
The listed findings are reported as `held` while source.ref still equals `ref`
|
||||
and the installed content at branch head is unchanged since `head`. Broken,
|
||||
unreachable, new-skill and unpinned findings can never be held.
|
||||
and the installed content at branch head is unchanged since `head`. A hold that
|
||||
lists new-skill also needs the same undeclared child paths at branch head as at
|
||||
`head`, with unchanged content. Broken, unreachable and unpinned findings can
|
||||
never be held.
|
||||
|
||||
Usage:
|
||||
uv run scripts/catalog/check_upstream_health.py # text table
|
||||
@@ -77,7 +81,7 @@ ORDER = (*BROKEN, "unreachable", "stale-hold", "upstream-path-change", "new-skil
|
||||
# A reviewed decision to keep the current pin, next to entry.json.
|
||||
HOLD_NAME = "upstream-health-hold.json"
|
||||
HOLD_KEYS = ("statuses", "ref", "head", "reviewedAt", "reason")
|
||||
HOLDABLE = ("upstream-path-change", "outdated")
|
||||
HOLDABLE = ("upstream-path-change", "new-skill", "outdated")
|
||||
SHA = re.compile(r"[0-9a-f]{40}")
|
||||
|
||||
# Git asks for credentials when a public repository disappears; never prompt.
|
||||
@@ -217,17 +221,12 @@ def check_skill_paths(entry: dict, repo: Path, revision: str = "HEAD", *,
|
||||
children = entry.get("children") or []
|
||||
|
||||
if children:
|
||||
declared = {c["path"].strip("/") for c in children}
|
||||
for child in children:
|
||||
if child["path"].strip("/") not in skill_dirs:
|
||||
issues.append(("bad-path", f"child '{child['id']}' -> '{child['path']}' has no SKILL.md"))
|
||||
discovered = [c for c in GENERATOR.discover_children(repo, revision)
|
||||
if c["path"] not in declared] if discover else []
|
||||
declared_ids = {c["id"] for c in children}
|
||||
extra = [c["path"] for c in discovered if c["id"] not in declared_ids]
|
||||
extra = undeclared_children(entry, repo, revision) if discover else []
|
||||
if extra:
|
||||
shown = ", ".join(extra[:8]) + (f" (+{len(extra) - 8} more)" if len(extra) > 8 else "")
|
||||
issues.append(("new-skill", shown))
|
||||
issues.append(("new-skill", abbreviate(extra)))
|
||||
else:
|
||||
path = (entry["source"].get("path") or "").strip("/")
|
||||
if path not in skill_dirs:
|
||||
@@ -236,13 +235,30 @@ def check_skill_paths(entry: dict, repo: Path, revision: str = "HEAD", *,
|
||||
return issues
|
||||
|
||||
|
||||
def undeclared_children(entry: dict, repo: Path, revision: str) -> list[str]:
|
||||
"""Paths of the collection children at `revision` that `children` does not declare."""
|
||||
children = entry.get("children") or []
|
||||
if not children:
|
||||
return []
|
||||
declared = {c["path"].strip("/") for c in children}
|
||||
declared_ids = {c["id"] for c in children}
|
||||
return [c["path"] for c in GENERATOR.discover_children(repo, revision)
|
||||
if c["path"] not in declared and c["id"] not in declared_ids]
|
||||
|
||||
|
||||
def abbreviate(paths: list[str]) -> str:
|
||||
return ", ".join(paths[:8]) + (f" (+{len(paths) - 8} more)" if len(paths) > 8 else "")
|
||||
|
||||
|
||||
def apply_hold(issues: list[tuple[str, str]], hold: dict, entry: dict, kind: str, repo: Path,
|
||||
head: str) -> list[tuple[str, str]]:
|
||||
"""Report reviewed findings as `held` while the review still covers them.
|
||||
|
||||
A hold covers one pinned ref and the installed scope at the reviewed
|
||||
upstream head. Once either moves, or nothing it lists is found any more,
|
||||
the findings are kept as they are and a `stale-hold` explains why.
|
||||
upstream head; a `new-skill` hold also covers the set and content of the
|
||||
undeclared children at that head. Once any of these moves, or nothing it
|
||||
lists is found any more, the findings are kept as they are and a
|
||||
`stale-hold` explains why.
|
||||
"""
|
||||
if any(status == "unreachable" for status, _ in issues):
|
||||
return issues # unknown state: the review can be neither applied nor judged stale
|
||||
@@ -256,9 +272,26 @@ def apply_hold(issues: list[tuple[str, str]], hold: dict, entry: dict, kind: str
|
||||
status = "stale-hold" if MISSING_COMMIT.search(fetched.stderr) else "unreachable"
|
||||
return [*issues, (status, f"reviewed head {reviewed[:7]} cannot be fetched: "
|
||||
f"{last_line(fetched.stderr)}")]
|
||||
difference = git("diff", "--quiet", reviewed, head, *comparison_scope(entry, kind), cwd=repo)
|
||||
scope, undeclared = comparison_scope(entry, kind), []
|
||||
if "new-skill" in hold["statuses"]:
|
||||
# Undeclared children are not installed, so the scope above skips them.
|
||||
try:
|
||||
undeclared = undeclared_children(entry, repo, head)
|
||||
before = undeclared if reviewed == head else undeclared_children(entry, repo, reviewed)
|
||||
except RuntimeError as err:
|
||||
return [*issues, ("unreachable", f"cannot compare undeclared children with reviewed head "
|
||||
f"{reviewed[:7]}: {str(err)[:300]}")]
|
||||
added, removed = sorted(set(undeclared) - set(before)), sorted(set(before) - set(undeclared))
|
||||
if added or removed:
|
||||
change = "; ".join(f"{word} {abbreviate(paths)}"
|
||||
for word, paths in (("added", added), ("removed", removed)) if paths)
|
||||
return [*issues, ("stale-hold", f"undeclared children changed since {reviewed[:7]} ({change})")]
|
||||
if scope: # an empty scope already compares the whole snapshot
|
||||
scope = [*scope, *undeclared]
|
||||
difference = git("diff", "--quiet", reviewed, head, *scope, cwd=repo)
|
||||
if difference.returncode == 1:
|
||||
return [*issues, ("stale-hold", f"upstream changed within the installed scope since {reviewed[:7]}")]
|
||||
within = "the installed scope or undeclared children" if undeclared else "the installed scope"
|
||||
return [*issues, ("stale-hold", f"upstream changed within {within} since {reviewed[:7]}")]
|
||||
if difference.returncode != 0:
|
||||
return [*issues, ("unreachable", f"cannot compare with reviewed head {reviewed[:7]}: "
|
||||
f"{last_line(difference.stderr)}")]
|
||||
|
||||
@@ -265,12 +265,75 @@ class UpstreamHealthTests(unittest.TestCase):
|
||||
issues = CHECKER.check_entry(entry)["issues"]
|
||||
self.assertEqual([i["status"] for i in issues], ["held", "held"])
|
||||
|
||||
def test_hold_covers_undeclared_children_reviewed_at_head(self) -> None:
|
||||
self.commit({"skills/beta/SKILL.md": "---\nname: beta\ndescription: B.\n---\n"})
|
||||
entry = self.entry(ref=self.first, children=[{"id": "alpha", "path": "skills/alpha"}])
|
||||
self.hold(entry, statuses=["new-skill"], reason="Beta is not offered.")
|
||||
self.assertEqual(self.statuses(entry),
|
||||
{"held": "new-skill: skills/beta — reviewed 2026-10-01: Beta is not offered."})
|
||||
self.commit({"README.md": "New website.\n"})
|
||||
self.assertEqual(set(self.statuses(entry)), {"held"})
|
||||
|
||||
def test_changed_undeclared_child_set_makes_a_new_skill_hold_stale(self) -> None:
|
||||
reviewed = self.commit({"skills/beta/SKILL.md": "---\nname: beta\ndescription: B.\n---\n"})
|
||||
entry = self.entry(ref=self.first, children=[{"id": "alpha", "path": "skills/alpha"}])
|
||||
self.hold(entry, statuses=["new-skill"])
|
||||
self.commit({"skills/gamma/SKILL.md": "---\nname: gamma\ndescription: G.\n---\n"})
|
||||
result = self.statuses(entry)
|
||||
self.assertEqual(result["new-skill"], "skills/beta, skills/gamma")
|
||||
self.assertNotIn("held", result)
|
||||
self.assertEqual(result["stale-hold"],
|
||||
f"undeclared children changed since {reviewed[:7]} (added skills/gamma)")
|
||||
sh("git", "rm", "--quiet", "-r", "skills/beta", "skills/gamma", cwd=self.upstream)
|
||||
self.commit({})
|
||||
result = self.statuses(entry)
|
||||
self.assertEqual(set(result), {"stale-hold"})
|
||||
self.assertIn("(removed skills/beta)", result["stale-hold"])
|
||||
|
||||
def test_held_undeclared_child_change_makes_the_hold_stale(self) -> None:
|
||||
reviewed = self.commit({"skills/beta/SKILL.md": "---\nname: beta\ndescription: B.\n---\n"})
|
||||
entry = self.entry(ref=self.first, children=[{"id": "alpha", "path": "skills/alpha"}])
|
||||
self.hold(entry, statuses=["new-skill"])
|
||||
self.commit({"skills/beta/references/offer.md": "Sponsored content.\n"})
|
||||
result = self.statuses(entry)
|
||||
self.assertEqual(result["new-skill"], "skills/beta")
|
||||
self.assertNotIn("held", result)
|
||||
self.assertEqual(result["stale-hold"],
|
||||
f"upstream changed within the installed scope or undeclared children since {reviewed[:7]}")
|
||||
|
||||
def test_outdated_hold_ignores_changes_to_undeclared_children(self) -> None:
|
||||
self.commit({"skills/alpha/SKILL.md": "---\nname: alpha\ndescription: Updated.\n---\n",
|
||||
"skills/beta/SKILL.md": "---\nname: beta\ndescription: B.\n---\n"})
|
||||
entry = self.entry(ref=self.first, children=[{"id": "alpha", "path": "skills/alpha"}])
|
||||
self.hold(entry)
|
||||
self.commit({"skills/beta/SKILL.md": "---\nname: beta\ndescription: Changed.\n---\n"})
|
||||
result = self.statuses(entry)
|
||||
self.assertEqual(set(result), {"held", "new-skill"})
|
||||
self.assertTrue(result["held"].startswith("outdated: "))
|
||||
|
||||
def test_network_error_listing_reviewed_children_is_unknown_not_stale(self) -> None:
|
||||
reviewed = self.commit({"skills/beta/SKILL.md": "---\nname: beta\ndescription: B.\n---\n"})
|
||||
entry = self.entry(ref=self.first, children=[{"id": "alpha", "path": "skills/alpha"}])
|
||||
self.hold(entry, statuses=["new-skill"])
|
||||
self.commit({"README.md": "New website.\n"})
|
||||
real_undeclared = CHECKER.undeclared_children
|
||||
|
||||
def failing_listing(entry, repo, revision):
|
||||
if revision == reviewed:
|
||||
raise RuntimeError("cannot read skills/beta/SKILL.md: Connection reset by peer")
|
||||
return real_undeclared(entry, repo, revision)
|
||||
|
||||
with patch.object(CHECKER, "undeclared_children", side_effect=failing_listing):
|
||||
result = self.statuses(entry)
|
||||
self.assertEqual(set(result), {"new-skill", "unreachable"})
|
||||
|
||||
def test_hold_validation_rejects_unholdable_statuses_bad_shas_and_extra_keys(self) -> None:
|
||||
valid = {"statuses": ["upstream-path-change", "outdated"], "ref": "a" * 40, "head": "b" * 40,
|
||||
"reviewedAt": "2026-10-01", "reason": "Kept after review."}
|
||||
self.assertEqual(CHECKER.hold_errors(valid), [])
|
||||
self.assertEqual(CHECKER.hold_errors({**valid, "statuses": ["new-skill"]}), [])
|
||||
invalid = [{"statuses": [status]} for status in
|
||||
(*CHECKER.BROKEN, "unreachable", "new-skill", "unpinned", "held", "stale-hold", "ok")]
|
||||
(*CHECKER.BROKEN, "unreachable", "unpinned", "held", "stale-hold", "ok")]
|
||||
invalid += [{"statuses": []}, {"statuses": "outdated"}, {"statuses": ["outdated", "outdated"]},
|
||||
{"ref": "A" * 40}, {"ref": "a" * 12}, {"head": "g" * 40}, {"head": None},
|
||||
{"reviewedAt": "2026-13-01"}, {"reviewedAt": "18/10/2026"}, {"reason": " "}, {"reason": 1},
|
||||
|
||||
Reference in new issue
Block a user