From 6af0489f2bea6014fe67efd6bf759f8f516d2a75 Mon Sep 17 00:00:00 2001 From: cflmy Date: Mon, 30 Nov 2026 12:08:46 +0800 Subject: [PATCH] feat: bind View version to source commit and record release contract Deliver the repo-side release-engineering slice of marqdo-view#19 (formal release remains a maintainer action): - `build.rs` embeds `MARQDO_BUILD_SOURCE_SHA`; `marqdo-view --version` now prints the long identity `marqdo-view 0.3.0 (source <40-hex|dev>)` while `-V` keeps the short product line. MQDH/release records can bind an asset to the tested commit instead of guessing from a file name. - `docs/RELEASE.md` records the release identity, platform matrix (Linux x86_64 supported; macOS/Windows UNVERIFIED; Linux aarch64 unsupported), the tool-bundle/archive/SHA-256/SHA256SUMS asset contract, same-SHA gates, maintainer-only publication (CI only notifies the root reconcile) and the MQDH consumption contract (public Analysis 3/Observation 1, `--embed`, Observation-bound export, no private protocol). - No change to reader/export/execution behavior, protocols or dependencies. Formal tag/release and MQDH same-candidate acceptance remain UNVERIFIED and must not be inferred from this change. --- build.rs | 21 ++++++++++++ docs/RELEASE.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ src/cli.rs | 6 ++++ 3 files changed, 112 insertions(+) create mode 100644 build.rs create mode 100644 docs/RELEASE.md diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..385cea4 --- /dev/null +++ b/build.rs @@ -0,0 +1,21 @@ +//! Embed the release source commit when the build supplies it. +//! +//! `marqdo-view --version` reports the short product version; the long version +//! also names the exact source commit so MQDH/release records can bind a View +//! asset to the tested commit. A development build reports `dev` instead of +//! guessing. + +fn main() { + println!("cargo:rerun-if-env-changed=MARQDO_BUILD_SOURCE_SHA"); + let sha = std::env::var("MARQDO_BUILD_SOURCE_SHA") + .ok() + .map(|value| value.trim().to_string()) + .filter(|value| { + value.len() == 40 + && value + .chars() + .all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase()) + }) + .unwrap_or_else(|| "dev".to_string()); + println!("cargo:rustc-env=MARQDO_VIEW_SOURCE_SHA={sha}"); +} diff --git a/docs/RELEASE.md b/docs/RELEASE.md new file mode 100644 index 0000000..5fba694 --- /dev/null +++ b/docs/RELEASE.md @@ -0,0 +1,85 @@ +# marqdo-view Release 合同 + +本文件记录 `marqdo-view` 正式发行的身份、资产、平台矩阵与 MQDH 消费合同。 +发布是维护者的人工批准动作;仓库 CI 只验证候选并通知根对账,不自动 tag、 +不自动上传、不自动发布。 + +## 1. 当前候选身份 + +| 项 | 值 | +|---|---| +| 产品 | `marqdo-view` | +| 版本 | `0.3.0` | +| 当前候选源码 | 合并后的 `master`(以 tag 提交为准);构建时用 `MARQDO_BUILD_SOURCE_SHA` 嵌入 | +| 冻结 CLI | `marqdo 3.0.0-rc.6`,源码 `63776735e924ade279cdf59d5c733dc24bfdabbb` | +| CLI 归档 | `marqdo-3.0.0-rc.6-x86_64-unknown-linux-gnu.tar.gz`,SHA-256 `8dc0b006302e03c23451b8ea9f8a0fcdae8bf67c80c546bee2434bf69755bfe3` | +| CLI 二进制 | SHA-256 `4f12e6b8a2edb327c0d9ab6165f74e8e88a01b05350527e3aade6f52d4f7a06c` | +| Stdlib Bundle | `marqdo-stdlib 0.2.0`,tree `sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7` | +| 协议 | CLI Tool revision 1(`api_revision 1 / analysis 3 / observation 1`)、`marqdo.lint` 无、Analysis 3、Observation 1 | +| 平台 | Linux x86_64 / glibc ≥ 2.39 | + +CLI 身份必须来自固定制品(tag/归档 SHA-256),不能使用浮动 rc 标签。 + +## 2. 版本输出合同 + +```sh +marqdo-view -V # marqdo-view 0.3.0 +marqdo-view --version # marqdo-view 0.3.0 (source <40-hex commit|dev>) +``` + +`--version` 的长版本由构建期 `MARQDO_BUILD_SOURCE_SHA` 决定:release 构建必须 +嵌入 tag 提交;开发构建诚实显示 `dev`。MQDH/发行记录用长版本核对 View SHA, +不得从目录名或文件名推断。 + +## 3. 平台矩阵 + +| 平台 | 状态 | 证据 | +|---|---|---| +| Linux x86_64 / glibc ≥ 2.39 | **supported** | `scripts/acceptance.sh` G01–G12 + Rust 测试 + 真实 Chromium/导出/Tool 冷安装;见 `docs/evidence/` 中绑定 CLI SHA 的 manifest | +| Linux aarch64 | **unsupported** | 无 runner/产物 | +| macOS arm64 / x86_64 | **UNVERIFIED** | 无原生 runner;浏览器/字体/离线主题未验收 | +| Windows x86_64 | **unsupported** | 无原生构建/浏览器验收 | + +`UNVERIFIED` 不等于支持;只有同 SHA manifest 为 PASS 的平台才可写 supported。 +`.woodpecker/ci.yml` 的 `browser` lane 使用真实 Chromium,不能以 mock 替代。 + +## 4. 发布资产合同 + +`scripts/package.sh` 产出的正式资产: + +| 资产 | 内容 | +|---|---| +| `marqdo-view/` Tool bundle | `bin/marqdo-view` + `tool.json`(CLI Tool revision 1) | +| `marqdo-view--.tar.gz` | 上述 bundle 的归档 | +| `...tar.gz.sha256` | 归档 SHA-256 | +| Release 记录 | 版本、tag、源码 SHA、平台、资产名、SHA-256、CLI SHA/归档摘要、测试结果、已知问题、破坏性变更 | + +不可变规则:tag 与资产只增不改;同 tag 重传必须字节一致;失败保留日志并用新候选 +重发;资产不得包含凭据、构建机绝对路径或用户数据。 + +## 5. 同一 SHA 门禁与发布流程 + +1. 候选提交通过 `.woodpecker/ci.yml` 的 `build-acceptance` 与 `browser` lane,并由 + `scripts/acceptance.sh` 生成绑定 CLI SHA 的 G01–G12 manifest。 +2. MQDH 用固定 View Release(tag + 资产 SHA-256)完成阅读桥/静态导出,记录 + View SHA + MQDH SHA;本地临时构建不计入。 +3. 维护者批准后按 `v` 打 tag、上传资产;`.woodpecker/release.yml` 只通知 + 根 reconcile(无发布密钥)。 +4. 发布后回读资产并校验 SHA-256、`--version` 长版本与 tag 提交一致。 + +## 6. MQDH 消费合同 + +- 只消费公开 Tool bundle/资产与公开协议:Analysis 3、Observation 1、CLI Tool 1。 +- 静态导出必须绑定已发生运行的 Observation(`export --observation --run-id`), + 禁止再次执行或自渲染结果;只读阅读用 `export --embed`。 +- 不在 View 内实现 MQDH 业务、更新器、安装器或反馈后端;MQDH 不得依赖 View + 私有结构或相对路径。 +- 已知限制与 `UNVERIFIED` 项必须出现在 Release 记录中。 + +## 7. 已知问题 / 未验证 + +- 正式 Release/tag 尚未创建(需维护者批准);本文件是发布合同,不是发布声明。 +- MQDH 同候选集成复验与评审分:未执行(消费者仓负责)。 +- macOS/Windows:UNVERIFIED/unsupported。 +- 真实浏览器 Playwright 验收只在具备该镜像的环境执行;本环境未运行则必须 + `UNVERIFIED`,不得用 Rust 测试冒充。 diff --git a/src/cli.rs b/src/cli.rs index 39581ee..a0b8db0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -12,6 +12,12 @@ use std::path::PathBuf; #[command( name = "marqdo-view", version, + long_version = concat!( + env!("CARGO_PKG_VERSION"), + " (source ", + env!("MARQDO_VIEW_SOURCE_SHA"), + ")" + ), about = "Read .mq.md documents as documents: static Analysis v3, optional explicit Observation v1", long_about = "Marqdo View renders the original Markdown and attaches verified Analysis v3 facts. \ Running is never implicit: it requires an explicit user action. \