//! **holger's identity for the shared About card** — holger's branding/identity data
//! for the constellation-wide JetBrains-style common shell (every suite app — nornir /
//! dwarves / korp / holger — carries an About and a Tools menu).
//!
//! holger no longer hand-rolls the About egui body: that twin was DELETED and the ONE
//! render body now lives in the shared [`facett_about`] widget (LAW #5), which renders a
//! [`nornir_appshell::Identity`]. This module owns only holger's **data** — the embedded
//! logo, the [`identity`] builder, and the headless oracle ([`state_json`]) — all
//! egui-free, so the lean, display-free default build asserts holger's identity with no
//! display, and the `gui` build feeds [`identity`] to `facett_about::AboutCard`.
use nornir_appshell::Identity;
/// The holger+znippy hero logo PNG (the same asset the startup splash embeds), so the
/// About card needs no runtime asset path. Carried into the [`Identity`] and decoded
/// LFS-tolerantly by the shared widget under `gui`.
pub const LOGO_PNG: &[u8] = include_bytes!("../assets/holger-znippy-logo.png");
/// The accessible name on the About logo image — the AccessKit label a robot queries
/// to prove the holger logo painted in the card. Stable (asserted by the robot test)
/// and a genuine screen-reader description.
pub const LOGO_ALT: &str = "holger logo — low-poly Norse warrior with the znippy lightning-rabbit shield";
/// The wordmark heading shown under the logo (and the text identity a robot asserts).
pub const WORDMARK: &str = "holger";
/// The primary tagline.
pub const TAGLINE: &str = "Secure, airgap-ready artifact registry — znippy-backed, immutable, auditable.";
/// The shared common-framework components holger CONSUMES (never twins) — shown in the
/// About card and reported to the oracle so the "built on the shared framework" claim
/// is observable. Mirrors the suite-wide reuse law (L5).
pub const FRAMEWORK: &[&str] = &[
"skidbladnir — service lifecycle (install/start/status/health + dedicated user)",
"nornir-service — the one tonic serve loop + auth interceptor",
"jera — the shared job manager (promote/GC + the Tools demo container)",
"facett — the shared egui UI framework (look, menu, tables, 3D graph)",
];
/// The holger-server-ui version, presented in the About card + reported to the oracle so a
/// robot asserts holger's identity carries a real version string.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
/// holger's SSH repository (shown on the card via [`Identity::repository`]).
pub const REPOSITORY: &str = "git@codeberg.org:nordisk/holger.git";
/// Build holger's shared-shell [`Identity`] — the data the shared `facett_about` card
/// renders and the [`state_json`] oracle dumps. holger maps its `FRAMEWORK[]` bullets
/// onto [`Identity::framework`] ("built on the shared nordisk framework"); the embedded
/// logo is carried whole (LFS-tolerant decode is the widget's concern, never a panic).
pub fn identity() -> Identity {
Identity {
logo_png: Some(LOGO_PNG.to_vec()),
logo_alt: LOGO_ALT.into(),
repository: REPOSITORY.into(),
framework: FRAMEWORK.iter().map(|s| s.to_string()).collect(),
..Identity::new("holger", WORDMARK, VERSION, TAGLINE)
}
}
/// The headless oracle for the About card — dumped under the app's `state_json.about`.
/// Delegates to the shared [`Identity::state_json`] (LAW #5), so holger's identity —
/// wordmark, **version**, tagline, logo alt-text, `has_logo`, and the shared framework
/// components it is built on — is asserted by a robot without needing pixels. `open`
/// reports whether the popup is showing.
pub fn state_json(open: bool) -> serde_json::Value {
identity().state_json(open)
}
#[cfg(test)]
mod tests {
use super::*;
/// **RED-when-broken: the About oracle carries holger's identity — logo, wordmark,
/// version, and the shared framework it is built on.** The embedded logo must be a
/// real non-empty PNG and the oracle (now sourced from the shared [`Identity`]) must
/// advertise the identity, so About is the branding/identity surface (not a blank
/// window). If the logo went missing, the version stopped being reported, or the
/// framework list emptied, this is red.
#[test]
fn about_oracle_carries_identity_and_framework() {
// The logo is embedded (non-empty) so About is never a blank surface. We
// tolerate a git-lfs pointer here: on a checkout where LFS blobs are not
// pulled the compiled-in bytes are the pointer, not the PNG — the same case
// the shared widget handles gracefully. The RED-when-broken contract of About
// is holger's IDENTITY (wordmark / version / framework), asserted strictly.
assert!(!LOGO_PNG.is_empty(), "the holger logo is embedded (non-empty)");
let real_png = LOGO_PNG.starts_with(b"\x89PNG");
let lfs_pointer = LOGO_PNG.starts_with(b"version https://git-lfs");
assert!(real_png || lfs_pointer, "the embedded logo is a real PNG or its LFS pointer");
let closed = state_json(false);
assert_eq!(closed["open"], serde_json::json!(false));
assert_eq!(closed["wordmark"], serde_json::json!(WORDMARK));
assert_eq!(closed["version"], serde_json::json!(VERSION));
assert!(!VERSION.is_empty(), "the About popup presents a real version string");
assert_eq!(closed["has_logo"], serde_json::json!(true));
// The shared framework list is present + non-empty (the reuse story is shown).
let fw = closed["framework"].as_array().expect("framework list");
assert!(!fw.is_empty(), "About names the shared framework components");
assert!(
fw.iter().any(|c| c.as_str().unwrap_or("").contains("jera")),
"About names jera (the shared job manager the Tools demo uses): {fw:?}"
);
let open = state_json(true);
assert_eq!(open["open"], serde_json::json!(true));
#[cfg(feature = "testmatrix")]
nornir_testmatrix::functional_status(
"holger-server-ui/about",
"oracle_carries_identity_and_framework",
!LOGO_PNG.is_empty()
&& closed["version"] == serde_json::json!(VERSION)
&& !fw.is_empty(),
"the About card embeds the holger logo + wordmark + version + shared-framework list (shared facett_about widget)",
);
}
}