Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/gunnar

crates/gunnar-recipe/tests/bijection_laws.rs

//! **The bijection laws, over BOTH mirrors** (the 2026-08-26 ruling: bijection
//! is what build things are held to, and it must reach into the traits themselves).
//!
//! Conformance to `nornir_build_thing::laws` is part of the `BuildThing`
//! contract: declaration ↔ struct, menu ↔ declaration, option row ↔ CLI flag,
//! decision ↔ fragment, receipt → recipe — every failure naming the law and
//! the inverse that broke. gunnar has TWO spellings of one declaration
//! (`recipe.rs` and `.nornir/build-variants.toml`, held together by
//! `tests/toml_parity.rs`), so the laws run over both:
//!
//! * the RUST mirror through the full trait gate ([`assert_bijective`]) — that
//!   is this file;
//! * the TOML mirror through the set-level laws directly — it wears no
//!   `BuildThing` of its own, and the menu/receipt laws (B, E) reach it
//!   transitively through `toml_parity`'s equality of the two sets. That half
//!   moved to `tests/tree_laws.rs`
//!   (`the_toml_mirror_obeys_the_set_level_laws_of_0_1_10`) when the pin
//!   advanced: 0.1.10 FOLDED the flat `law_option_flag` / `law_decision_fragment`
//!   into the tree (C as path ↔ flag, D as decision ↔ tree, both trait-level)
//!   and grew a set-level `law_rows_tree` in their place, so keeping a copy here
//!   would be two spellings of one law — which is the thing these laws exist to
//!   forbid.
//!
//! # Why this file was feature-gated once (`--features bijection-laws`, retired)
//!
//! This crate resolves `nornir-build-thing` from the REGISTRY (the Cargo.toml
//! header: the reuse rule's "builds standalone from a fresh clone" forbids a sibling
//! path), and the `laws` module ships in 0.1.9. The gate was written on the
//! 0.1.7 pin the morning of 2026-08-26 and sat behind a feature so `cargo test`
//! stayed green until the registry caught up; 0.1.9 was published the same
//! afternoon, the lock advanced, the gate ran once with the feature and then
//! folded into the default set — this file is now just a test.

use gunnar_recipe::GunnarBuildThing;
use nornir_build_thing::laws;

/// The Rust mirror, through the full trait-level gate.
#[test]
fn the_rust_mirror_obeys_the_bijection_laws() {
    laws::assert_bijective(&GunnarBuildThing);
}