adze_runtime_governance/
lib.rs1#![forbid(unsafe_op_in_unsafe_fn)]
7#![deny(missing_docs)]
8#![cfg_attr(feature = "strict_api", deny(unreachable_pub))]
9#![cfg_attr(not(feature = "strict_api"), warn(unreachable_pub))]
10#![cfg_attr(feature = "strict_docs", deny(missing_docs))]
11#![cfg_attr(not(feature = "strict_docs"), allow(missing_docs))]
12
13pub use adze_runtime_governance_matrix::{
14 BddGovernanceSnapshot, BddPhase, BddScenario, BddScenarioStatus, GLR_CONFLICT_FALLBACK,
15 GLR_CONFLICT_PRESERVATION_GRID, ParserBackend, ParserFeatureProfile,
16 bdd_governance_matrix_for_current_profile, bdd_governance_matrix_for_profile,
17 bdd_governance_matrix_for_runtime, bdd_governance_matrix_for_runtime2,
18 bdd_governance_matrix_for_runtime2_profile, bdd_governance_snapshot, bdd_progress,
19 bdd_progress_report, bdd_progress_report_for_current_profile, bdd_progress_report_for_profile,
20 bdd_progress_report_with_profile, bdd_progress_report_with_profile_runtime,
21 bdd_progress_status_line, bdd_progress_status_line_for_profile,
22 bdd_status_line_for_current_profile, current_backend_for, describe_backend_for_conflicts,
23 parser_feature_profile_for_runtime, resolve_backend_for_profile, runtime_governance_snapshot,
24};
25
26#[cfg(test)]
27mod tests {
28 use super::*;
29
30 #[test]
31 fn profile_matches_contract_current() {
32 assert_eq!(
33 parser_feature_profile_for_runtime().pure_rust,
34 cfg!(feature = "pure-rust")
35 );
36 }
37
38 #[test]
39 fn resolve_backend_round_trips_current_profile() {
40 let profile = parser_feature_profile_for_runtime();
41 assert_eq!(current_backend_for(false), profile.resolve_backend(false));
42
43 #[cfg(feature = "glr")]
44 {
45 assert_eq!(current_backend_for(true), profile.resolve_backend(true));
46 }
47 }
48
49 #[test]
50 fn reports_current_profile() {
51 let report = bdd_progress_report_for_current_profile(BddPhase::Core, "Core");
52 assert!(report.contains("Core"));
53 assert!(report.contains("Feature profile:"));
54 assert!(report.contains("Governance status"));
55 }
56
57 #[test]
58 fn status_line_is_stable_shape() {
59 let status = bdd_status_line_for_current_profile(BddPhase::Runtime);
60 assert!(status.starts_with("runtime:"));
61 }
62
63 #[test]
64 fn matrix_helpers_are_exposed_from_runtime_governance_api() {
65 let profile = parser_feature_profile_for_runtime();
66 let matrix = bdd_governance_matrix_for_current_profile(BddPhase::Core);
67 let explicit = bdd_governance_matrix_for_profile(BddPhase::Core, profile);
68 let runtime_matrix = bdd_governance_matrix_for_runtime();
69
70 assert_eq!(matrix.profile, profile);
71 assert_eq!(explicit.profile, profile);
72 assert_eq!(runtime_matrix.profile, profile);
73
74 let runtime2_matrix = bdd_governance_matrix_for_runtime2(BddPhase::Core, profile.glr);
75 let runtime2_profile =
76 adze_runtime_governance_matrix::parser_feature_profile_for_runtime2(profile.glr);
77 assert_eq!(runtime2_matrix.profile, runtime2_profile);
78 }
79
80 #[test]
81 fn resolve_backend_for_profile_works() {
82 let profile = parser_feature_profile_for_runtime();
83 let backend = resolve_backend_for_profile(profile, false);
84 assert_eq!(backend, profile.resolve_backend(false));
85 }
86
87 #[test]
88 fn bdd_governance_matrix_for_runtime2_works() {
89 let profile = parser_feature_profile_for_runtime();
90 let matrix = bdd_governance_matrix_for_runtime2(BddPhase::Runtime, profile.glr);
91 assert_eq!(matrix.phase, BddPhase::Runtime);
92 }
93
94 #[test]
95 fn runtime_governance_snapshot_accessible() {
96 let snap = runtime_governance_snapshot(BddPhase::Core);
97 assert_eq!(snap.phase, BddPhase::Core);
98 assert_eq!(snap.profile, parser_feature_profile_for_runtime());
99 }
100
101 #[test]
102 fn bdd_progress_report_for_current_profile_both_phases() {
103 let core = bdd_progress_report_for_current_profile(BddPhase::Core, "Core Phase");
104 let runtime = bdd_progress_report_for_current_profile(BddPhase::Runtime, "Runtime Phase");
105 assert!(core.contains("Core Phase"));
106 assert!(runtime.contains("Runtime Phase"));
107 }
108
109 #[test]
110 fn bdd_status_line_for_current_profile_both_phases() {
111 let core = bdd_status_line_for_current_profile(BddPhase::Core);
112 let runtime = bdd_status_line_for_current_profile(BddPhase::Runtime);
113 assert!(core.starts_with("core:"));
114 assert!(runtime.starts_with("runtime:"));
115 }
116
117 #[test]
118 fn bdd_governance_matrix_for_runtime_uses_current_profile() {
119 let matrix = bdd_governance_matrix_for_runtime();
120 assert_eq!(matrix.profile, parser_feature_profile_for_runtime());
121 }
122}