完善市场更新自动化:精确准入审核、安装通知门禁与双语问题闭环 (#354)

## 实际功能与范围

在原 PR 上继续完善,不新开机制 PR。使用 main 的可信代码与策略重新发现上游、读取精确旧新 pin、重建真实差异并绑定最终
SHA;不执行 PR 或上游代码,不把 listing-only 自动提升为 installable。

已正常 merge 最新 main,包含 #356、#357 以及其他 worker 完成的 #359;没有
rebase、force-push,也没有修改 #358–360 工作分支。本 PR **不合并、不部署自身**。

## 修改前后对照

| 修改点 | 修改前 | 修改后 / 实际效果 |
|---|---|---|
| Git 固定来源更新 | 主线发现更新后提出快照 PR,无法统一覆盖本轮发现的准入缺口 | 沿用精确 pin 的真实 delta
核验;新增门禁同样用于提案与可信自动合并重审。每轮最多审核 5 个新 Git 候选,另可只读复核 5 个已有 PR,不改其内容、不重复开 PR
|
| ZIP / Web 新版本发现 | 主线主要检查链接可访问性,不发现新版 | 只通过显式登记的 ClawHub / GitHub
release asset / GitHub file 适配器发现与固定来源,不猜版本、不把新哈希当作审核通过。目前实际登记高德
ClawHub;其他来源须另配可信跟踪;嵌套 ZIP 安装目录尚未适配 |
| 市场本地技能 | 不自动同步第三方上游 | AI News Radar
使用上游精确映射与文件清单,保留市场包装和本地补丁;上下游同时修改或映射范围不一致即暂停,不覆盖本地补丁。目前只登记此本地包 |
| 主许可通知是否随安装交付 | 能核对根及嵌套许可变化,却不能证明根主通知随 source.path / 所选 child.path 交付 |
分别检查每个所选目录;vendor/LICENSE 或 SKILL 中单行 MIT
不能替代主项目完整版权、授权和免责通知。README/SKILL 内完整等效文本可通过,不强制 standalone
LICENSE;未证明交付时阻断或转人工,不擅改安装方式 |
| NOTICE 的实际交付 | 根 NOTICE 存在或哈希已审可能被误当作安装交付 | 声明的 NOTICE
未证明随目录交付会阻断;未声明根 NOTICE 的适用性保守转人工。非标准/嵌套等效通知需人工复核,不把扫描未命中说成没有合法许可 |
| 精确 pin 人工例外 | README 文本没变时可能将旧许可例外扩展到新 pin | 单行 MIT 的旧 pin 例外不能自动继承;新
pin 必须另有真实人工授权。#359 的新 pin 例外是另一 worker 独立补审后合入 main 的决定,不是本机制自动扩大旧授权 |
| 版本、双语与派生目录 | 结构化字段通过不代表说明文字、两种语言和派生目录一致 |
使用明确版本源提示旧版本文案;根插件版本不强加给所选子目录,不把任意数字当版本。检查 entry/catalog
子项语言镜像,描述变化转人工;历史英文回退单独标记,不伪称已翻译 |
| 安装内容、权限、依赖和行为差异 | 依赖哈希接受或简短专项说明容易被误读为完整行为审核 | 直接比较完整 Git
对象和安装路径,报告新增/删除/权限差异,不依赖截断的 GitHub
compare。授权、凭据、配置、网络相关命名实现的变化保守转人工;明确这只是复核提示,不是已证实漏洞。开发依赖不冒充所选技能运行依赖 |
| 失败原因及真实回执 | 首个异常后缺少精确路径和未检查阶段;后续校验失败可能覆盖旧回执或仍显示已审 | 逐项输出技能/路径、精确旧新
pin、门槛、原因、修法与实际状态,区分历史遗留、本次引入、人工待审、实际失败和失败后未完成;保留真实旧回执,独立保存失败命令/输出,不生成假成功回执。物化
ZIP/local 的临时 Git ID 不当作真实来源 pin |
| 当前候选 PR 与 main 重放分层 | 对 main 旧元数据重放的失败,可能被误说成当前已修订 PR
仍未修;旧回执错误与许可根因混在一起 | 只读当前 PR 精确 head 的 entry、sidecar、旧回执与实时 checks;不
checkout、不执行候选。每行标注 main 重放或当前候选 head。reviewedRef / receipt ref /
receipt scope 三类未签新回执的派生错误与主通知交付根因分开;读取失败明确未检查,不停止其他独立候选,也不当作通过 |
| unhealthy report / issue 展示 | 健康 issue 在审核前生成、单语、每日时间戳驱动更新,并用评论关闭 |
健康结果 + Git 审核 + ZIP/Web/local 结果在审核后汇总为中英双语;复用原 upstream-health
issue,稳定托管区、无变化不编辑、不发评论,完整确认解决才关闭,新问题重开同一 issue。首次迁移保留 #213
现有手动双语内容为历史快照,托管区外人工内容保留;完整 JSON/日志保存在 audit-results 工件 |
| 自动合并的信任与最终 SHA 门禁 | 不能靠“有标签/有回执”证明可合并;原先还错误要求所有语言任务必须存在 | 只接受可信 main
重审得到的完整预期差异,检查当前 main 与最终 SHA;validate、translate、Copilot wait
为具名基线,实际存在的最新 CodeQL/Analyze、statuses、workflow runs
也必须完成且成功,适用检查缺失/失败/进行中均不放行。PR 自带 JSON 或任意标签不能授权 |
| 纯版本例外与真人审核 | 所有字节变化要求第二真人过宽,但也不能用版本号掩盖行为变化 | 保留可独立证明的 SKILL.md 顶层
semver-only 例外:其余字节、文件集和权限均相同才与完全相同 payload 一样无需额外行为批准;其他实质变化仍需最终 SHA
的有权限真人维护者审核,真人审核不能豁免独立机器门禁 |
| hold、冲突、凭据及发布身份 | 不能把配置不足或冲突伪装成更新成功 | hold / 双边修改 / 范围变化 /
未确认许可均暂停。实际发布与合并身份验证为 mashagua;MARKET_MAINTAINER_TOKEN 未配置时只审核,不冒用机器人发
PR。保留分支保护与预期 SHA squash,无 admin 绕过;每轮最多合并一项,本轮不执行合并 |

## 本轮真实案例与限制

- **#358 / Addy**:固定 `8c99fa36d90068c82d547f7c12a9d67a3e95f4ee` →
`e997ac5b9a74eab332d5e9793bb38a38c8cfdd74`。包括
`skills/api-and-interface-design` 在内,根主 MIT
通知未被证明随所选子目录交付;是旧版本已有的缺口。0.6.18 双语文案已由 #358 独立修复,不能把 main 的旧文案误称为该 PR
仍未修复。
- **#359 / Follow Builders**:旧 pin
`22c2e72e1a4bb0fc0f3e19f992fc55615b48989e` 的例外不自动覆盖
`65452b9258f31ed2893734c86481216d2e4105ff`。新 pin 的人工例外、22 文件真实回执及四个 JSON
数据变更由另一 worker 补审,现已合并 main;本 PR 已正常同步,未碰其分支。
- **#360 / Last30Days**:`331025e662756ca51e86dfddcf59969f6dba25a0` →
`7c2e1c2b099b13abd4397910168c4f53e638bb21`,范围
`skills/last30days`。主通知在目录外,bird-search vendor
许可不能替代;真实差异包含授权/配置/网络实现,依赖专项接受不代表完整行为复审。没有删除资源、缩范围或改变交付方式。
- **#361 / Matt Pocock**:上游仍为 `5863806dd4e15c63174bee4e7515a4256792ecfa`
→ `d65391149dbb5fe76478e76fa8d5122b2aa5a70e`;当前候选 head
`4cd8c6a4a31ef4512a871d15a355dd8dcf670cb0`
已补39成员、78条双语并处理34条历史英文回退。本轮实际只读复审确认:当前候选成员缺项0、英文回退0,但39/39安装目录仍未证明携带完整主
MIT 通知。独立 PR 复核记录为39目录109文件均无完整必要通知,旧38也已有缺口;因此保持 Draft,不伪造新回执。
- 对 main 旧登记重放的原失败仍是登记38/解析39;物理 SKILL 39→39、无新增/删除/移动,software-factory
仅因 YAML 修好重新可发现,chief-of-staff 描述另变,yaml 是根开发依赖。**这是历史 main
基线,不是说当前候选没补成员/翻译。**
- 当前候选 validate 真实失败;reviewedRef 不对应目标、旧 receipt.source.ref 不对应目标、旧
receipt.scope38 不覆盖39,是**未签新回执的三项派生错误**,不是三项新许可变更。translate、CodeQL、三个
Analyze 成功;Draft 的 Copilot wait 为 skipped,不称实质审核批准。先解决通知根因并真实复审,不能只改
ref/scope 凑绿灯。
-
证据:[当前PR实际复核说明](https://github.com/desirecore/market/blob/4cd8c6a4a31ef4512a871d15a355dd8dcf670cb0/docs/reviews/mattpocock-skills-pr361-d65391149dbb.md)
·
[JSON记录](https://github.com/desirecore/market/blob/4cd8c6a4a31ef4512a871d15a355dd8dcf670cb0/docs/reviews/mattpocock-skills-pr361-d65391149dbb.json)。


自动通知证明采用有界、保守的直接目录文本匹配;不声称覆盖一切合法非标准许可写法,也不代替真实安装回读或全部行为审查。客户端携带父级通知的实现需要另行授权,并让实际产物、摘要、锁记录、升级和回滚一致;本
PR 不跨仓修改客户端。


实现说明:[docs/upstream-audit-reporting.md](https://github.com/desirecore/market/blob/2bf76eade1644ff4b928c873cbb5d9139a322973/docs/upstream-audit-reporting.md)。现有报告:[issue
#213](https://github.com/desirecore/market/issues/213);当前手动双语不等于持久模板已部署,主线旧任务仍可能覆盖,须本
PR 经审核合入 main 后才生效。

## 最终 SHA 验证

最终
head:`2bf76eade1644ff4b928c873cbb5d9139a322973`。功能提交:`574f9c904da19eb4ce5c970c45b798bc6d3d3f72`、`e0d7ef0d936872f08d8fb6bd20166d98ddf46952`
与 `2bf76eade1644ff4b928c873cbb5d9139a322973`;正常 merge main 提交为
`950ae45cc985f8510a13eb9487896e1d516a8613`。新提交 author/committer 均为
`mashagua <993498039@qq.com>`。

- 完整 `pytest scripts`:**306 passed、397 subtests passed**;仅一条环境 pytest
插件弃用警告。
- `validate_catalog_metadata.py
--require-complete`、`validate-i18n.py`、`translate.py --check`、`git diff
--check`:全部 exit 0。目录原有治理/英文回退警告未冒称已修。
- 同一最终 SHA 的远程 **validate、translate、CodeQL、Analyze
(actions/python/javascript-typescript) 均 success**。
- `wait-for-copilot-review` 最新读取仍 **in_progress**,尚无 review 或行内评论;不冒称已完成
Copilot 审核。

不合并 #354,不部署;不修改 AI News Radar 的五条既有告警,不修改任何技能资源、结构、子项选择或安装方式。
This commit is contained in:
mashagua authored and GitHub committed 2026-11-26 16:45:09 +08:00
1 parent fbbbc63eac
commit 44ab34fe54
21 files changed
+2778 -85

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
# 上游审核与 unhealthy 报告 / Upstream audit and unhealthy reporting
本机制待 PR #354 合并到 main 后生效;本 PR 不自动合并或部署自身。报告不执行上游脚本,也不是运行验收或软件安全认证。
## 审核边界
- **仓库许可 ≠ 安装交付**:按 source.path 或每个 collection child.path 独立检查。MIT 的完整版权、授权及免责通知必须能与声明的主证据对应;vendor/LICENSE 或单行 SPDX 不能替代主项目通知。README/SKILL 内完整等效通知可以通过,不强求文件名 LICENSE。
- 自动证明仅识别所选目录直接包含的 LICENSE/COPYING/NOTICE/README/SKILL 中的完整等效文本;嵌套、改写、其他非标准许可证据可能被保守转人工,不能据此断言不存在合法许可。声明的 NOTICE 未证明交付会阻断;未声明根 NOTICE 的适用性需要人工确认。
- **精确 pin 例外**:旧 pin 接受过的单行 MIT 例外,即使 README 哈希不变,也不自动扩展到新 pin。新 pin 需要独立人工授权;本更新器不产生这种授权,不改变 listing-only 准入状态。
- **版本和双语**:用真实 SKILL frontmatter、明确插件 manifest 作为对应对象的版本证据;根插件版本不强加给所选子目录技能。只提示文案中出现的确切旧插件版本,需人工确认含义,不替换任意数字。同步检查 entry/catalog 的子项语言镜像;英文回退标为历史信息,不伪称已翻译。
- **直接 Git 对象差异**:报告安装范围完整路径差异,不依赖 GitHub compare 的 300 文件截断列表。授权/凭据/配置/网络相关命名的实现文件变化,保守转人工。这是复核提示,不是已证实漏洞,更不是全部行为审核。原有最终 SHA 的实际差异及真人行为审核门禁不变。
- **失败分层**:原流水线实际失败、失败点后的未完成阶段、独立静态发现、人工待审、历史遗留、本次引入分别展示。开发依赖与所选技能运行依赖不混为一谈;YAML 修复后的重新发现不叫新增物理文件。解析器不可靠时不得认定通过。
- **真实回执**:审核失败不生成成功回执;后续目录校验失败时恢复真实旧回执,独立保存失败命令与输出。ZIP/Web/local 的临时物化 Git ID 不暴露为真实来源 pin。
## 自动维护与稳定展示
日程、发布身份、凭据和最终 SHA 合并保护不变。Git 每轮最多审核 5 个新候选,另可只读复审 5 个已有 PR;不修改已有 PR 的内容。ZIP/Web/local 使用同一套保守门禁并输出真实结果。预算之外明确未检查。
Git 提案 coverage、ZIP/Web/local 的 tracked-results 和来源健康结果汇总为中英双语报告;工作流在提案审核之后同步原 upstream-health issue,并保留完整 audit-results 工件。大报告只截断 issue 展示,不截断 JSON 证据或声称省略部分已通过。
托管区为 `<!-- market-upstream-health:begin -->` 到 `<!-- market-upstream-health:end -->`。首次迁移把现有手动双语正文保留为明确标注的历史快照,之后只更新托管区,保留人工前后文。无时间戳/run URL 驱动的每日重复编辑,不发评论;无实质变化不更新。已解决且检查完整才关闭,出现新问题重开同一 issue;不完整、网络未知或未审核的更新不得闭环。原本 listing-only 或未登记版本源本身不是新失效,来源状态另行报告。
## 当前实例的核对口径
- #358:目标 e997ac5b9a74eab332d5e9793bb38a38c8cfdd74,26 个子项的根主 MIT 通知未被自动证明随所选目录交付;包括只有 SKILL.md 的 skills/api-and-interface-design。旧 pin 已有此缺口。0.6.18 文案另由 #358 修复,不把 main 旧文案当成本次新引入。
- #359:22c2e72e1a4bb0fc0f3e19f992fc55615b48989e 的旧例外不可自动继承到 65452b9258f31ed2893734c86481216d2e4105ff。另一个人工修复 PR 已为新 pin 补明确例外与 22 文件审计;这是新的人工决定,不是旧例外自动扩大。来源四个 JSON 数据文件变化不能授权放宽许可门槛。
- #360:所选 skills/last30days 不包含根主 MIT;bird-search 的 vendor 许可不是主通知。直接固定对象差异涉及授权/配置/网络实现,依赖哈希接受不代替行为审核。保持原来源、资源及安装方式。
- #361:物理 SKILL 39→39;软件工厂原文件 YAML 修好后重新可发现,使市场登记38与解析39不一致;chief-of-staff 简介及双语派生目录需复审;新增 yaml 是根开发依赖。实际原失败在 collection gate,后续未完成,不能写成全套测试通过。所选子项主通知交付还是独立的历史问题。
适用安装器证据由独立复核提供:desirecore dev `e817d57e819975052c5da610874b7747de18b7c8` 的 market-install.ts L406/L442、source-fetch.ts L578–581、skill-staging.ts L26–74 与 market.ts L424–455。当前未发现市场元数据能无声补父级通知的合法开关。任何客户端通知携带方案均需另行授权、摘要/锁记录覆盖和实际安装回读;本 PR 不跨仓实现、不改上游结构或资源。
## 已修订候选 PR 与可信 main 重放必须分开
已有 PR 的只读复审还读取精确 PR head 的 entry、sidecar、旧回执和实时检查;不 checkout 或执行候选代码,不信任这些 JSON 授权发布。表格标注 `trusted-main-replay` 与 `existing-pr-candidate@<head>`。对 main 旧登记重放的失败,不得说成已修订候选 PR 仍存在同样的旧文案/成员错误。
候选 reviewedRef 不匹配、receipt.source.ref 不匹配、receipt.source.paths 不覆盖当前登记,明确标记为“未签新回执的派生错误”;与安装通知缺口这个根本阻碍分层。实时检查失败另列,不把所有 CI 问题都归因于旧回执;未完成检查明确未完成。读取失败或检查超过分页预算不代表通过,也不阻塞其他独立候选继续被检查。
#361 后续修订 head `4cd8c6a4a31ef4512a871d15a355dd8dcf670cb0` 已补39成员、78条双语及历史回退说明;其真实文档见该 PR 的 `docs/reviews/mattpocock-skills-pr361-d65391149dbb.md` / `.json`。39个目录共109文件仍未携带必要完整主 MIT 通知(旧38也已有缺口),因此保持 Draft、不伪造新回执。旧 reviewedRef、旧回执 pin、38范围不足39属于未签回执的派生错误,不是额外三项上游许可变化。原38/解析39失败是 main 基线重放,不再说成此修订 head 未补成员。
+134
View File
@@ -0,0 +1,134 @@
# Verified upstream updates
This is update automation, not automatic first admission, runtime acceptance or a
security certification. The issue tracker remains enabled and is independent of
admission evidence. No credentials, private feeds or user tokens belong here.
## Trusted inputs and scope
* The daily upstream-health job still checks Git pointers. The Git proposer uses
exact old/new SHA, the existing delta auditor and the old admitted evidence.
* `config/verified-updates.v1.json` adds explicit tracking for non-pointer/local
sources. Currently registered: the owner-qualified ClawHub AMap package and
the local AI News Radar edition. No unregistered source is guessed.
* `clawhub` verifies the registered owner, gets an explicit stable latest version,
downloads its version-specific ZIP and verifies the old pinned digest again.
Registry MIT-0 metadata is **not** permission to override package MIT evidence.
* `github-file` resolves a configured repository/branch/path to an immutable
commit, then retrieves that exact raw file. This is the Web discovery adapter.
* `github-release` selects one explicitly configured asset from an actual stable
GitHub release, never an inferred version string. Mutable assets whose old
bytes no longer match the admitted digest are blocked.
* Automatic artifact auditing currently supports root-layout packages. A nested
install scope needs an explicitly reviewed layout adapter. Arbitrary hosts,
symlinks, executable ZIP entries, path traversal, duplicate/case-colliding
names, encrypted archives and over-budget artifacts fail closed.
* A new hash is identification only. Old/new bytes undergo the existing license,
notice, dependency, frontmatter and metadata delta audit. Receipts name the
actual SHA-256/upstream SHA; temporary Git objects only transport comparisons.
For a new Web source, add a reviewed tracking entry such as:
```json
{"adapter":"github-file","repo":"example/project","branch":"main","path":"SKILL.md"}
```
A release ZIP uses `adapter: github-release`, `repo`, and an exact `asset` name.
The old market pointer/digest/admission must already be valid. These examples do
not enable first-time installs or authorize any unreviewed source.
## Local editions
The local-git map records the exact upstream SHA, upstream path/hash, installed
path/hash/mode, and every market-only wrapper. No newly discovered files are
silently imported. Missing/moved files, added upstream license/notice obligations,
changed permissions and mapping drift block advancement. Unmodified imported
files can be replaced; a file changed by both upstream and market is a conflict,
never a blind overwrite. Market wrappers/translations remain intact.
AI News Radar tracks the actual upstream `master` branch. Its existing generator
and the five previously reported alerts are not changed by this tooling PR.
Real read-only discovery currently detects a conflict in locally formatted CSS
(`assets/styles.css`); the safe result is a draft/manual reconciliation, not
an overwritten wrapper or a claim that the newer upstream already passed.
## Publication and merge authority
Both publishers verify `gh api user` is `mashagua`; published commits use the
maintainer's designated identity. Configure an appropriately scoped maintainer
credential as the Actions secret `MARKET_MAINTAINER_TOKEN` through approved secret
management. This change neither creates nor reads credential values. With no
credential the workflows run audit/verification only; there is no bot-identity
fallback. Checkout credentials are not persisted; publishing uses an ephemeral
git credential helper environment. The issue-reporting step retains the normal
workflow token and its existing behavior.
The merge workflow runs after validation-related workflow completions, hourly
at minute 47, and manually. It only checks out **current main**, not PR files or
workflow artifacts; it never runs PR/upstream code. Labels and PR JSON are not
trust roots. For each same-repository maintainer update PR it:
1. Independently rediscovers/re-fetches the target and recomputes the complete
allowed proposal using trusted-main policy and special-review records.
2. Requires the complete PR diff to equal that result. Tooling/workflow changes,
changed review exceptions, foreign paths or forged receipts cannot enter.
3. Automatically clears byte/mode-identical installed payloads and proven
top-level `SKILL.md` semver-only changes (all other bytes, inventory and modes
identical). A version bump alone no longer needs a second human or a special
approval marker. This is not a behavioral security audit: instructions, scripts,
dependencies, license/NOTICE and install-scope changes are not covered by that
proof. Substantive installed-content changes still need an **APPROVED human
maintainer review on the exact head**, with:
`market-reviewed-no-expansion: <full-head-SHA>`.
The reviewer must be a different non-bot user with write/maintain/admin access;
stale/dismissed/self reviews do not count. This clearance cannot override
license, dependency, inventory, permission or receipt failures. No PR JSON,
label or timeout of the Copilot wait check serves as behavioral approval.
4. Requires all applicable check/context results complete and successful on the
exact final head, including mandatory validate, translate and Copilot wait. CodeQL/Analyze
are required to pass when actually scheduled, not required to exist on a
JSON-only update where GitHub does not schedule them; outstanding changes-requested reviews block. No ignored CodeQL failures.
5. Requires current-base ancestry, a clean server state, and active strict
server-side up-to-date rules for validate/translate to close the base race.
The merge API binds the expected head SHA, uses squash, and has no bypass.
6. Merges at most one PR per run, then stops because main has advanced. Behind
branches remain held for a normal merge update and new final-head checks.
Thus this does **not** promise unreviewed autonomous merging of arbitrary changed
skill scripts/prompts. A real exact-head human no-expansion review is the
additional behavioral authority; automation does not invent that attestation. This mechanism PR itself is outside the allowed diff and must
be reviewed/merged separately by a maintainer.
Daily discovery remains 09:23 Asia/Singapore (GitHub can delay execution). Git
and configured-source publishers each have a five-candidate cap. An existing
open PR for a skill is preserved, not overwritten; the same closed candidate is
not recreated. Discovery/audit/validation failures retain old admission and
become drafts/manual findings. Nothing automatically promotes listing-only.
## Offline checks
```sh
uv run scripts/catalog/validate_catalog_metadata.py --require-complete
uv run scripts/i18n/validate-i18n.py
uv run scripts/i18n/translate.py --check
uv run --with pytest --with jsonschema --with pyyaml --with 'lxml>=5.3,<7' --with 'defusedxml>=0.7' python -m pytest scripts
```
`uv run scripts/catalog/publish_tracked_updates.py` performs real discovery and
audit planning without publication. `merge_verified_updates.py` defaults to
verification-only and must run from current main; `--merge` additionally requires
the maintainer credential, collaborator-permission read access and every gate above. Do not run publishing/merge flags
as a smoke test against real PRs.
## Direction-review correction (2026-11-25)
The original implementation incorrectly required every CodeQL language job on
all updates, including JSON-pointer changes that do not schedule those jobs.
Only baseline jobs are mandatory by name; every latest applicable returned check,
status and workflow run must still succeed. No CodeQL failure is ignored.
The byte-change gate was also too broad: an independently proven SKILL version-only
change is now automatic. This deliberately does not promise that metadata checks
can prove arbitrary upstream script/instruction behavior safe. Expanding that
coverage needs a real behavioral review mechanism, not deletion of the safeguard.
Identity verification, trusted-main re-audit, local-patch preservation, finite
budgets, exact-head binding, strict server rules and no-admin/no-force stay intact.