feat: source-bound version and release contract (#19) #20

Merged
cflmy merged 2 commits from codex/issue-19-release-contract into master 2026-11-30 12:12:25 +08:00
4 changed files with 177 additions and 0 deletions

No files matched your search

+21
View File
@@ -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}");
}
+85
View File
@@ -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-<version>-<target>.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<version>` 打 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 测试冒充。
@@ -0,0 +1,65 @@
# View candidate 6af0489 — source-bound version and release contract
Date: 2026-11-30.
Repository: `cflmy/marqdo-view`.
Candidate commit: `6af0489f2bea6014fe67efd6bf759f8f516d2a75`
(branch `codex/issue-19-release-contract`).
Issues: [marqdo-view#19](https://git.cflmy.cn/cflmy/marqdo-view/issues/19)
(release-engineering slice), linked #15/#16/#17 (merged via PR #18).
Executed host: Linux x86_64, glibc 2.43, `rustc 1.100.0 (0ef1bc386
2026-11-09)`, Python 3.14.4.
## 1. Input identity used
* CLI: `marqdo` 3.0.0-rc.6 built from CLI candidate
`0f87f856dba28e34bbd2743d23b8f9b1fe96424a` (CLI PR #27).
* Bundle: `marqdo-stdlib 0.2.0`,
tree `sha256:db905508dde89763b9d43b47fc5d52c6a1d5445a91f3c86a550ced43e8aac9d7`.
* The published rc.6 archive was **not** downloaded in this run; the CLI input
is a local candidate build. Published-artifact acceptance stays `UNVERIFIED`
and is a consumer/root responsibility.
## 2. Source gates
| Command | Result |
|---|---|
| `cargo fmt --all -- --check` | PASS |
| `cargo clippy --all-targets --locked -- -D warnings` | PASS |
| `cargo test --locked` | PASS: 177 passed, 0 failed (67 lib + 53 contract + 46 integration + 11 security) |
| `MARQDO_BUILD_SOURCE_SHA=6af0489… bash scripts/package.sh` | PASS: bundle + `marqdo-view-0.3.0-x86_64-unknown-linux-gnu.tar.gz`, sha256 `162f09b629a5862a671cd9089b423b445bd0333e393d49a12e6ae773a64b8f36` |
| `marqdo tool install dist/marqdo-view/tool.json` | PASS (`view 0.3.0`, `marqdo-view`) |
| `marqdo view --version` | PASS: `marqdo-view 0.3.0 (source 6af0489f2bea6014fe67efd6bf759f8f516d2a75)` |
| `marqdo view export examples/circle-area.mq.md --embed --out DIR` | PASS: 1 page / 8 files, `executed: false`, manifest `sha256:e890b4ca…` |
| `marqdo tool remove view` | PASS |
The browser lane (`scripts/test-browser.sh`, real Chromium) and
`scripts/acceptance.sh` G01–G12 were **not** run in this environment; the
previous candidate PR #18 recorded their real-Chromium PASS on its own SHA.
`docs/RELEASE.md` records the release contract, platform matrix and the rule
that a Rust-only run cannot stand in for browser/export acceptance.
## 3. Delivered contract
* `build.rs` embeds `MARQDO_BUILD_SOURCE_SHA`; `--version` prints the long
identity (`source <40-hex|dev>`) while `-V` keeps `marqdo-view 0.3.0`.
Release records and MQDH can bind a View asset to the tested commit.
* `docs/RELEASE.md`: release identity, platform matrix (Linux x86_64 supported;
macOS/Windows `UNVERIFIED`; Linux aarch64 `unsupported`), asset contract
(bundle + tar.gz + `.sha256` + release record), immutable publication,
same-SHA gates, maintainer-only publication (CI only notifies root reconcile),
MQDH consumption contract (`--embed`, Observation-bound export, public
Analysis 3/Observation 1, no private protocol) and known limitations.
No reader/export/execution behavior changed; no protocol/dependency change.
## 4. Not verified / limits
* Formal `0.3.0` tag/Release assets: **not created** (maintainer action after
same-SHA CI; the archive above is a local candidate).
* MQDH same-candidate acceptance (View tag + SHA-256 + MQDH SHA): **UNVERIFIED**;
consumer repository owns that evidence.
* Real-browser acceptance for this exact commit: **UNVERIFIED here** (CI
browser lane must run on the candidate; not replaced by Rust tests).
* macOS/Windows: **UNVERIFIED**/unsupported.
* Published rc.6 archive consumption: **UNVERIFIED**.
+6
View File
@@ -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. \