From 5a1696891abf26961b85551921e3cc0110d18ad8 Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 13 Jul 2026 22:11:03 +0200 Subject: [PATCH] =?UTF-8?q?test:=20red=20executable-spec=20for=20#266=20?= =?UTF-8?q?=E2=80=94=20aura=20--version=20carries=20the=20engine=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aura --version must print 'aura 0.1.0 ()', the commit sourced from the same AURA_COMMIT build provenance the run manifest stamps — a pre-run freshness probe distinguishing a stale binary from an engine bug. Fails on the absent parenthesized commit, not on scaffolding. refs #266 --- crates/aura-cli/tests/cli_run.rs | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/crates/aura-cli/tests/cli_run.rs b/crates/aura-cli/tests/cli_run.rs index 7698107..59b11eb 100644 --- a/crates/aura-cli/tests/cli_run.rs +++ b/crates/aura-cli/tests/cli_run.rs @@ -4866,6 +4866,42 @@ fn version_flag_prints_version_to_stdout_and_exits_zero() { } } +/// `--version` carries the ENGINE COMMIT beside the semver, drawn from the SAME +/// `AURA_COMMIT` build-time provenance the run manifest stamps (the +/// `option_env!("AURA_COMMIT")` that fills `RunManifest.commit`), so a stale +/// binary is distinguishable at the CLI surface *before* any run (#266). Shape: +/// `aura 0.1.0 ()`, exit 0. +/// +/// Property, not a specific sha: the expected commit is read from the same +/// provenance source the built binary was compiled with — this integration test +/// receives aura-cli's build-script `rustc-env`, so it sees the identical value +/// (dirty/`unknown` suffixes included) rather than today's HEAD, keeping the +/// assertion honest against a lagging or unclean tree. The load-bearing claim is +/// that the parenthesized commit rides beside the still-present semver. +#[test] +fn version_flag_carries_the_engine_commit_from_manifest_provenance() { + // The single source of truth — the same env the manifest's commit is sourced + // from; falls back to "unknown" identically to `sim_optimal_manifest`. + let commit = option_env!("AURA_COMMIT").unwrap_or("unknown"); + let out = std::process::Command::new(env!("CARGO_BIN_EXE_aura")) + .arg("--version") + .output() + .expect("spawn aura"); + assert_eq!(out.status.code(), Some(0), "--version exit {:?}", out.status); + let stdout = String::from_utf8_lossy(&out.stdout); + // Semver stays present (one source of truth, CARGO_PKG_VERSION). + assert!( + stdout.contains(env!("CARGO_PKG_VERSION")), + "--version still prints the semver: {stdout:?}" + ); + // ...and the engine commit rides beside it, parenthesized, from the shared + // manifest provenance — the load-bearing assertion #266 adds. + assert!( + stdout.contains(&format!("({commit})")), + "--version prints the engine commit ({commit}) beside the semver: {stdout:?}" + ); +} + /// Subcommand help is SCOPED: `aura sweep --help` names sweep's own flags and is /// NOT byte-identical to `aura run --help` — each subcommand documents its own /// options rather than reprinting one shared global blob (the #131 uniform-help