The commit that runs: in the footer and at /version
CI / secret scan (push) Successful in 5s
CI / fmt, clippy, tests (push) Successful in 24s

Every page's footer names the commit the binary is built from, with a link
to it on the forge, and /version answers with the full hash, open without a
login like /healthz, so a script can tell which release is live.

build.rs writes COMMIT: from VISA_COMMIT, which the flake sets to its
source's revision (a Nix build has no .git), else from git in a checkout,
else empty. The flake sets it on the package alone, not on the
dependencies' build, which so stays cached from commit to commit.
This commit is contained in:
grabowski committed 2026-11-18 14:41:16 +07:00
1 parent a2cedcdd7e
commit 17426dba12
9 files changed
+140 -4

No files matched your search

+18
View File
@@ -216,6 +216,24 @@ async fn open_paths_headers_and_not_found(pool: PgPool) {
let app = local(pool);
let r = app.get("/healthz").await;
assert_eq!((r.status, r.body.as_str()), (StatusCode::OK, "ok"));
// the commit that runs, in full; the footer shows its first digits
let r = app.get("/version").await;
let commit = visa::embedded::COMMIT;
let want = if commit.is_empty() { "unknown" } else { commit };
assert_eq!(
(r.status, r.body.as_str()),
(StatusCode::OK, format!("{want}\n").as_str())
);
assert_eq!(r.headers["cache-control"], "no-store");
let short = visa::embedded::short(commit);
if !short.is_empty() {
let t = app.get("/people").await.text();
assert!(
t.contains(", commit <a href=\"https://git.b4l.co.th/B4L/visa/commit/"),
"{t}"
);
assert!(t.contains(&format!(">{short}</a>. Every view")), "{t}");
}
let css = app.get("/static/app.css").await;
assert_eq!(css.status, StatusCode::OK);
assert_eq!(css.headers["content-type"], "text/css; charset=utf-8");