feat: offline build-info and release platform matrix (#9) #10

Merged
cflmy merged 2 commits from codex/issue-9-8-buildinfo-and-release into master 2026-11-30 12:12:25 +08:00
6 changed files with 219 additions and 1 deletions

No files matched your search

+3
View File
@@ -55,6 +55,9 @@ capability.
* **Bundles**: one directory with `manifest.json` + `proof.ndjson`, bound to
source/Analysis digests, goal digest, models, dependencies, environment and
payload SHA-256. A cache hit is replayed, never trusted.
* **Diagnostics**: `--build-info` prints one offline `marqdo.build-info` v1
document (version, embedded source commit, platform, protocol revisions and
the pinned Lean + Mathlib identity) for release evidence and user reports.
* **CLI**: `check` and `replay` only. Exit codes: 0 all requested targets
verified (or no target), 1 at least one not verified, 2 engineering failure.
`--out` with exactly one requested target makes that directory the bundle;
+25
View File
@@ -0,0 +1,25 @@
//! Embed the release source commit when the build supplies it.
//!
//! `marqdo-prove --build-info` reports the exact product identity so release
//! evidence and user diagnostics can name the tested commit. A development
//! build honestly reports `null` instead of guessing.
fn main() {
println!("cargo:rerun-if-env-changed=MARQDO_BUILD_SOURCE_SHA");
let Ok(sha) = std::env::var("MARQDO_BUILD_SOURCE_SHA") else {
return;
};
let sha = sha.trim();
let valid = sha.len() == 40
&& sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase());
if valid {
println!("cargo:rustc-env=MARQDO_BUILD_SOURCE_SHA={sha}");
} else {
println!(
"cargo:warning=MARQDO_BUILD_SOURCE_SHA is not a full lowercase 40-hex commit; \
--build-info will not claim a source commit"
);
}
}
+21 -1
View File
@@ -31,7 +31,7 @@ evidence, including failed environment experiments, is in [`STATUS.md`](STATUS.m
| Artifact | tool bundle directory `marqdo-prove-tool/` (`bin/marqdo-prove`, `tool.json`, pinned `lean/` project) |
| Archive | `marqdo-prove-v0.1.0-beta.1-x86_64-unknown-linux-gnu-tool.tar.gz` + `SHA256SUMS` |
| Fixed backend | Lean `leanprover/lean4:v4.36.0` + Mathlib `fc4f59e577feb1a4956671bc04ac18aaaf8cd842` (pinned in `lean/`) |
| Upstream CLI | Marqdo `3.0.0-rc.4`, Analysis revision 3 |
| Upstream CLI | Marqdo `3.0.0-rc.6` candidate (`63776735…`), Analysis revision 3; Tool API revision 1 |
| Platform | Linux x86_64 |
The bundle intentionally does **not** embed the Lean toolchain or Mathlib olean
@@ -39,6 +39,26 @@ cache (several GiB): the installed tool discovers the pinned backend through
`MARQDO_PROVE_LEAN_ROOT` / `MARQDO_PROVE_LEAN_BIN_DIR` and fails closed with
`backend.unavailable` when it is absent. See `README.md` for one-time setup.
## 2.1 Build identity and platform matrix
`marqdo-prove --build-info` prints one offline `marqdo.build-info` v1 document:
product/version, build-embedded source commit (or `null` for a development
build), platform, protocol revisions and the pinned Lean + Mathlib backend
identity. It never opens a document, invokes Lean, accesses the network or
prints paths/credentials. Release builds embed `MARQDO_BUILD_SOURCE_SHA` so the
reported commit must equal the tag commit.
| Platform | State | Evidence |
| --- | --- | --- |
| Linux x86_64 / glibc ≥ 2.39 | **supported (beta)** | `v0.1.0-beta.1` beta lane + this repository's `test`/`package` CI steps |
| Linux aarch64 | **unsupported** | no real runner or artifact |
| macOS arm64/x86_64 | **UNVERIFIED** | no native runner; Lean backend not exercised |
| Windows x86_64 | **unsupported** | no native build/run evidence |
The Lean-backed acceptance suite still runs only on the dedicated backend
runner. The shared docker lane runs the Rust-side gates and packages the tool
bundle; a package build is not a proof-acceptance claim.
## 3. Local-only credentials
Release/CI credentials live **only** in `.secrets/release.env` in the local
@@ -0,0 +1,88 @@
# Prove candidate 4e02400 — offline build-info and release platform matrix
Date: 2026-11-30.
Repository: `cflmy/marqdo-prove`.
Candidate commit: `4e024002332cdb6ea301f7599d365321658bd213`
(branch `codex/issue-9-8-buildinfo-and-release`).
Issues: [marqdo-prove#9](https://git.cflmy.cn/cflmy/marqdo-prove/issues/9),
[#8](https://git.cflmy.cn/cflmy/marqdo-prove/issues/8),
[#5](https://git.cflmy.cn/cflmy/marqdo-prove/issues/5),
[#7](https://git.cflmy.cn/cflmy/marqdo-prove/issues/7).
Parent tickets: `marqdo#56` §2/§4/§7/§11.2.
Executed host: Linux x86_64, glibc 2.43, `rustc 1.100.0 (0ef1bc386
2026-11-09)`, Python 3.14.4.
## 1. Input identity
* Core CLI: `marqdo` 3.0.0-rc.6 built from CLI candidate
`0f87f856dba28e34bbd2743d23b8f9b1fe96424a` (PR `marqdo-cli#27`; merged after
this record).
* Fixed proof backend: Lean `leanprover/lean4:v4.36.0` + Mathlib
`fc4f59e577feb1a4956671bc04ac18aaaf8cd842` (pinned in `lean/`). The backend is
**not installed in this environment**; Lean-backed acceptance remains
`UNVERIFIED` here and must run on the dedicated backend runner.
## 2. Source gates
| Command | Result |
|---|---|
| `cargo fmt --all -- --check` | PASS |
| `cargo clippy --all-targets --locked -- -D warnings` | PASS |
| `cargo test --locked` | PASS: 96 passed, 0 failed, 11 ignored (Lean e2e, backend absent) |
| `MARQDO_BUILD_SOURCE_SHA=4e02400… sh scripts/package-tool.sh <out>` | PASS; bundle assembled (release build 12.97s) |
| `marqdo tool install <bundle>/tool.json` | PASS: installed `prove` 0.1.0-beta.1 (`marqdo.prove`) |
| `marqdo prove --build-info` via real CLI dispatch | PASS: `marqdo.build-info` v1 with `source_sha=4e024002…`, platform linux/x86_64, protocols analysis 3 / cli_tool_api 1 / proof_schema 1 |
| `marqdo tool remove prove` | PASS: command removed |
`--version` remains the stable text line `marqdo-prove 0.1.0-beta.1`.
## 3. Delivered contract
`marqdo-prove --build-info` emits one offline document:
```json
{
"schema": "marqdo.build-info",
"schema_version": 1,
"product": "marqdo-prove",
"version": "0.1.0-beta.1",
"source_sha": "4e024002332cdb6ea301f7599d365321658bd213",
"platform": {"os": "linux", "arch": "x86_64", "family": "unix"},
"protocols": {"analysis": 3, "cli_tool_api": 1, "proof_schema": 1},
"backend": {
"kind": "lean4+mathlib",
"lean_toolchain": "leanprover/lean4:v4.36.0",
"mathlib_revision": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
"bundled": false,
"discovery": "MARQDO_PROVE_LEAN_ROOT / MARQDO_PROVE_LEAN_BIN_DIR"
}
}
```
It opens no document, starts no Lean process, accesses no network and prints no
absolute path or credential (unit test enforces the rule). Release builds embed
`MARQDO_BUILD_SOURCE_SHA`, so a release record can bind the report to the tag
commit. `docs/RELEASE.md` now records the platform matrix, the "package build is
not proof acceptance" rule and the rc.6 candidate as upstream input.
## 4. Issue mapping
| Issue item | This candidate |
|---|---|
| #9 asset identity + diagnostics | `--build-info` v1 + `source_sha` embedding; tool bundle/package lane unchanged |
| #9 platform matrix | docs/RELEASE.md §2.1: Linux supported beta; macOS/Windows UNVERIFIED/unsupported; Linux aarch64 unsupported |
| #9 same-SHA release evidence | release build embeds the commit; proof-acceptance evidence still requires the Lean backend runner (`UNVERIFIED` here) |
| #5 independent release boundary | repo CI has no publish step; `release-beta.sh` is a local, reviewed maintainer action with transient credentials; recommendation: close #5 after candidate CI |
| #7 upstream | local candidate CLI used; published rc.6 archive not downloaded (`UNVERIFIED`) |
| #8 bounded replay | replay remains implemented and bundle-digest-bound; end-to-end replay with Lean is `UNVERIFIED` here (backend absent) |
## 5. Not verified / limits
* Lean-backed proof search/verification and bundle replay: **UNVERIFIED** in this
environment (no pinned Lean/Mathlib installation). The 11 ignored e2e tests
are exactly that lane; they must run on the dedicated backend runner.
* macOS/Windows native build/run: **UNVERIFIED**.
* Published rc.6 archive acceptance (#7): **UNVERIFIED**.
* Formal beta.2 tag/release: **not created**; publication remains a reviewed
maintainer action. No release claim is made here.
+73
View File
@@ -38,6 +38,45 @@ pub const REQUIRED_ANALYSIS_REVISION: u64 = 3;
/// Revision of the upstream CLI Tool contract this build declares.
pub const REQUIRED_API_REVISION: u64 = 1;
/// Build-time source commit, embedded by the release build.
pub const BUILD_SOURCE_SHA: Option<&str> = option_env!("MARQDO_BUILD_SOURCE_SHA");
/// Pinned Lean toolchain identity (see `lean/` and `docs/RELEASE.md`).
pub const LEAN_TOOLCHAIN: &str = "leanprover/lean4:v4.36.0";
/// Pinned Mathlib revision (see `lean/` and `docs/RELEASE.md`).
pub const MATHLIB_REVISION: &str = "fc4f59e577feb1a4956671bc04ac18aaaf8cd842";
/// Offline machine-readable build/platform report (`--build-info`).
///
/// Schema `marqdo.build-info` version 1. It reads build-time identity and
/// process platform facts only: no document, no Lean invocation, no network,
/// no absolute host path and no credential.
pub fn build_info() -> serde_json::Value {
serde_json::json!({
"schema": "marqdo.build-info",
"schema_version": 1,
"product": TOOL_NAME,
"version": env!("CARGO_PKG_VERSION"),
"source_sha": BUILD_SOURCE_SHA,
"platform": {
"os": std::env::consts::OS,
"arch": std::env::consts::ARCH,
"family": std::env::consts::FAMILY,
},
"protocols": {
"analysis": REQUIRED_ANALYSIS_REVISION,
"cli_tool_api": REQUIRED_API_REVISION,
"proof_schema": PROOF_SCHEMA_VERSION,
},
"backend": {
"kind": "lean4+mathlib",
"lean_toolchain": LEAN_TOOLCHAIN,
"mathlib_revision": MATHLIB_REVISION,
"bundled": false,
"discovery": "MARQDO_PROVE_LEAN_ROOT / MARQDO_PROVE_LEAN_BIN_DIR",
},
})
}
/// Hard limits. They are finite, documented and exercised by the negative
/// tests; the defaults mirror `docs/DEVELOPMENT.md` §13.1.
pub mod limits {
@@ -308,3 +347,37 @@ fn hex_lower(bytes: &[u8]) -> String {
}
out
}
#[cfg(test)]
mod build_info_tests {
use super::*;
#[test]
fn build_info_is_one_current_offline_document() {
let value = build_info();
assert_eq!(value["schema"], "marqdo.build-info");
assert_eq!(value["schema_version"], 1);
assert_eq!(value["product"], TOOL_NAME);
assert_eq!(value["version"], env!("CARGO_PKG_VERSION"));
assert_eq!(value["protocols"]["analysis"], REQUIRED_ANALYSIS_REVISION);
assert_eq!(value["protocols"]["proof_schema"], PROOF_SCHEMA_VERSION);
assert_eq!(value["backend"]["bundled"], false);
assert!(value["platform"]["os"].is_string());
assert!(value["backend"]["lean_toolchain"].is_string());
if let Some(sha) = value["source_sha"].as_str() {
assert_eq!(sha.len(), 40);
assert!(sha
.chars()
.all(|ch| ch.is_ascii_hexdigit() && !ch.is_ascii_uppercase()));
} else {
assert!(value["source_sha"].is_null());
}
let text = serde_json::to_string(&value).unwrap();
for forbidden in ["/root/", "\\Users\\", "token", "api_key", "password"] {
assert!(
!text.contains(forbidden),
"build-info leaked {forbidden}: {text}"
);
}
}
}
+9
View File
@@ -16,6 +16,7 @@ USAGE:
marqdo-prove check ENTRY [--unit FRAGMENT] [--root DIR] [--out PATH] [--json]
marqdo-prove replay ENTRY BUNDLE [--root DIR] [--json]
marqdo-prove --version
marqdo-prove --build-info
marqdo-prove --help
CHECK
@@ -65,6 +66,14 @@ fn run(args: &[String]) -> Result<u8, String> {
println!("{} {}", marqdo_prove::TOOL_NAME, env!("CARGO_PKG_VERSION"));
Ok(0)
}
"--build-info" => {
println!(
"{}",
serde_json::to_string_pretty(&marqdo_prove::build_info())
.map_err(|error| format!("cannot encode build info: {error}"))?
);
Ok(0)
}
"--help" | "-h" | "help" => {
print!("{USAGE}");
Ok(0)