Release: accept and project the first public prerelease (marqdo 3.0.0-rc.7, Linux x86_64) #88
No files matched your search
@@ -129,7 +129,7 @@ python3 -m unittest discover -s tests/integration
|
||||
|
||||
`check-layout.py` 校验每层 catalog、gitlink、权威远端、全局 ID 和依赖图。`--checkouts` 同时核对递归检出的实际提交。`planned` 子模块提供固定开发快照,只有 `active` 组件进入发行验收。
|
||||
|
||||
[各仓库任务](docs/REPOSITORY-TASKS.md) · [组件目录](components.toml) · [架构边界](docs/ARCHITECTURE.md) · [开发流程](docs/DEVELOPMENT.md) · [迁移台账](docs/MIGRATION.md) · [架构决策记录](docs/adr/README.md) · [AGENTS](AGENTS.md)
|
||||
[各仓库任务](docs/REPOSITORY-TASKS.md) · [组件目录](components.toml) · [架构边界](docs/ARCHITECTURE.md) · [开发流程](docs/DEVELOPMENT.md) · [公开发行政策](docs/RELEASE-POLICY.md) · [迁移台账](docs/MIGRATION.md) · [架构决策记录](docs/adr/README.md) · [AGENTS](AGENTS.md)
|
||||
|
||||
旧版实现与文档可在历史标签查阅。 [v2.9.1 历史树](https://git.cflmy.cn/cflmy/marqdo/src/tag/v2.9.1)
|
||||
|
||||
|
||||
+1
-1
Submodule cli updated: afea4f9474...63562d8ff5.
@@ -94,6 +94,7 @@ bash scripts/integration.sh # 生态候选:真实 CLI 制品 +
|
||||
- 每份证据记录根及递归组件 SHA、制品摘要、真实命令、退出码、环境/工具链、日志、测试范围与未验证项。复用现有 manifest/evidence 模式,不复制成新的权威锁。
|
||||
- Git tree 是源码身份权威;Cargo.lock/`marqdo.lock`/现行 Bundle manifest 是对应依赖权威。记录不可变归档校验和、可信来源及获取方法;摘要校验不是发布者身份认证。
|
||||
- 基础发行包含同源 CLI、必需 Worker 与单一标准库 Bundle;不使用浮动 branch/标签名作为发布依据。发布失败保留日志,使用新候选;已有标签和资产保持不可变。回滚用新集成提交恢复上一组通过的 gitlink。
|
||||
- 公共预发布按“产品 × 平台 × 版本 × 实际能力范围”接受;适用范围化门禁、平台状态、延期记录与公开发行数据投影以 [公开发行政策](RELEASE-POLICY.md) 为准。本节的分层晋升用于候选集成,不表示每次 Beta/RC 都必须同时发布全部组件或全部平台;Stable 与多平台义务不因 Beta 的范围化接受而取消。
|
||||
|
||||
## Web 领域开发约束
|
||||
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
# 公开发行政策:按产品、平台与能力范围接受
|
||||
|
||||
本文是 Marqdo 主仓库唯一现行的**公共预发布(Beta/RC)与公开发行数据**政策。
|
||||
它落实 [marqdo#85](https://git.cflmy.cn/cflmy/marqdo/issues/85) 的范围化发行决定,
|
||||
并取代此前把“全部平台、全部 active 组件、全部 Stable 门禁”同时列为公共 Beta
|
||||
共同前置条件的表述。长期多平台目标、Stable/LTS 义务和真实证据标准不变。
|
||||
|
||||
## 1. 发行单位
|
||||
|
||||
一次公开发行只承诺**产品 × 平台 × 版本 × 实际能力范围**这一个四元组:
|
||||
|
||||
- 产品:本政策首期只覆盖 `marqdo` 基础发行(同源 CLI、必需的 Provider Worker
|
||||
与单一官方 Stdlib Bundle)。MQDH、独立 Tool/Ext 与知识资产按各自仓库和工单
|
||||
单独判断,不因本政策自动获得推荐资格。
|
||||
- 平台:只承诺该次发行真实验收过的目标(当前为 `x86_64-unknown-linux-gnu`,
|
||||
最低 glibc 2.39)。未纳入本次范围的其他平台保留真实状态,不得标为 supported。
|
||||
- 版本:各自仓库现行版本序列中的真实预发布版本;不得把 Beta/RC tag 标成 Stable,
|
||||
不得移动或重写已发布 tag,不得用同版本号发布不同字节。
|
||||
- 能力范围:该版本公开承诺的能力与明确关闭/未经验证的可选能力必须同时列出。
|
||||
|
||||
以下事实**相互独立、互不推导**:组件 CI 通过、组件真实发布、消费者/根仓集成
|
||||
验收通过、根仓接受为推荐发行、公开数据投影发布。
|
||||
|
||||
## 2. 渠道与版本
|
||||
|
||||
| 渠道 | 用途 | 版本形态 | 对外承诺 |
|
||||
| --- | --- | --- | --- |
|
||||
| Alpha | 研发/架构验证 | `-alpha.N` | 仅说明实验目的,不作为普通用户推荐 |
|
||||
| Beta | 公共测试与反馈 | `-beta.N` | 声明范围内可安装并完成核心操作,公开已知限制 |
|
||||
| RC | 面向明确正式版范围的候选 | `-rc.N` | 按拟发布 Stable 的门禁验收,不借 RC 规避门禁 |
|
||||
| Stable | 稳定发行 | 无预发布后缀 | 全部公开支持范围完成正式验收与维护承诺 |
|
||||
|
||||
- 渠道由真实版本字符串决定,并与 Gitea Release 的 prerelease 标记一致。
|
||||
已存在的合格 Beta/RC 按原渠道展示;需要新发行时创建新的不可变版本并重新验收。
|
||||
- 版本号由责任组件仓库决定,主仓库不另建全生态版本权威,也不手工维护“最新版本表”。
|
||||
- 一份接受记录只对应精确版本、平台、依赖组合、发行资产与验收证据;依赖或版本
|
||||
变化后必须重新接受。
|
||||
|
||||
## 3. 平台支持状态
|
||||
|
||||
| 状态 | 含义 | 是否可进入推荐发行 |
|
||||
| --- | --- | --- |
|
||||
| `supported` | 在真实目标环境完成本政策 B1 门禁 | 是 |
|
||||
| `build-verified` | 只验证了构建/交叉编译,未在目标环境真实运行 | 否 |
|
||||
| `experimental` | 维护者批准的受限实验分发(需单独政策) | 默认否 |
|
||||
| `unsupported` | 本次范围明确不支持 | 否 |
|
||||
| `not-applicable` | 该资产没有平台维度(如 `.sha256`、证据 JSON) | 不单独推荐 |
|
||||
|
||||
仅在其他平台完成测试不能替代当前平台的真实运行。容器可用于 Linux 指定 ABI/
|
||||
发行版证据;容器级 Windows 兼容运行(如 Wine)只能记为 `build-verified` 级
|
||||
补充证据,不得声明为原生 Windows 支持。
|
||||
|
||||
## 4. 门禁分级
|
||||
|
||||
### B0:公共发行底线(不得延期)
|
||||
|
||||
| 编号 | 要求 | 最低证据 |
|
||||
| --- | --- | --- |
|
||||
| B0-01 | 发布来源可信,tag 与实际源提交一致 | Gitea tag→SHA、同 SHA Woodpecker 流水线 |
|
||||
| B0-02 | 资产完整,发布字节与验收字节一致 | 资产名/大小/SHA256,下载回读 |
|
||||
| B0-03 | 无已知未控制的严重安全风险 | 安全相关检查与已知问题审查 |
|
||||
| B0-04 | 无已知严重数据损坏/不可恢复升级风险 | 真实使用路径测试;升级时给出恢复方案 |
|
||||
| B0-05 | 不绕过既有权限与隔离机制 | 权限负例、未授权拒绝、strict fail-closed |
|
||||
| B0-06 | 密钥、凭证、用户文稿与模型数据受保护 | 凭据扫描、日志与资产检查 |
|
||||
| B0-07 | 真实状态公开,不伪造 PASS/稳定性 | 发行说明、证据与公开数据一致 |
|
||||
| B0-08 | 有可用的反馈、诊断与安全报告路径 | Issue 入口、`inspect --environment` 导出 |
|
||||
| B0-09 | 未验证的自动安装/自动更新保持关闭 | 真实检查;人工下载路径可用 |
|
||||
| B0-10 | 撤回或摘要不符的资产不再提供/推荐 | 分发状态与公开数据撤回记录 |
|
||||
|
||||
### B1:当前范围必需门禁
|
||||
|
||||
对每个实际公开支持的产品/平台,必须在本机或真实受信环境实际执行并留证:
|
||||
|
||||
1. 固定源提交与依赖锁,独立构建通过;
|
||||
2. 实际目标平台安装、启动、版本读取与代表性核心操作通过;
|
||||
3. 核心单元/集成/必要负例测试真实通过;
|
||||
4. 发布产物可从官方来源下载,且与验收使用的字节摘要一致;
|
||||
5. 安装说明与依赖方式真实可用;
|
||||
6. 声明的能力在该平台可用,未验收能力明确关闭;
|
||||
7. 进入根仓推荐时,对精确锁定组合完成该产品/平台的集成验收;
|
||||
8. 权限、失败诊断与数据保护与该平台匹配。
|
||||
|
||||
### B2:明确延期项
|
||||
|
||||
不属于本次公开承诺,可在有真实原因、影响范围、隔离说明、责任工单和复核条件时
|
||||
延期;延期只改变本次发行决定,不改变测试结果的真实状态。
|
||||
|
||||
### S:Stable 补充门禁
|
||||
|
||||
全部正式支持平台的构建/运行验收、strict 一次性 VM PASS、专用固定性能节点、
|
||||
系统安装包签名/公证、代表性真实外部环境、真实用户反馈与维护承诺。公共 Beta/RC
|
||||
可以保留这些为后续义务,但不得伪造为已完成。
|
||||
|
||||
## 5. 发行阻塞的判定
|
||||
|
||||
- Issue 关闭数量不是发布门禁;每项阻塞必须写明影响的产品/平台/能力范围、
|
||||
是否在当前必需依赖闭包内、真实证据、责任仓库与复核条件。
|
||||
- 适用门禁必须 `PASS`;`UNVERIFIED`、`BLOCKED`、`FAIL` 不满足必需 PASS。
|
||||
与当前范围无关的延期项不参与该范围的 AND 判定,但必须保留真实状态。
|
||||
- 影响共享安全、ABI 或权限的失败不能按平台简单拆分,必须先分析影响再决定范围。
|
||||
|
||||
## 6. 接受记录
|
||||
|
||||
根仓接受一个推荐发行时,在 `docs/release-acceptance/` 增加一份记录
|
||||
(示例与字段校验见 `scripts/project-release.py`):
|
||||
|
||||
```text
|
||||
docs/release-acceptance/<product>-<platform>-<version>.json
|
||||
```
|
||||
|
||||
必备内容:
|
||||
|
||||
- `product`、`channel`、`version`、`platform`(target/OS/arch/最低运行时);
|
||||
- 精确的已发布组件清单:仓库、tag、源 SHA、`release-evidence.json` 摘要、
|
||||
已验证资产(名称/大小/SHA256/目标);
|
||||
- 该发行随附 Bundle 的组件身份(id + 源 SHA),必须与根 gitlink 一致;
|
||||
- 本次启用与明确排除的能力、实测门禁结果与证据链接;
|
||||
- 延期项(状态、范围、责任工单、原因、风险、复核条件);
|
||||
- 根投影使用的基线提交、公开接受记录 URL、根发行 URL、安装指南 URL;
|
||||
- `decision`(`accepted`/`rejected`)、`reviewer`、`accepted_at`。
|
||||
|
||||
接受记录必须满足:被接受组件的发布源 SHA = 该组件在根 Git tree 中的 gitlink;
|
||||
Bundle 记录的每个组件源 SHA = 根 gitlink;资产与 `release-evidence.json` 由
|
||||
`scripts/reconcile-releases.py --plan` 独立核验通过。任一条件不满足即拒绝推荐。
|
||||
|
||||
## 7. 公开发行数据投影
|
||||
|
||||
根仓是公开推荐数据的唯一生产者。`scripts/project-release.py` 从以下真实输入
|
||||
派生不可变快照与当前指针:
|
||||
|
||||
1. `scripts/reconcile-releases.py --plan --report-out` 的已核验发布事实;
|
||||
2. `docs/release-acceptance/` 中通过上述校验的接受记录;
|
||||
3. 固定根提交的递归组件目录(`components.toml` + gitlink + `.gitmodules`)。
|
||||
|
||||
输出遵循官网既有契约:
|
||||
|
||||
```text
|
||||
/data/current.json # 指针:revision、snapshot、sha256、verified_at
|
||||
/data/snapshots/<sha256>.json # 不可变快照:组件、发行、资产、offer、推荐、撤回
|
||||
```
|
||||
|
||||
规则:
|
||||
|
||||
- 只有 `integration_state = accepted` 的发行可以进入推荐;未被根仓接受的独立发行
|
||||
可出现在独立发行区,但不得自动进入推荐组合。
|
||||
- 未验收平台不提供普通用户下载;不把其他平台资产伪装成当前平台下载。
|
||||
- 新平台/新版本不覆盖已有合格平台的下载入口;撤回的发行/资产不得恢复推荐。
|
||||
- 数据快照不可变、指针单调递增;通知丢失或重复由现有 Reconcile/定时补偿处理。
|
||||
- 禁止建立第二套组件登记、版本表或发布服务;官网只读消费该投影。
|
||||
|
||||
## 8. CI 与权限边界
|
||||
|
||||
- 源码、Issue、Release 与真实资产由 Gitea 托管;**CI/CD 只使用 Woodpecker**,
|
||||
不新增 Gitea Actions 或第二套构建实现。
|
||||
- Reconcile 只读核验并协调追踪 Issue,不合并、不推送、不扩大权限。
|
||||
- 发布权限、签名密钥与真实模型 Secret 只在受保护流水线/维护者处;本政策不授予
|
||||
任何自动化发版权限。tag/Release 需要维护者在冻结 SHA 上明确批准。
|
||||
- 修复与发布失败保留真实日志,用新候选重试;已发布 tag/资产不可变。
|
||||
|
||||
## 9. 当前范围(首个公共预发布)
|
||||
|
||||
| 项 | 真实状态 |
|
||||
| --- | --- |
|
||||
| `marqdo` 基础发行 / Linux x86_64 (glibc ≥2.39) | 纳入首个公共预发布(`v3.0.0-rc.7`,RC 渠道),见 `docs/release-acceptance/` |
|
||||
| Windows x86_64 | `build-verified` + Wine 容器级运行 smoke;不提供公开下载,不是 supported |
|
||||
| macOS arm64 / x86_64 | `unsupported`(本预发布不承诺) |
|
||||
| Linux strict L1 | 本 RC 记为 `UNSUPPORTED`(同 SHA fail-closed 证据);Stable/LTS 需一次性 VM PASS |
|
||||
| G4 性能 | 共享节点 `WARN`(维护者 RC 例外);Stable/LTS 需专用固定节点 |
|
||||
| View / Lint / Knowledge / Prove 正式发行 | 独立跟踪,不阻塞 `marqdo` 基础发行 |
|
||||
| MQDH / AI 真实模型 | 独立跟踪;真实模型未验收前不发布 MQDH |
|
||||
| 官网生产数据接入 | 基于本投影;托管 `/data/` 接入由官网工单跟踪 |
|
||||
|
||||
## 10. 变更与回滚
|
||||
|
||||
- 本政策的修改走主仓库 PR;与既有 `docs/DEVELOPMENT.md`、组件发布文档冲突时以
|
||||
本文为准,并同步修订冲突段落,不并行维护两套现行门禁。
|
||||
- 回滚使用新的根集成提交恢复上一组通过的 gitlink;不改写已发布 tag/资产。
|
||||
- 已接受范围出现安全/数据问题或证据失效时,先阻断源下载,再更新分发状态与
|
||||
公开指针,并保留真实处理记录。
|
||||
@@ -0,0 +1,96 @@
|
||||
# 接受记录:首个公共预发布 Marqdo 基础发行 `3.0.0-rc.7`(Linux x86_64)
|
||||
|
||||
Date: 2026-12-02.
|
||||
责任仓库: `cflmy/marqdo-cli`(组件 `cli`),主仓库负责组合接受与公开发行投影。
|
||||
父工单: [marqdo#85](https://git.cflmy.cn/cflmy/marqdo/issues/85)。
|
||||
政策: [`docs/RELEASE-POLICY.md`](../RELEASE-POLICY.md)。
|
||||
|
||||
## 1. 决定
|
||||
|
||||
接受 `marqdo` 基础产品在 **Linux x86_64 / glibc ≥ 2.39** 上的
|
||||
`v3.0.0-rc.7` 预发布作为**首个公共预发布推荐组合**,渠道为 **RC**(真实版本
|
||||
字符串即渠道,不冒充 Beta/Stable)。Windows/macOS、MQDH/AI 与官网生产托管
|
||||
不属于本次接受范围,各自保留真实状态与独立工单。
|
||||
|
||||
本次接受的证据使用**真实 Gitea 发布资产 + 同 SHA Woodpecker 流水线 + 本地
|
||||
实际归档门禁**;未执行项在 §6 明确记录为 `UNVERIFIED`/`UNSUPPORTED`。
|
||||
|
||||
## 2. 发行身份
|
||||
|
||||
| 对象 | 身份 |
|
||||
| --- | --- |
|
||||
| CLI tag / 源提交 | `v3.0.0-rc.7` → `63562d8ff5b40334366761ff4d3644d0dd5b458d` |
|
||||
| 依赖输入根提交 | `857914a88d720fcb4a2bad8cee7ddec99e2ed420`(Bundle 0.3.0 生产者提交) |
|
||||
| 同 SHA CI | Woodpecker `cflmy/marqdo-cli` pipeline **#176**,`push`,全部步骤 success |
|
||||
| 归档 | `marqdo-3.0.0-rc.7-x86_64-unknown-linux-gnu.tar.gz`,4,927,204 bytes,sha256 `10714820c9620b1b7b0da59e8d3930fc71b769a722aa80ede6fa889659de4613` |
|
||||
| 校验文件 | `...tar.gz.sha256`,116 bytes,sha256 `204e08078d08b582b1ef5ba1aa145c02c8ac480cecf1b334fbdb752fc71c35ff` |
|
||||
| 发行索引 | `release-evidence.json`,1,417 bytes,sha256 `9d294608e55de814863b6b547c5b40f61a1cbffe1ccda853c80b0cbb06483580` |
|
||||
| 平台 | Linux x86_64,glibc 2.39 baseline(归档只在 Ubuntu 24.04 容器验收) |
|
||||
| Bundle | `marqdo-stdlib@0.3.0`,tree `sha256:4e47b0ff…`,aliases `sha256:5f513c0f…` |
|
||||
|
||||
发行索引记录的六个 Bundle 组件源提交与根 gitlink **逐项一致**:
|
||||
`std-collections 3c93856` · `std-data bcaa3b3` · `std-fs 91a4f8e` ·
|
||||
`std-io eb6432f` · `std-system a202a89` · `std-text cf359b9`。
|
||||
rc.6 的“发行依赖与根 gitlink 不一致”阻塞在本候选消除。
|
||||
|
||||
## 3. 已真实执行并通过的门禁
|
||||
|
||||
| 门禁 | 结果 | 证据 |
|
||||
| --- | --- | --- |
|
||||
| 同 SHA Woodpecker `main`(contract/test/independent-build/minimum-rust/build) | PASS | [pipeline #176](https://ci.cflmy.cn/repos/1/pipeline/176),commit `63562d8` |
|
||||
| 本地 `cargo fmt --all -- --check` | PASS | 构建容器(rust 1.100.0,`rust:1.100-bookworm` 同代镜像) |
|
||||
| 本地 `cargo clippy --workspace --all-targets -- -D warnings` | PASS | 同上 |
|
||||
| 本地 `cargo build --release --locked -p marqdo-cli -p marqdo-provider-worker` | PASS | `MARQDO_BUILD_SOURCE_SHA=63562d8…`,10.07s |
|
||||
| 确定性归档(同输入连续两次 `package.py`) | PASS | 两次花字节一致,sha256 `10714820…` |
|
||||
| 归档 `tools/release/smoke.py` | PASS | 版本/SHA/Bundle digest、check/run/call/lock/Tool/Worker/Foreign/Provider、strict fail-closed |
|
||||
| 归档-only 冷安装(Ubuntu 24.04 glibc 2.39、`--network none`、非 root、无 Cargo) | PASS | `tools/release/cold-install.sh` exit 0 |
|
||||
| 冻结外部 conformance(7 类) | PASS | `callable_registry`/`plugin_worker`/`foreign_kernel`/`resource_provider_cli`/`package_pinned_git`/`tool_analysis_consumer`/`negative_security` 全部 PASS |
|
||||
| Bundle 缺失 fail-closed | PASS | smoke:移走随附 `stdlib/` 后 `打印` 以 `kernel.unavailable` 拒绝 |
|
||||
| strict L1 | **UNSUPPORTED(本 RC)** | 同归档 smoke 在无 namespace/bubblewrap 环境 fail-closed;未声明隔离 PASS |
|
||||
| G4 性能(共享节点) | **WARN**:9/9 工作量 `MEASURED` 且 correctness `VERIFIED`;p50 相对 rc.5 变化 −1.85%~+6.16%(全部低于 15% 阈值);`factorial-run` 峰值 RSS +27.28% 超过 20% 审查阈值,已在 G4 报告中标记 investigate | `perf.json`(共享 powersave 节点、真实负载);**不是**专用节点 PASS |
|
||||
|
||||
## 4. 发布物与官方来源
|
||||
|
||||
- 归档与校验文件由 CLI 仓 Gitea Release `v3.0.0-rc.7` 提供;`release-evidence.json`
|
||||
由 `tools/release/release_index.py` 从**实际归档字节**、Bundle receipt 和
|
||||
pipeline #176 生成,并由根 `scripts/reconcile-releases.py --plan` 独立复核
|
||||
tag→SHA、资产大小、资产 SHA256、索引摘要与同 SHA CI。
|
||||
- 根仓接受记录(本文件)与公开发行数据投影由根仓生成;只有本记录接受的
|
||||
平台/版本可以进入官网推荐。
|
||||
|
||||
## 5. 公开发行数据投影
|
||||
|
||||
投影消费者契约不变:`/data/current.json` 指针 + `/data/snapshots/<sha256>.json`
|
||||
不可变快照,由 `scripts/project-release.py` 从
|
||||
`reconcile-releases.py --plan` 事实、本接受记录和固定根提交的递归组件目录生成。
|
||||
投影结果与官网 TypeScript 校验器同形(组件/发行/资产/offer/推荐/撤回),
|
||||
不新增第二套版本表或发布服务。
|
||||
|
||||
根仓 Release `v3.0.0-rc.7` 携带:接受记录、`current.json`、快照
|
||||
`snapshots/<sha256>.json`、`release-gates.json`、`reconcile-report.json`、
|
||||
冻结 conformance 清单与 G4 报告,作为本次接受不可变的公开证据。
|
||||
|
||||
## 6. 延期/未验证项(不参与本次 Linux 范围必需门禁)
|
||||
|
||||
| 项 | 真实状态 | 范围 | 责任/追踪 | 复核条件 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Windows x86_64 原生运行 | build-verified + Wine 容器级 smoke;**非 supported** | windows-x86_64 | marqdo-cli#26 | 原生 Windows runner 构建/运行/ABI 证据通过后单独接受 |
|
||||
| macOS arm64/x86_64 | UNSUPPORTED(本预发布不承诺) | macos | marqdo-cli#26 | 真实 macOS 构建与运行 lane |
|
||||
| Linux strict L1 隔离 | UNSUPPORTED(同 SHA fail-closed 已测) | linux-strict | marqdo-cli#13 / stable 门禁 | 一次性 VM、非 root、同 SHA PASS |
|
||||
| G4 性能 | 共享节点 WARN:9/9 correctness VERIFIED,p50 全部 <15%;1 项小工作量峰值 RSS +27.28% 超审查阈值,原因未在共享节点复测(避免占用开发机资源),标记为 investigate | linux-x86_64 | marqdo-cli#26 / stable 门禁 | 专用固定节点 paired-run PASS;RSS 异常项须定位或证明为环境噪声 |
|
||||
| 安装包/元数据签名 | unsigned(仅 SHA256 完整性) | distribution | marqdo#85 / stable 门禁 | 平台签名/公证与真实性验证 |
|
||||
| MQDH / AI 真实模型 | 不在本次接受范围 | app/ai | marqdo#57、app-harness、ext-ai | 受保护真实模型 E2E PASS 后独立发布 |
|
||||
| 官网生产 `/data/` 托管接入 | 数据已生成并公开为根 Release 资产;生产域名托管接入未在本记录验证 | website | marqdo#83/#84 | 匿名下载/摘要/安装 smoke 与撤回演练通过 |
|
||||
|
||||
## 7. 未验证声明
|
||||
|
||||
- 本记录不声称 Windows/macOS 支持、不声称 strict 隔离 PASS、不声称专用节点性能 PASS。
|
||||
- 本记录不断言官网生产页面已消费本次投影;该闭环由官网工单以真实部署证据确认。
|
||||
- 历史 rc.6 及其之前发布不被本次接受追溯改变;新版本或依赖变化后必须重新接受。
|
||||
|
||||
## 8. 回滚
|
||||
|
||||
若本候选被拒绝:根仓恢复 `cli` gitlink 到上一接受提交 `afea4f9`
|
||||
(rc.6 之后、本候选之前的根固定组合),重新生成投影并以新的 revision 更新指针;
|
||||
已发布 tag/资产保持不可变,不回写、不覆盖。若已公开数据出现安全问题,先阻断
|
||||
源下载,再更新分发状态与公开指针。
|
||||
@@ -0,0 +1,170 @@
|
||||
{
|
||||
"acceptance_url": "https://git.cflmy.cn/cflmy/marqdo/releases/download/v3.0.0-rc.7/release-acceptance.json",
|
||||
"accepted_at": "2026-12-02T06:35:00Z",
|
||||
"channel": "rc",
|
||||
"components": [
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"name": "marqdo-3.0.0-rc.7-x86_64-unknown-linux-gnu.tar.gz",
|
||||
"sha256": "10714820c9620b1b7b0da59e8d3930fc71b769a722aa80ede6fa889659de4613",
|
||||
"size": 4927204,
|
||||
"target": "x86_64-unknown-linux-gnu"
|
||||
},
|
||||
{
|
||||
"name": "marqdo-3.0.0-rc.7-x86_64-unknown-linux-gnu.tar.gz.sha256",
|
||||
"sha256": "204e08078d08b582b1ef5ba1aa145c02c8ac480cecf1b334fbdb752fc71c35ff",
|
||||
"size": 116,
|
||||
"target": "x86_64-unknown-linux-gnu"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
{
|
||||
"id": "std-collections",
|
||||
"source_sha": "3c93856bf5c5c2a051edc6ab786f484fd0291237"
|
||||
},
|
||||
{
|
||||
"id": "std-data",
|
||||
"source_sha": "bcaa3b38a2ea9c17409a20d54fd1ea3832444c04"
|
||||
},
|
||||
{
|
||||
"id": "std-fs",
|
||||
"source_sha": "91a4f8ea3a8e6b34c62383fc82a7dffc0b2fd691"
|
||||
},
|
||||
{
|
||||
"id": "std-io",
|
||||
"source_sha": "eb6432f563bf8cb71f885021bdd926b763b45bd9"
|
||||
},
|
||||
{
|
||||
"id": "std-system",
|
||||
"source_sha": "a202a89ef4a4505254d54a9275dd3eb3289a209b"
|
||||
},
|
||||
{
|
||||
"id": "std-text",
|
||||
"source_sha": "cf359b9aa0e8a07e13224cf0858d0bc32fbc45ce"
|
||||
}
|
||||
],
|
||||
"id": "cli",
|
||||
"release": {
|
||||
"index_sha256": "9d294608e55de814863b6b547c5b40f61a1cbffe1ccda853c80b0cbb06483580",
|
||||
"repository": "cflmy/marqdo-cli",
|
||||
"source_sha": "63562d8ff5b40334366761ff4d3644d0dd5b458d",
|
||||
"tag": "v3.0.0-rc.7"
|
||||
}
|
||||
}
|
||||
],
|
||||
"decision": "accepted",
|
||||
"deferred": [
|
||||
{
|
||||
"item": "windows-native-runtime-and-abi",
|
||||
"reason": "no native Windows runner in the release environment; only container-level Wine smoke exists",
|
||||
"revisit": "next candidate after a native Windows build/run lane passes",
|
||||
"risk": "not reachable from the accepted Linux archive; no Windows asset is published or recommended",
|
||||
"scope": "windows-x86_64",
|
||||
"state": "UNVERIFIED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo-cli/issues/26"
|
||||
},
|
||||
{
|
||||
"item": "macos-native-build-and-runtime",
|
||||
"reason": "no macOS runner in this release cycle",
|
||||
"revisit": "next candidate after a real macOS lane passes",
|
||||
"risk": "outside the accepted scope; no macOS asset is published or recommended",
|
||||
"scope": "macos-arm64-and-x86_64",
|
||||
"state": "UNVERIFIED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo-cli/issues/26"
|
||||
},
|
||||
{
|
||||
"item": "strict-l1-disposable-vm-pass",
|
||||
"reason": "the release environment cannot create the required namespaces; the packaged binary fails closed",
|
||||
"revisit": "stable/LTS gate requires a same-SHA disposable-VM non-root PASS",
|
||||
"risk": "strict is not claimed for this RC; no fallback to an unrestricted process was observed",
|
||||
"scope": "linux-x86_64-strict",
|
||||
"state": "UNSUPPORTED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo-cli/issues/13"
|
||||
},
|
||||
{
|
||||
"item": "dedicated-node-performance-pass",
|
||||
"reason": "measurements ran on a shared powersave host with real load; one small-workload RSS delta stayed above the 20% review threshold",
|
||||
"revisit": "stable/LTS requires a dedicated fixed node with the full paired-run protocol",
|
||||
"risk": "no p50 regression above 15% and correctness VERIFIED; the shared-node WARN is not a dedicated-node PASS and does not carry over to stable/LTS",
|
||||
"scope": "linux-x86_64-performance",
|
||||
"state": "WARN",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo-cli/issues/26"
|
||||
},
|
||||
{
|
||||
"item": "installer-and-release-metadata-signing",
|
||||
"reason": "no signing key or platform notarization is available for this prerelease",
|
||||
"revisit": "stable gate for signed installers/authenticity verification",
|
||||
"risk": "only SHA256 integrity is claimed; automatic installation remains disabled and the documentation says so",
|
||||
"scope": "distribution",
|
||||
"state": "UNVERIFIED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo/issues/85"
|
||||
},
|
||||
{
|
||||
"item": "mqdh-and-ai-real-model-release",
|
||||
"reason": "no real-model E2E acceptance in this release cycle",
|
||||
"revisit": "protected real-model workflow PASS before any MQDH/AI release",
|
||||
"risk": "outside the marqdo base scope; no MQDH/AI artifact is published or recommended",
|
||||
"scope": "app-and-ai",
|
||||
"state": "UNVERIFIED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo/issues/57"
|
||||
},
|
||||
{
|
||||
"item": "website-production-data-hosting",
|
||||
"reason": "the projection is published as immutable root release assets; the production /data/ hosting wiring is owned by the website tickets",
|
||||
"revisit": "anonymous production download/digest/install smoke and withdrawal drill",
|
||||
"risk": "the website remains in its documented pending-data state; no fabricated download is displayed",
|
||||
"scope": "website",
|
||||
"state": "UNVERIFIED",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo/issues/83"
|
||||
}
|
||||
],
|
||||
"enabled_capabilities": [
|
||||
"linux-x86_64-glibc2.39",
|
||||
"check",
|
||||
"run",
|
||||
"call",
|
||||
"inspect",
|
||||
"inspect-environment-json",
|
||||
"document-outline-read",
|
||||
"analysis-v3",
|
||||
"observation-v1",
|
||||
"tool-protocol-v1",
|
||||
"plugin-abi-v1-native-and-worker",
|
||||
"foreign-kernel-v1",
|
||||
"resource-provider-v2",
|
||||
"stdlib-bundle-0.3.0"
|
||||
],
|
||||
"excluded_capabilities": [
|
||||
"Windows/macOS native support (build-verified container-level only / unsupported)",
|
||||
"strict L1 OS isolation (UNSUPPORTED for this RC; fail-closed only)",
|
||||
"dedicated-node performance PASS (shared-host RC WARN only)",
|
||||
"OS installer or release-metadata signing",
|
||||
"automatic install/update",
|
||||
"MQDH, AI real-model and optional Tool/Ext releases"
|
||||
],
|
||||
"install_guide_url": "https://git.cflmy.cn/cflmy/marqdo-cli/src/tag/v3.0.0-rc.7/docs/developers/quickstart.md",
|
||||
"platform": {
|
||||
"arch": "x86_64",
|
||||
"minimum_runtime": "glibc 2.39",
|
||||
"os": "linux",
|
||||
"target": "x86_64-unknown-linux-gnu"
|
||||
},
|
||||
"product": "marqdo",
|
||||
"required_gates": {
|
||||
"clean_install": "PASS: archive-only Ubuntu 24.04 glibc 2.39, non-root, no network",
|
||||
"extension": "PASS: frozen external conformance 7/7",
|
||||
"linux": "PASS: woodpecker pipeline 176",
|
||||
"macos": "UNSUPPORTED: excluded from this release scope",
|
||||
"performance": "WARN: shared-host paired rc.5 comparison, 9/9 correctness verified; not a dedicated-node PASS",
|
||||
"strict_vm": "UNSUPPORTED: same-archive fail-closed evidence; disposable-VM PASS is a stable/LTS gate",
|
||||
"version_compat": "PASS: workspace tests in pipeline 176",
|
||||
"windows": "UNSUPPORTED: container-level Wine smoke only, no public asset"
|
||||
},
|
||||
"reviewer": "cflmy (maintainer, scope decision in marqdo#85, 2026-12-02)",
|
||||
"root_base_sha": "857914a88d720fcb4a2bad8cee7ddec99e2ed420",
|
||||
"root_release_url": "https://git.cflmy.cn/cflmy/marqdo/releases/tag/v3.0.0-rc.7",
|
||||
"schema": "marqdo.release-acceptance",
|
||||
"schema_version": 1,
|
||||
"version": "3.0.0-rc.7"
|
||||
}
|
||||
@@ -0,0 +1,542 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Project the public release snapshot from verified release facts.
|
||||
|
||||
The root repository is the only producer of the public recommendation data.
|
||||
This script combines three real inputs and refuses to guess anything:
|
||||
|
||||
1. `scripts/reconcile-releases.py --plan --report-out` facts: the tag -> source
|
||||
SHA, `release-evidence.json` digest and asset bytes were verified against
|
||||
Gitea and Woodpecker for the exact published release;
|
||||
2. an acceptance record under `docs/release-acceptance/`: the maintainer-approved
|
||||
product x platform x version x capability scope. Its components must be
|
||||
pinned by the root Git tree at exactly the published source SHA and its
|
||||
Bundle dependencies must match the root gitlinks;
|
||||
3. the recursive component catalog at the projected root commit
|
||||
(`components.toml` + gitlinks + `.gitmodules`).
|
||||
|
||||
Output follows the website's existing read-only contract
|
||||
(`/data/current.json` pointer plus one immutable
|
||||
`/data/snapshots/<sha256>.json`). The script never tags, publishes, writes to
|
||||
Gitea or promotes a component release; it only emits the projection bytes and
|
||||
fails closed when a fact is missing or inconsistent.
|
||||
|
||||
Usage:
|
||||
|
||||
python3 scripts/project-release.py \
|
||||
--root . \
|
||||
--root-sha "$(git rev-parse HEAD)" \
|
||||
--reconcile-report reconcile-report.json \
|
||||
--acceptance docs/release-acceptance/marqdo-linux-x86_64-3.0.0-rc.7.json \
|
||||
--generated-at 2026-12-02T06:30:00Z \
|
||||
--revision 0 \
|
||||
--out-dir dist/public-data
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
|
||||
import impact
|
||||
|
||||
FORGE = "https://git.cflmy.cn"
|
||||
CI = "https://ci.cflmy.cn"
|
||||
SNAPSHOT_SCHEMA_VERSION = 1
|
||||
POINTER_SCHEMA_VERSION = 1
|
||||
ACCEPTANCE_SCHEMA = "marqdo.release-acceptance"
|
||||
ACCEPTANCE_SCHEMA_VERSION = 1
|
||||
RECONCILE_SCHEMA = "marqdo.release-reconcile.v1"
|
||||
SHA = re.compile(r"[0-9a-f]{40}")
|
||||
HEX = re.compile(r"[a-f0-9]{64}")
|
||||
ID = re.compile(r"[a-zA-Z0-9][a-zA-Z0-9._:@/+~-]{0,199}")
|
||||
BASENAME = re.compile(r"[a-zA-Z0-9][a-zA-Z0-9._+~-]{0,199}")
|
||||
TAG = re.compile(r"v[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?")
|
||||
CHANNELS = ("stable", "alpha", "beta", "rc")
|
||||
PRODUCTS = ("marqdo", "mqdh")
|
||||
KINDS = ("core", "tool", "stdlib", "extension", "domain", "app", "test")
|
||||
STATES = ("active", "planned")
|
||||
RELEASES = ("base", "optional", "none")
|
||||
DECISIONS = ("accepted", "rejected")
|
||||
|
||||
|
||||
class ProjectionError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def fail(message: str) -> "NoReturn":
|
||||
raise ProjectionError(message)
|
||||
|
||||
|
||||
def require(condition: bool, message: str) -> None:
|
||||
if not condition:
|
||||
fail(message)
|
||||
|
||||
|
||||
def official_url(value, what: str) -> str:
|
||||
require(isinstance(value, str), f"{what} must be a string")
|
||||
prefix = value.split("//", 1)[0] if "//" in value else ""
|
||||
require(prefix == "https:", f"{what} must be https: {value!r}")
|
||||
require(not any(ch in value for ch in "%\\ "), f"{what} must not contain encoded/space paths")
|
||||
origin = value.split("/", 3)[:3]
|
||||
require("/".join(origin) in (FORGE, CI, "https://marqdo.com"), f"{what} has a non-official origin: {value}")
|
||||
require(not value.endswith("/") or value.count("/") > 3, f"{what} must name a path")
|
||||
return value
|
||||
|
||||
|
||||
def read_json(path: Path) -> dict:
|
||||
try:
|
||||
value = json.loads(path.read_text(encoding="utf-8"))
|
||||
except (OSError, UnicodeDecodeError, json.JSONDecodeError) as error:
|
||||
fail(f"cannot read {path}: {error}")
|
||||
require(isinstance(value, dict), f"{path} must contain a JSON object")
|
||||
return value
|
||||
|
||||
|
||||
def stamp(value: str, what: str) -> str:
|
||||
try:
|
||||
parsed = datetime.datetime.fromisoformat(value.replace("Z", "+00:00"))
|
||||
except (AttributeError, TypeError, ValueError) as error:
|
||||
fail(f"{what} is not ISO-8601: {error}")
|
||||
require(parsed.tzinfo is not None, f"{what} must carry a time zone")
|
||||
return value
|
||||
|
||||
|
||||
def utc_z(value: str, what: str) -> str:
|
||||
"""Normalize an ISO-8601 timestamp to the website contract (`...Z`)."""
|
||||
stamp(value, what)
|
||||
parsed = datetime.datetime.fromisoformat(value.replace("Z", "+00:00")).astimezone(datetime.timezone.utc)
|
||||
return parsed.replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
||||
|
||||
|
||||
def channel_of(version: str) -> str:
|
||||
require(isinstance(version, str) and TAG.fullmatch(f"v{version}"), f"invalid release version {version!r}")
|
||||
suffix = version.split("-", 1)[1] if "-" in version else ""
|
||||
if not suffix:
|
||||
return "stable"
|
||||
label = suffix.split(".", 1)[0]
|
||||
require(label in ("alpha", "beta", "rc"), f"unknown prerelease label {label!r}")
|
||||
return label
|
||||
|
||||
|
||||
def load_acceptance(path: Path) -> dict:
|
||||
record = read_json(path)
|
||||
required = {
|
||||
"schema", "schema_version", "product", "channel", "version", "platform",
|
||||
"root_base_sha", "acceptance_url", "root_release_url", "install_guide_url",
|
||||
"components", "enabled_capabilities", "excluded_capabilities",
|
||||
"required_gates", "deferred", "decision", "reviewer", "accepted_at",
|
||||
}
|
||||
require(set(record) >= required, f"{path}: missing acceptance fields {sorted(required - set(record))}")
|
||||
extra = set(record) - required - {"notes"}
|
||||
require(not extra, f"{path}: unknown acceptance fields {sorted(extra)}")
|
||||
require(record["schema"] == ACCEPTANCE_SCHEMA and record["schema_version"] == ACCEPTANCE_SCHEMA_VERSION,
|
||||
f"{path}: unsupported acceptance schema")
|
||||
require(record["product"] in PRODUCTS, f"{path}: invalid product")
|
||||
require(record["channel"] in CHANNELS, f"{path}: invalid channel")
|
||||
require(channel_of(record["version"]) == record["channel"],
|
||||
f"{path}: channel {record['channel']} does not match version {record['version']}")
|
||||
require(record["decision"] in DECISIONS, f"{path}: invalid decision")
|
||||
stamp(record["accepted_at"], f"{path}: accepted_at")
|
||||
require(isinstance(record["reviewer"], str) and record["reviewer"].strip(), f"{path}: reviewer is required")
|
||||
for field in ("acceptance_url", "root_release_url", "install_guide_url"):
|
||||
official_url(record[field], f"{path}: {field}")
|
||||
require(isinstance(record["root_base_sha"], str) and SHA.fullmatch(record["root_base_sha"]),
|
||||
f"{path}: root_base_sha must be a full commit SHA")
|
||||
platform = record["platform"]
|
||||
require(isinstance(platform, dict) and set(platform) >= {"target", "os", "arch"},
|
||||
f"{path}: platform needs target/os/arch")
|
||||
require(isinstance(platform["target"], str) and BASENAME.fullmatch(platform["target"]),
|
||||
f"{path}: invalid platform target")
|
||||
require(isinstance(platform.get("minimum_runtime"), str), f"{path}: platform.minimum_runtime is required")
|
||||
require(isinstance(record["enabled_capabilities"], list) and record["enabled_capabilities"],
|
||||
f"{path}: enabled_capabilities is required")
|
||||
require(isinstance(record["excluded_capabilities"], list), f"{path}: excluded_capabilities must be a list")
|
||||
require(isinstance(record["components"], list) and record["components"], f"{path}: components are required")
|
||||
require(isinstance(record["required_gates"], dict), f"{path}: required_gates must be an object")
|
||||
require(isinstance(record["deferred"], list), f"{path}: deferred must be a list")
|
||||
for item in record["deferred"]:
|
||||
require(isinstance(item, dict) and set(item) >= {"item", "state", "scope", "tracker", "reason", "risk", "revisit"},
|
||||
f"{path}: deferred item is missing fields")
|
||||
official_url(item["tracker"], f"{path}: deferred tracker")
|
||||
for component in record["components"]:
|
||||
require(isinstance(component, dict) and set(component) >= {"id", "release"},
|
||||
f"{path}: accepted component needs id/release")
|
||||
release = component["release"]
|
||||
require(isinstance(release, dict) and set(release) >= {"repository", "tag", "source_sha", "index_sha256"},
|
||||
f"{path}: accepted release needs repository/tag/source_sha/index_sha256")
|
||||
require(isinstance(release["repository"], str) and re.fullmatch(r"cflmy/[A-Za-z0-9-]+", release["repository"]),
|
||||
f"{path}: invalid release repository")
|
||||
require(isinstance(release["tag"], str) and TAG.fullmatch(release["tag"]), f"{path}: invalid release tag")
|
||||
require(release["tag"] == f"v{record['version']}", f"{path}: release tag does not match version")
|
||||
require(isinstance(release["source_sha"], str) and SHA.fullmatch(release["source_sha"]),
|
||||
f"{path}: invalid release source SHA")
|
||||
require(isinstance(release["index_sha256"], str) and HEX.fullmatch(release["index_sha256"]),
|
||||
f"{path}: invalid release evidence digest")
|
||||
require(isinstance(record["platform"]["target"], str), f"{path}: missing platform target")
|
||||
return record
|
||||
|
||||
|
||||
def load_report(path: Path) -> dict:
|
||||
report = read_json(path)
|
||||
require(report.get("schema") == RECONCILE_SCHEMA and report.get("schema_version") == 1,
|
||||
f"{path}: unsupported reconcile report")
|
||||
require(report.get("scan_complete") is True, f"{path}: release scan is not complete")
|
||||
require(isinstance(report.get("root_sha"), str) and SHA.fullmatch(report["root_sha"]),
|
||||
f"{path}: invalid root_sha")
|
||||
require(isinstance(report.get("results"), list), f"{path}: results must be a list")
|
||||
return report
|
||||
|
||||
|
||||
def select_component(graph: dict[str, dict], component_id: str, pins: dict[str, str]) -> dict:
|
||||
require(component_id in graph, f"acceptance names unknown component {component_id!r}")
|
||||
require(component_id in pins, f"component {component_id!r} has no gitlink")
|
||||
return graph[component_id]
|
||||
|
||||
|
||||
def verified_release(report: dict, repository: str, tag: str) -> dict:
|
||||
matches = [item for item in report["results"]
|
||||
if item.get("repository") == repository and item.get("tag") == tag]
|
||||
require(len(matches) == 1, f"reconcile report does not contain exactly one {repository} {tag}")
|
||||
entry = matches[0]
|
||||
require(entry.get("status") in {"pending", "tracked"},
|
||||
f"{repository} {tag} is not a verified release: {entry.get('status')} {entry.get('error', '')}".strip())
|
||||
return entry
|
||||
|
||||
|
||||
def normalize(entry: dict) -> dict:
|
||||
"""Drop the reconcile bookkeeping and keep the verified public facts."""
|
||||
return {
|
||||
"repository": entry["repository"],
|
||||
"tag": entry["tag"],
|
||||
"source_sha": entry["source_sha"],
|
||||
"index_sha256": entry["index_sha256"],
|
||||
"ci": entry["ci"],
|
||||
"assets": sorted(entry["assets"], key=lambda asset: asset["name"]),
|
||||
"dependencies": sorted(entry["dependencies"], key=lambda dep: dep["id"]),
|
||||
"published_at": entry["published_at"],
|
||||
}
|
||||
|
||||
|
||||
def validate(acceptance: dict, report: dict, graph: dict[str, dict], pins: dict[str, str]) -> list[dict]:
|
||||
require(acceptance["decision"] == "accepted", "only an accepted record can be projected")
|
||||
target = acceptance["platform"]["target"]
|
||||
releases = []
|
||||
covered = set()
|
||||
for component in acceptance["components"]:
|
||||
component_id = component["id"]
|
||||
identity = select_component(graph, component_id, pins)
|
||||
require(identity["state"] == "active", f"component {component_id!r} is not active")
|
||||
release = component["release"]
|
||||
pinned = pins[component_id]
|
||||
require(pinned == release["source_sha"],
|
||||
f"{component_id}: released source {release['source_sha']} != root gitlink {pinned}")
|
||||
entry = normalize(verified_release(report, release["repository"], release["tag"]))
|
||||
require(entry["source_sha"] == release["source_sha"],
|
||||
f"{component_id}: reconcile source SHA mismatch")
|
||||
require(entry["index_sha256"] == release["index_sha256"],
|
||||
f"{component_id}: release evidence digest mismatch")
|
||||
accepted_assets = component.get("assets")
|
||||
if accepted_assets is not None:
|
||||
require(isinstance(accepted_assets, list) and accepted_assets,
|
||||
f"{component_id}: assets must be a non-empty list")
|
||||
published = {(item["name"], item["size"], item["sha256"], item["target"]) for item in entry["assets"]}
|
||||
accepted = {(item.get("name"), item.get("size"), item.get("sha256"), item.get("target"))
|
||||
for item in accepted_assets}
|
||||
require(accepted == published, f"{component_id}: accepted assets do not match the published release")
|
||||
for asset in entry["assets"]:
|
||||
require(asset["target"] == target,
|
||||
f"{component_id}: asset {asset['name']} target {asset['target']} != {target}")
|
||||
for dependency in entry["dependencies"]:
|
||||
require(dependency["id"] in graph, f"{component_id}: unknown Bundle dependency {dependency['id']!r}")
|
||||
require(pins.get(dependency["id"]) == dependency["source_sha"],
|
||||
f"{component_id}: Bundle dependency {dependency['id']} {dependency['source_sha']} "
|
||||
f"!= root gitlink {pins.get(dependency['id'])}")
|
||||
covered.add(component_id)
|
||||
releases.append({**entry, "component": component_id})
|
||||
|
||||
# Every declared requirement of an accepted component must be covered by
|
||||
# another accepted release or by a verified Bundle dependency.
|
||||
dependencies = {dep["id"] for release in releases for dep in release["dependencies"]}
|
||||
required = set()
|
||||
for component_id in covered:
|
||||
required |= close_over(graph, component_id) - {component_id}
|
||||
missing = required - covered - dependencies
|
||||
require(not missing, f"accepted scope misses required components: {sorted(missing)}")
|
||||
return releases
|
||||
|
||||
|
||||
def close_over(graph: dict[str, dict], component_id: str) -> set[str]:
|
||||
seen: set[str] = set()
|
||||
pending = list(graph[component_id].get("requires", []))
|
||||
while pending:
|
||||
current = pending.pop()
|
||||
require(current in graph, f"unknown component reference {current!r}")
|
||||
if current in seen:
|
||||
continue
|
||||
seen.add(current)
|
||||
pending.extend(graph[current].get("requires", []))
|
||||
return seen
|
||||
|
||||
|
||||
def load_components(repo: Path, revision: str) -> tuple[list[dict], dict[str, str]]:
|
||||
rows: list[dict] = []
|
||||
pins: dict[str, str] = {}
|
||||
seen: set[str] = set()
|
||||
|
||||
def walk(path: Path, sha: str, depth: int) -> None:
|
||||
catalog = impact.read_catalog(path, sha, "root" if depth == 0 else path.name)
|
||||
entries = impact.tree_entries(path, sha)
|
||||
urls = impact.submodule_urls(path, sha)
|
||||
for component in catalog:
|
||||
component_id = component.get("id")
|
||||
component_path = component.get("path")
|
||||
require(isinstance(component_id, str) and ID.fullmatch(component_id), f"invalid component id {component_id!r}")
|
||||
require(isinstance(component_path, str) and component_path, f"{component_id}: invalid path")
|
||||
require(component_id not in seen, f"duplicate component id {component_id}")
|
||||
seen.add(component_id)
|
||||
require(component.get("kind") in KINDS, f"{component_id}: invalid kind")
|
||||
require(component.get("state") in STATES, f"{component_id}: invalid state")
|
||||
require(component.get("release") in RELEASES, f"{component_id}: invalid release class")
|
||||
require(isinstance(component.get("scope"), str) and component["scope"].strip(), f"{component_id}: missing scope")
|
||||
requires = component.get("requires", [])
|
||||
checks_with = component.get("checks_with", [])
|
||||
require(isinstance(requires, list) and isinstance(checks_with, list), f"{component_id}: invalid references")
|
||||
mode_sha = entries.get(component_path)
|
||||
pin = mode_sha[1] if mode_sha and mode_sha[0] == "160000" else None
|
||||
row = {
|
||||
"id": component_id,
|
||||
"kind": component["kind"],
|
||||
"state": component["state"],
|
||||
"scope": component["scope"],
|
||||
"requires": list(requires),
|
||||
"checks_with": list(checks_with),
|
||||
"release": component["release"],
|
||||
"repository": (urls.get(component_path) or "").removesuffix(".git") or None,
|
||||
}
|
||||
rows.append(row)
|
||||
if pin:
|
||||
pins[component_id] = pin
|
||||
if component["kind"] == "domain" and depth == 0 and pin:
|
||||
domain = path / component_path
|
||||
require((domain / ".git").exists(),
|
||||
f"active domain {component_id} cannot be expanded: missing checkout")
|
||||
walk(domain, pin, depth + 1)
|
||||
|
||||
walk(repo, revision, 0)
|
||||
by_id = {row["id"]: row for row in rows}
|
||||
for row in rows:
|
||||
for reference in row["requires"] + row["checks_with"]:
|
||||
require(reference in by_id, f"{row['id']}: dangling component reference {reference!r}")
|
||||
if row["state"] == "active":
|
||||
require(row["repository"], f"active component {row['id']} has no public repository")
|
||||
return rows, pins
|
||||
|
||||
|
||||
def release_id(component_id: str, version: str) -> str:
|
||||
return f"{component_id}-{version}"
|
||||
|
||||
|
||||
def asset_kind(name: str) -> str:
|
||||
if name.endswith(".tar.gz"):
|
||||
return "archive"
|
||||
if name.endswith(".sha256"):
|
||||
return "checksum"
|
||||
if name.endswith(".json"):
|
||||
return "evidence"
|
||||
return "manifest"
|
||||
|
||||
|
||||
def asset_platform(kind: str, target: str) -> str:
|
||||
return "supported" if kind == "archive" else "not-applicable"
|
||||
|
||||
|
||||
def build_snapshot(acceptance: dict, report: dict, components: list[dict], pins: dict[str, str],
|
||||
releases: list[dict], generated_at: str) -> dict:
|
||||
version = acceptance["version"]
|
||||
channel = acceptance["channel"]
|
||||
target = acceptance["platform"]["target"]
|
||||
runtime = [f"Linux x86_64 ({target})", acceptance["platform"]["minimum_runtime"]]
|
||||
|
||||
release_rows = []
|
||||
asset_ids: dict[str, list[str]] = {}
|
||||
offer_primary: list[str] = []
|
||||
for release in releases:
|
||||
component_id = release["component"]
|
||||
rid = release_id(component_id, version)
|
||||
asset_rows = []
|
||||
for asset in release["assets"]:
|
||||
kind = asset_kind(asset["name"])
|
||||
aid = f"{rid}-{asset['name']}"
|
||||
require(ID.fullmatch(aid), f"invalid asset id {aid}")
|
||||
row = {
|
||||
"asset_id": aid,
|
||||
"name": asset["name"],
|
||||
"size": asset["size"],
|
||||
"sha256": asset["sha256"],
|
||||
"target": asset["target"],
|
||||
"kind": kind,
|
||||
"download_url": f"{FORGE}/{release['repository']}/releases/download/{release['tag']}/{asset['name']}",
|
||||
"platform_status": asset_platform(kind, asset["target"]),
|
||||
"runtime_requirements": runtime if kind == "archive" else [],
|
||||
"signature_state": "unsigned",
|
||||
}
|
||||
asset_rows.append(row)
|
||||
if kind == "archive":
|
||||
offer_primary.append(aid)
|
||||
require(offer_primary, f"{component_id}: accepted release has no archive asset")
|
||||
asset_ids[rid] = [row["asset_id"] for row in asset_rows]
|
||||
release_rows.append({
|
||||
"release_id": rid,
|
||||
"component_id": component_id,
|
||||
"version": version,
|
||||
"tag": release["tag"],
|
||||
"channel": channel,
|
||||
"source_sha": release["source_sha"],
|
||||
"published_at": utc_z(release["published_at"], "published_at"),
|
||||
"release_url": f"{FORGE}/{release['repository']}/releases/tag/{release['tag']}",
|
||||
"evidence_url": f"{FORGE}/{release['repository']}/releases/download/{release['tag']}/release-evidence.json",
|
||||
"evidence_sha256": release["index_sha256"],
|
||||
"distribution_state": "available",
|
||||
"integration_state": "accepted",
|
||||
"assets": asset_rows,
|
||||
})
|
||||
|
||||
by_component = {component["id"]: component for component in components}
|
||||
members = []
|
||||
for release_row in release_rows:
|
||||
component_id = release_row["component_id"]
|
||||
members.append({
|
||||
"release_id": release_row["release_id"],
|
||||
"installation": "included",
|
||||
"asset_ids": asset_ids[release_row["release_id"]],
|
||||
})
|
||||
require(component_id in by_component, f"accepted release {component_id} is not in the catalog")
|
||||
|
||||
offer_id = f"{acceptance['product']}-{version}-{target}"
|
||||
offer = {
|
||||
"offer_id": offer_id,
|
||||
"product": acceptance["product"],
|
||||
"version": version,
|
||||
"channel": channel,
|
||||
"target": target,
|
||||
"acceptance_ref": acceptance["acceptance_url"],
|
||||
"root_release_ref": acceptance["root_release_url"],
|
||||
"primary_asset_ids": offer_primary,
|
||||
"components": members,
|
||||
"supported": True,
|
||||
"distribution_state": "available",
|
||||
"known_limitations": [str(item) for item in acceptance["excluded_capabilities"]],
|
||||
"install_guide_url": acceptance["install_guide_url"],
|
||||
}
|
||||
snapshot = {
|
||||
"schema_version": SNAPSHOT_SCHEMA_VERSION,
|
||||
"snapshot_revision": None, # filled by write_outputs
|
||||
"root_source_sha": report["root_sha"],
|
||||
"generated_at": utc_z(generated_at, "generated_at"),
|
||||
"source_evidence_refs": sorted({
|
||||
*(row["release_url"] for row in release_rows),
|
||||
*(row["evidence_url"] for row in release_rows),
|
||||
*(row["ci"]["url"] for row in releases),
|
||||
acceptance["acceptance_url"],
|
||||
acceptance["root_release_url"],
|
||||
}),
|
||||
"components": sorted(components, key=lambda row: row["id"]),
|
||||
"releases": sorted(release_rows, key=lambda row: row["release_id"]),
|
||||
"offers": [offer],
|
||||
"recommendations": [{
|
||||
"product": acceptance["product"],
|
||||
"channel": channel,
|
||||
"target": target,
|
||||
"offer_id": offer_id,
|
||||
}],
|
||||
"withdrawals": [],
|
||||
}
|
||||
return snapshot
|
||||
|
||||
|
||||
def write_outputs(out_dir: Path, snapshot: dict, revision: int, verified_at: str) -> dict:
|
||||
require(revision >= 0, "revision must be non-negative")
|
||||
pointer_path = out_dir / "current.json"
|
||||
if pointer_path.exists():
|
||||
existing = read_json(pointer_path)
|
||||
current = existing.get("revision")
|
||||
require(isinstance(current, int) and revision == current + 1,
|
||||
f"existing pointer revision {current} requires revision {current + 1}, got {revision}")
|
||||
else:
|
||||
require(revision == 0, "first publication must use revision 0")
|
||||
snapshot["snapshot_revision"] = revision
|
||||
body = (json.dumps(snapshot, ensure_ascii=False, indent=2, sort_keys=True) + "\n").encode("utf-8")
|
||||
digest = hashlib.sha256(body).hexdigest()
|
||||
snapshot_dir = out_dir / "snapshots"
|
||||
snapshot_dir.mkdir(parents=True, exist_ok=True)
|
||||
target = snapshot_dir / f"{digest}.json"
|
||||
require(not target.exists() or target.read_bytes() == body,
|
||||
f"snapshot {digest} already exists with different bytes")
|
||||
target.write_bytes(body)
|
||||
pointer = {
|
||||
"schema_version": POINTER_SCHEMA_VERSION,
|
||||
"revision": revision,
|
||||
"snapshot": f"/data/snapshots/{digest}.json",
|
||||
"sha256": digest,
|
||||
"verified_at": utc_z(verified_at, "verified_at"),
|
||||
}
|
||||
pointer_path.write_text(json.dumps(pointer, ensure_ascii=False, indent=2, sort_keys=True) + "\n",
|
||||
encoding="utf-8")
|
||||
return {"pointer": pointer, "snapshot_path": str(target), "revision": revision}
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--root", type=Path, default=Path(__file__).resolve().parents[1])
|
||||
parser.add_argument("--root-sha", required=True)
|
||||
parser.add_argument("--reconcile-report", type=Path, required=True)
|
||||
parser.add_argument("--acceptance", type=Path, required=True)
|
||||
parser.add_argument("--generated-at", required=True)
|
||||
parser.add_argument("--verified-at", default=None)
|
||||
parser.add_argument("--revision", type=int, required=True)
|
||||
parser.add_argument("--out-dir", type=Path, required=True)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
root = args.root.resolve()
|
||||
root_sha = impact.resolve(root, args.root_sha)
|
||||
require(SHA.fullmatch(root_sha), "--root-sha must resolve to a full commit SHA")
|
||||
stamp(args.generated_at, "--generated-at")
|
||||
verified_at = args.verified_at or args.generated_at
|
||||
stamp(verified_at, "--verified-at")
|
||||
|
||||
try:
|
||||
acceptance = load_acceptance(args.acceptance)
|
||||
report = load_report(args.reconcile_report)
|
||||
require(report["root_sha"] == root_sha,
|
||||
f"reconcile report root {report['root_sha']} != projected root {root_sha}")
|
||||
try:
|
||||
impact.git(root, "merge-base", "--is-ancestor", acceptance["root_base_sha"], root_sha)
|
||||
except impact.ImpactError:
|
||||
fail(f"root_base_sha {acceptance['root_base_sha']} is not an ancestor of {root_sha}")
|
||||
components, pins = load_components(root, root_sha)
|
||||
graph = {row["id"]: {**row, "sha": pins.get(row["id"])} for row in components}
|
||||
releases = validate(acceptance, report, graph, pins)
|
||||
snapshot = build_snapshot(acceptance, report, components, pins, releases,
|
||||
args.generated_at)
|
||||
result = write_outputs(args.out_dir, snapshot, args.revision, verified_at)
|
||||
except ProjectionError as error:
|
||||
print(f"project-release: {error}", file=sys.stderr)
|
||||
return 1
|
||||
print(json.dumps({"schema": "marqdo.public-release-projection.v1",
|
||||
"root_source_sha": root_sha,
|
||||
"product": acceptance["product"],
|
||||
"version": acceptance["version"],
|
||||
"channel": acceptance["channel"],
|
||||
"target": acceptance["platform"]["target"],
|
||||
**result}, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
@@ -0,0 +1,388 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Tests for the public release projection (`scripts/project-release.py`)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SCRIPT = ROOT / "scripts" / "project-release.py"
|
||||
CLI_SHA = "1" * 40
|
||||
STD_SHA = "2" * 40
|
||||
TARGET = "x86_64-unknown-linux-gnu"
|
||||
VERSION = "3.0.0-rc.7"
|
||||
ARCHIVE = f"marqdo-{VERSION}-{TARGET}.tar.gz"
|
||||
INDEX_DIGEST = "a" * 64
|
||||
ARCHIVE_DIGEST = "b" * 64
|
||||
CHECKSUM_DIGEST = "c" * 64
|
||||
EVIDENCE_DIGEST = "d" * 64
|
||||
|
||||
|
||||
def git(repo: Path, *args: str) -> str:
|
||||
return subprocess.run(["git", "-C", str(repo), *args], check=True, capture_output=True,
|
||||
text=True).stdout.strip()
|
||||
|
||||
|
||||
def commit_file(repo: Path, name: str, content: str) -> str:
|
||||
(repo / name).write_text(content, encoding="utf-8")
|
||||
git(repo, "add", name)
|
||||
git(repo, "-c", "user.name=test", "-c", "user.email=test@example.com", "commit", "-q", "-m", name)
|
||||
return git(repo, "rev-parse", "HEAD")
|
||||
|
||||
|
||||
def nested_commit(directory: Path) -> str:
|
||||
directory.mkdir(parents=True)
|
||||
git(directory, "init", "-q")
|
||||
return commit_file(directory, "payload.txt", "payload\n")
|
||||
|
||||
|
||||
def catalog() -> str:
|
||||
return """\
|
||||
[[component]]
|
||||
id = "cli"
|
||||
path = "cli"
|
||||
kind = "core"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "language and runtime"
|
||||
requires = []
|
||||
checks_with = ["conformance"]
|
||||
release = "base"
|
||||
entry = "tools/release/smoke.py"
|
||||
|
||||
[[component]]
|
||||
id = "conformance"
|
||||
path = "tests/conformance"
|
||||
kind = "test"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "public contract tests"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "none"
|
||||
entry = "scripts/build_all.sh"
|
||||
|
||||
[[component]]
|
||||
id = "std-data"
|
||||
path = "stdlib/data"
|
||||
kind = "stdlib"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "data modules"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
entry = "scripts/ci.sh"
|
||||
"""
|
||||
|
||||
|
||||
def gitmodules() -> str:
|
||||
return """\
|
||||
[submodule "cli"]
|
||||
path = cli
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-cli.git
|
||||
[submodule "tests/conformance"]
|
||||
path = tests/conformance
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-extension-conformance.git
|
||||
[submodule "stdlib/data"]
|
||||
path = stdlib/data
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-std-data.git
|
||||
"""
|
||||
|
||||
|
||||
def release_entry(**overrides) -> dict:
|
||||
entry = {
|
||||
"component": "cli",
|
||||
"path": "cli",
|
||||
"repository": "cflmy/marqdo-cli",
|
||||
"tag": f"v{VERSION}",
|
||||
"published_at": "2026-12-02T05:00:00+00:00",
|
||||
"accepted_sha": CLI_SHA,
|
||||
"component_state": "active",
|
||||
"status": "pending",
|
||||
"source_sha": CLI_SHA,
|
||||
"index_sha256": INDEX_DIGEST,
|
||||
"ci": {
|
||||
"pipeline_number": 176,
|
||||
"url": "https://ci.cflmy.cn/repos/1/pipeline/176",
|
||||
"source_sha": CLI_SHA,
|
||||
},
|
||||
"assets": [
|
||||
{"name": ARCHIVE, "size": 4927204, "target": TARGET, "sha256": ARCHIVE_DIGEST},
|
||||
{"name": ARCHIVE + ".sha256", "size": 116, "target": TARGET, "sha256": CHECKSUM_DIGEST},
|
||||
{"name": "release-evidence.json", "size": 1200, "target": TARGET, "sha256": EVIDENCE_DIGEST},
|
||||
],
|
||||
"dependencies": [{"id": "std-data", "source_sha": STD_SHA}],
|
||||
}
|
||||
entry.update(overrides)
|
||||
return entry
|
||||
|
||||
|
||||
def loaded_assets() -> list[dict]:
|
||||
return json.loads(json.dumps(release_entry()["assets"]))
|
||||
|
||||
|
||||
def acceptance(**overrides) -> dict:
|
||||
record = {
|
||||
"schema": "marqdo.release-acceptance",
|
||||
"schema_version": 1,
|
||||
"product": "marqdo",
|
||||
"channel": "rc",
|
||||
"version": VERSION,
|
||||
"platform": {
|
||||
"target": TARGET,
|
||||
"os": "linux",
|
||||
"arch": "x86_64",
|
||||
"minimum_runtime": "glibc 2.39",
|
||||
},
|
||||
"root_base_sha": "0" * 40,
|
||||
"acceptance_url": f"https://git.cflmy.cn/cflmy/marqdo/releases/download/v{VERSION}/release-acceptance.json",
|
||||
"root_release_url": f"https://git.cflmy.cn/cflmy/marqdo/releases/tag/v{VERSION}",
|
||||
"install_guide_url": f"https://git.cflmy.cn/cflmy/marqdo-cli/src/tag/v{VERSION}/docs/developers/quickstart.md",
|
||||
"components": [{
|
||||
"id": "cli",
|
||||
"release": {
|
||||
"repository": "cflmy/marqdo-cli",
|
||||
"tag": f"v{VERSION}",
|
||||
"source_sha": CLI_SHA,
|
||||
"index_sha256": INDEX_DIGEST,
|
||||
},
|
||||
"assets": loaded_assets(),
|
||||
}],
|
||||
"enabled_capabilities": ["check", "run", "call", "inspect", "stdlib-bundle"],
|
||||
"excluded_capabilities": ["Windows/macOS native support", "strict L1 isolation"],
|
||||
"required_gates": {
|
||||
"linux": "PASS",
|
||||
"strict_vm": "UNSUPPORTED",
|
||||
"extension": "PASS",
|
||||
"clean_install": "PASS",
|
||||
},
|
||||
"deferred": [{
|
||||
"item": "windows-runtime-verification",
|
||||
"state": "UNVERIFIED",
|
||||
"scope": "windows-x86_64",
|
||||
"tracker": "https://git.cflmy.cn/cflmy/marqdo-cli/issues/26",
|
||||
"reason": "no native Windows runner in this release environment",
|
||||
"risk": "not reachable from the accepted Linux asset",
|
||||
"revisit": "next candidate",
|
||||
}],
|
||||
"decision": "accepted",
|
||||
"reviewer": "cflmy",
|
||||
"accepted_at": "2026-12-02T06:00:00Z",
|
||||
}
|
||||
record.update(overrides)
|
||||
return record
|
||||
|
||||
|
||||
class Fixture:
|
||||
"""A tiny committed governance tree with real gitlinks."""
|
||||
|
||||
def __init__(self, root: Path):
|
||||
self.root = root
|
||||
root.mkdir(parents=True, exist_ok=True)
|
||||
git(root, "init", "-q")
|
||||
commit_file(root, "components.toml", catalog())
|
||||
commit_file(root, ".gitmodules", gitmodules())
|
||||
subprocess.run(["git", "-C", str(root), "update-index", "--add", "--cacheinfo",
|
||||
f"160000,{CLI_SHA},cli"], check=True)
|
||||
subprocess.run(["git", "-C", str(root), "update-index", "--add", "--cacheinfo",
|
||||
f"160000,{STD_SHA},stdlib/data"], check=True)
|
||||
git(root, "-c", "user.name=test", "-c", "user.email=test@example.com",
|
||||
"commit", "-q", "-m", "fixture gitlinks")
|
||||
self.base = git(root, "rev-parse", "HEAD~1")
|
||||
self.head = git(root, "rev-parse", "HEAD")
|
||||
|
||||
def write(self, name: str, value: dict) -> Path:
|
||||
path = self.root.parent / name
|
||||
path.write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
return path
|
||||
|
||||
|
||||
def run_projection(tmp: Path, fixture: Fixture, record: dict, report: dict,
|
||||
revision: int = 0, out_name: str = "out", generated_at: str = "2026-12-02T06:30:00Z"):
|
||||
acceptance_path = fixture.write("acceptance.json", record)
|
||||
report_path = fixture.write("reconcile.json", report)
|
||||
out = tmp / out_name
|
||||
result = subprocess.run([
|
||||
sys.executable, str(SCRIPT),
|
||||
"--root", str(fixture.root),
|
||||
"--root-sha", fixture.head,
|
||||
"--reconcile-report", str(report_path),
|
||||
"--acceptance", str(acceptance_path),
|
||||
"--generated-at", generated_at,
|
||||
"--revision", str(revision),
|
||||
"--out-dir", str(out),
|
||||
], capture_output=True, text=True)
|
||||
return result, out
|
||||
|
||||
|
||||
class ProjectReleaseTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
base = ROOT / ".build" / "test-project-release"
|
||||
base.mkdir(parents=True, exist_ok=True)
|
||||
self._tmp = tempfile.TemporaryDirectory(dir=base)
|
||||
self.tmp = Path(self._tmp.name)
|
||||
self.fixture = Fixture(self.tmp / "repo")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self._tmp.cleanup()
|
||||
|
||||
def report(self, **entry_overrides) -> dict:
|
||||
return {
|
||||
"schema": "marqdo.release-reconcile.v1",
|
||||
"schema_version": 1,
|
||||
"root_repository": "cflmy/marqdo",
|
||||
"root_sha": self.fixture.head,
|
||||
"scan_complete": True,
|
||||
"results": [release_entry(**entry_overrides)],
|
||||
}
|
||||
|
||||
def acceptance(self, **overrides) -> dict:
|
||||
return acceptance(root_base_sha=self.fixture.base, **overrides)
|
||||
|
||||
def test_happy_path_emits_pointer_and_immutable_snapshot(self) -> None:
|
||||
result, out = run_projection(self.tmp, self.fixture, self.acceptance(), self.report())
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
pointer = json.loads((out / "current.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual(pointer["revision"], 0)
|
||||
self.assertEqual(pointer["schema_version"], 1)
|
||||
snapshot_bytes = (out / pointer["snapshot"].removeprefix("/data/")).read_bytes()
|
||||
self.assertEqual(hashlib.sha256(snapshot_bytes).hexdigest(), pointer["sha256"])
|
||||
snapshot = json.loads(snapshot_bytes)
|
||||
self.assertEqual(snapshot["snapshot_revision"], 0)
|
||||
self.assertEqual(snapshot["root_source_sha"], self.fixture.head)
|
||||
self.assertEqual([row["id"] for row in snapshot["components"]],
|
||||
["cli", "conformance", "std-data"])
|
||||
release = snapshot["releases"][0]
|
||||
self.assertEqual(release["integration_state"], "accepted")
|
||||
self.assertEqual(release["source_sha"], CLI_SHA)
|
||||
self.assertEqual(snapshot["recommendations"][0]["channel"], "rc")
|
||||
self.assertEqual(snapshot["offers"][0]["primary_asset_ids"],
|
||||
[release["assets"][0]["asset_id"]])
|
||||
asset = release["assets"][0]
|
||||
self.assertEqual(asset["platform_status"], "supported")
|
||||
self.assertEqual(asset["kind"], "archive")
|
||||
self.assertEqual([row["platform_status"] for row in release["assets"][1:]],
|
||||
["not-applicable", "not-applicable"])
|
||||
# The acceptance URL and the verified release are traceable facts.
|
||||
self.assertIn(self.acceptance()["acceptance_url"], snapshot["source_evidence_refs"])
|
||||
self.assertIn(release["evidence_url"], snapshot["source_evidence_refs"])
|
||||
|
||||
def test_projection_is_deterministic_for_the_same_facts(self) -> None:
|
||||
first, out_a = run_projection(self.tmp, self.fixture, self.acceptance(), self.report(),
|
||||
out_name="a")
|
||||
second, out_b = run_projection(self.tmp, self.fixture, self.acceptance(), self.report(),
|
||||
out_name="b")
|
||||
self.assertEqual(first.returncode, 0, first.stderr)
|
||||
self.assertEqual(second.returncode, 0, second.stderr)
|
||||
pointer = json.loads((out_a / "current.json").read_text(encoding="utf-8"))
|
||||
digest = pointer["sha256"]
|
||||
self.assertEqual((out_b / f"snapshots/{digest}.json").read_bytes(),
|
||||
(out_a / f"snapshots/{digest}.json").read_bytes())
|
||||
self.assertEqual((out_b / "current.json").read_bytes(),
|
||||
(out_a / "current.json").read_bytes())
|
||||
|
||||
def test_rejects_source_sha_not_pinned_by_root(self) -> None:
|
||||
record = self.acceptance()
|
||||
record["components"][0]["release"]["source_sha"] = "9" * 40
|
||||
result, _ = run_projection(self.tmp, self.fixture, record, self.report())
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("!= root gitlink", result.stderr)
|
||||
|
||||
def test_rejects_bundle_dependency_not_pinned_by_root(self) -> None:
|
||||
result, _ = run_projection(
|
||||
self.tmp, self.fixture, self.acceptance(),
|
||||
self.report(dependencies=[{"id": "std-data", "source_sha": "9" * 40}]))
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("Bundle dependency std-data", result.stderr)
|
||||
|
||||
def test_rejects_unverified_release(self) -> None:
|
||||
result, _ = run_projection(self.tmp, self.fixture, self.acceptance(),
|
||||
self.report(status="blocked", error="asset digest mismatch"))
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("not a verified release", result.stderr)
|
||||
|
||||
def test_rejects_blocked_scan(self) -> None:
|
||||
report = self.report()
|
||||
report["scan_complete"] = False
|
||||
result, _ = run_projection(self.tmp, self.fixture, self.acceptance(), report)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("scan is not complete", result.stderr)
|
||||
|
||||
def test_rejects_channel_version_mismatch(self) -> None:
|
||||
result, _ = run_projection(self.tmp, self.fixture,
|
||||
self.acceptance(channel="beta"), self.report())
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("does not match version", result.stderr)
|
||||
|
||||
def test_rejects_asset_digest_mismatch_between_acceptance_and_release(self) -> None:
|
||||
record = self.acceptance()
|
||||
record["components"][0]["assets"][0]["sha256"] = "e" * 64
|
||||
result, _ = run_projection(self.tmp, self.fixture, record, self.report())
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("accepted assets do not match", result.stderr)
|
||||
|
||||
def test_rejects_rejected_decision(self) -> None:
|
||||
result, _ = run_projection(self.tmp, self.fixture,
|
||||
self.acceptance(decision="rejected"), self.report())
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("only an accepted record", result.stderr)
|
||||
|
||||
def test_rejects_non_advancing_revision(self) -> None:
|
||||
result, out = run_projection(self.tmp, self.fixture, self.acceptance(), self.report())
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
again, _ = run_projection(self.tmp, self.fixture, self.acceptance(), self.report(),
|
||||
revision=0, out_name="out")
|
||||
self.assertNotEqual(again.returncode, 0)
|
||||
self.assertIn("requires revision 1", again.stderr)
|
||||
|
||||
def test_rejects_unverified_domain_checkout(self) -> None:
|
||||
# An active domain without a checkout must fail closed instead of
|
||||
# silently projecting an incomplete catalog.
|
||||
fixture = Fixture(self.tmp / "repo2")
|
||||
with (fixture.root / "components.toml").open("a", encoding="utf-8") as handle:
|
||||
handle.write("""
|
||||
[[component]]
|
||||
id = "web"
|
||||
path = "extensions/web"
|
||||
kind = "domain"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "web authoring"
|
||||
requires = []
|
||||
checks_with = []
|
||||
release = "none"
|
||||
entry = ""
|
||||
""")
|
||||
with (fixture.root / ".gitmodules").open("a", encoding="utf-8") as handle:
|
||||
handle.write("""[submodule "extensions/web"]
|
||||
\tpath = extensions/web
|
||||
\turl = https://git.cflmy.cn/cflmy/marqdo-ext-web.git
|
||||
""")
|
||||
web_sha = nested_commit(fixture.root.parent / "objects-web")
|
||||
subprocess.run(["git", "-C", str(fixture.root), "update-index", "--add", "--cacheinfo",
|
||||
f"160000,{web_sha},extensions/web"], check=True)
|
||||
git(fixture.root, "add", "components.toml", ".gitmodules")
|
||||
git(fixture.root, "-c", "user.name=test", "-c", "user.email=test@example.com",
|
||||
"commit", "-q", "-m", "add domain without checkout")
|
||||
fixture.base = git(fixture.root, "rev-parse", "HEAD~1")
|
||||
fixture.head = git(fixture.root, "rev-parse", "HEAD")
|
||||
report = {
|
||||
"schema": "marqdo.release-reconcile.v1", "schema_version": 1,
|
||||
"root_sha": fixture.head, "scan_complete": True,
|
||||
"results": [release_entry()],
|
||||
}
|
||||
result, _ = run_projection(self.tmp, fixture,
|
||||
acceptance(root_base_sha=fixture.base), report, out_name="domain")
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("cannot be expanded", result.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user