Files
market/schemas/special-review.v1.schema.json
T
mashagua 58e25e1f97 feat(market): 专项复核支持客户端附加根通知与简介双语复核 (#374)
## 变更 / Changes

为 Class C 专项复核增加两个字段,以便在**不把根 LICENSE 存在视为安装交付、不发明许可例外、也不把旧简介或未更新的
shortDesc 延伸到新 pin**的前提下,记录:

1. `acceptedClientAttachedNotices`:接受已核验 DesireCore 客户端在安装合集子项时把根
`LICENSE` / `NOTICE` / `COPYING` 附进副本的真实安装回读。
2. `acceptedDescriptionAndLocales`:记录上游 `SKILL.md` 简介已变、市场条目中英
`shortDesc` 与 catalog 镜像已按新简介人工复核的证据。该字段只覆盖本身已有 shortDesc
的安装范围;合集根目录的市场简介不视为每个子项的派生文案。

这是完成
[desirecore/market#361](https://github.com/desirecore/market/pull/361)
所必需的审核能力,本身不改任何技能 pin。

对应客户端实现为
[desirecore/desirecore#6426](https://github.com/desirecore/desirecore/pull/6426)
squash 合入 `dev` 的 `28128a15b3abd76e1529b983ca8a921bdfe9ff30`(tree
`e8c1321e6a098eb905f4646b2027bc7b2259ca6b`)。当前 `dev`
已前移,但该修复仍在历史中且附加代码未被改动。后续 tip 不能自动视为同一实现。

## 安全边界 / Security boundaries

默认拒绝仍然成立。只有同时满足以下条件才会被接受:

- 记录必须包含真实的 `reviewedBy`、`reviewedAt` 和非空 `notes`。
- `acceptedClientAttachedNotices.sourceRef` 必须等于本次审核的新 pin 完整 40 位
SHA;`clientCommit` 必须是已核验的附加实现提交(当前仅 `28128a15…`);`noticeSha256`
必须与当前快照根通知字节一致;`scopes` 必须恰好等于全部安装范围并附子项安装回读。错 pin、错客户端 SHA /
tree、错根通知哈希、缺子项回读、不完整 MIT,以及仅有「将会附加」说明一律拒绝。
- `acceptedDescriptionAndLocales.fromRef` / `toRef` 必须等于本次审核的旧 / 新
pin;`files` 必须恰好覆盖上游简介已变且该范围本身已有双语副本的路径;每语种必须绑定已更新的 `shortDesc` 及其
SHA-256,英文简介必须覆盖新简介的特有词项,中文简介必须是与英文、旧简介不同的中文文案,catalog `summary` 必须与
entry 一致。错 pin、错路径、未更新或未匹配新简介的 shortDesc 一律不能通过,也不得自动延伸到新 pin。

本变更不执行上游代码,不代表安全认证或运行验收。#361 的正式快照 PR 会用正常 merge 把本分支合进对应快照分支,以便
required checks 能跑到新挂钩。本 PR 本身不含 #361 快照,也不自行合并。

## 验证 / Verification

- `PYTHONPATH=scripts/catalog uv run --with pytest --with jsonschema
--with pyyaml python -m pytest
scripts/catalog/test_audit_skill_update.py
scripts/catalog/test_update_diagnostics.py
scripts/catalog/test_validate_catalog_metadata.py`:**150 passed**(含 190
subtests)。正例为绑定当前 pin 与完整证据的接受;反例覆盖错 pin、错客户端 SHA /
tree、错根通知哈希、缺子项回读、错路径、未更新或未匹配新简介的 shortDesc、缺理由、不完整
MIT,以及仅有「将会附加」或「已复核」说明的情况。另有回归:合集根 i18n 不会单独要求没有 shortDesc
的子项通过简介字段。既有「根 LICENSE 不等于安装交付」用例保持失败。

Automated source/license/metadata verification tooling only. No
auto-merge of skill snapshot PRs in this change.
2026-11-27 10:06:36 +08:00

175 lines
9.6 KiB
JSON

{
"$schema": "https://json-schema.org/draft-07/schema#",
"$id": "https://desirecore.local/schemas/special-review.v1.schema.json",
"title": "Market Class C special review record",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion"],
"properties": {
"schemaVersion": { "const": 1 },
"reviewedBy": { "type": "string", "minLength": 1 },
"reviewedAt": { "type": "string", "minLength": 1 },
"notes": { "type": "string" },
"excludePaths": {
"type": "array",
"description": "Repo-relative paths or globs omitted from the audit tree walk only. Must not include LICENSE/NOTICE/COPYING or dependency manifests. The DesireCore installer does not honor this field until the client contract admits it.",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"budgetExemptPaths": {
"type": "array",
"description": "Repo-relative paths that remain in the audit manifest and must still be regular files, but may exceed MAX_FILE_BYTES. Prefer this for runtime data that must stay installed.",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"acceptedDependencyIdentities": {
"type": "object",
"description": "Map of dependency path to the identity key of the *new* snapshot: package.json is the SHA-256 of the manifest with version removed; other manifests use the git blob SHA.",
"additionalProperties": { "type": "string", "pattern": "^([a-f0-9]{40}|[a-f0-9]{64})$" }
},
"acceptedFrontmatterSha256": {
"type": "object",
"description": "Map of install path (empty string for a repo-root skill) to SHA-256 of stable_frontmatter(new SKILL.md).",
"additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
},
"acceptedRootEvidenceSha256": {
"type": "object",
"description": "Map of repo-root LICENSE/NOTICE/COPYING path to SHA-256 of the *new* snapshot file bytes. When root evidence changes, this map must exactly equal the added or changed paths; deletions of LICENSE/NOTICE/COPYING are never accepted.",
"additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
},
"acceptedCollectionPaths": {
"type": "array",
"description": "Exact set of new collection membership install paths when discovered children differ from the old entry. Must equal the discovered path set. Newly added members also require acceptedFrontmatterSha256 for that path.",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"acceptedScopedNotice": {
"type": "object",
"description": "Exact in-place additive NOTICE changes inside the install scope. LICENSE/COPYING, deletions, renames, new files, rewrites that drop existing bytes, globs, and root-level NOTICE (use acceptedRootEvidenceSha256) cannot be accepted here. fromRef/toRef must equal the audit's old and new snapshot SHAs, and files must be exactly the changed NOTICE paths with matching previous and new SHA-256 hashes.",
"additionalProperties": false,
"required": ["fromRef", "toRef", "files"],
"properties": {
"fromRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"toRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"files": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["path", "previousSha256", "sha256"],
"properties": {
"path": { "type": "string", "minLength": 1 },
"previousSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
}
}
}
}
},
"acceptedRootLicenseDirectoryManifestSha256": {
"type": "object",
"description": "Map of a repo-root LICENSE*/NOTICE*/COPYING* directory name (for example licenses) to the SHA-256 of the canonical JSON manifest of regular files under that directory at the *new* snapshot (sorted path to file SHA-256). Required when those directory file sets change, including renames. This does not accept changes to, replacements of, or deletions of root LICENSE/NOTICE/COPYING files (deletions remain forbidden; file changes still use acceptedRootEvidenceSha256). Symlinks, submodules, and other non-regular files at those root names or inside the directory remain blocked.",
"additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
},
"acceptedClientAttachedNotices": {
"type": "object",
"description": "Bound install-readback evidence that a verified DesireCore client commit attached collection/repo-root LICENSE/NOTICE/COPYING files into each selected install copy. This is not a license exception and does not treat a root file seen at audit time, or a future client change, as delivery. sourceRef must equal the audit's new pin; clientCommit must be an already-verified attach implementation (not a descendant tip by default); noticeSha256 must equal the regular root notice file at that pin; scopes must be exactly the install paths with per-copy attached name/sourceName/sha256 matching that root notice. The acceptance does not automatically extend to a later pin.",
"additionalProperties": false,
"required": ["sourceRef", "clientCommit", "noticeRootPath", "noticeSha256", "scopes"],
"properties": {
"sourceRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"clientCommit": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"clientTree": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"observedAt": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$" },
"noticeRootPath": { "type": "string", "minLength": 1 },
"noticeSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"scopes": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["path", "attached"],
"properties": {
"path": { "type": "string", "minLength": 1 },
"contentDigest": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"attached": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["name", "sourceName", "sha256"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"sourceName": { "type": "string", "minLength": 1 },
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
}
}
}
}
}
}
}
},
"acceptedDescriptionAndLocales": {
"type": "object",
"description": "Human review that market listing shortDesc/summary copy was updated to match a changed upstream SKILL.md description. Bound to the exact old and new pins and to each affected install path. Files must be exactly the description-changed scopes that already have locale copy. Each locale binds the reviewed shortDesc and its SHA-256, plus the previous listing text; the English/latin shortDesc must cover distinctive new-description terms, and zh-CN must be distinct CJK rather than a leftover English or old listing string. Catalog summary mirrors must match. This is not a generic exemption and does not automatically extend to a later pin.",
"additionalProperties": false,
"required": ["fromRef", "toRef", "files"],
"properties": {
"fromRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"toRef": { "type": "string", "pattern": "^[0-9a-f]{40}$" },
"files": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["path", "oldDescription", "newDescription", "newFrontmatterSha256", "locales"],
"properties": {
"path": { "type": "string" },
"oldDescription": { "type": "string", "minLength": 1 },
"newDescription": { "type": "string", "minLength": 1 },
"newFrontmatterSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"locales": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": ["shortDesc", "sha256", "previousShortDesc"],
"properties": {
"shortDesc": { "type": "string", "minLength": 1 },
"sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
"previousShortDesc": { "type": "string" }
}
}
}
}
}
}
}
}
},
"allOf": [
{
"if": { "required": ["acceptedScopedNotice"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
},
{
"if": { "required": ["acceptedRootLicenseDirectoryManifestSha256"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
},
{
"if": { "required": ["acceptedClientAttachedNotices"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
},
{
"if": { "required": ["acceptedDescriptionAndLocales"] },
"then": { "required": ["reviewedBy", "reviewedAt", "notes"] }
}
]
}