Skip to main content

Mountain/
LandFixTier.rs

1//! # LandFixTier
2//!
3//! Emits a single ISO-timestamped boot banner listing the compiled-in value of
4//! every tier variable. Because all `env!("Tier…")` calls are resolved by
5//! `build.rs::PropagateTierGating` at compile time, the banner always reflects
6//! the exact configuration baked into *this* binary - not whatever the host
7//! environment happens to export at runtime.
8//!
9//! ## Design Rationale
10//!
11//! Three distinct audiences depend on this banner:
12//!
13//! | Audience | Why it matters |
14//! |---|---|
15//! | Log readers (humans) | A pasted session log must show at-a-glance which tier was active when the problem occurred. |
16//! | Regression triage | Confirms the binary on disk was built from the same `.env.Land` that shipped. |
17//! | Cross-element agreement | Pairs with Cocoon's `[LandFix:Tier] Cocoon tier set resolved:` and Sky's `[LandFix:Tier] Sky tier set:`. A mismatch between any two signals configuration drift as the root cause. |
18//!
19//! ## Call Site
20//!
21//! `LogResolvedTiers()` is called unconditionally from `Binary/Main/Entry::Fn`
22//! before the Tokio runtime begins spawning tasks. `dev_log!` is synchronous,
23//! so the banner is guaranteed to land in the log before any extension code
24//! runs.
25//!
26//! Runtime overhead is zero - all `env!(...)` invocations become string
27//! literals at compile time and are inlined into a single write call.
28//!
29//! ## References
30//!
31//! See `Documentation/GitHub/Workflow/TierGatedImplementationSelection.md` for
32//! the end-to-end tier-gating workflow and the matching call sites in Cocoon,
33//! Wind, and Sky. Every capability listed in the boot banner maps to one or
34//! more `// Tier:<Capability>:<Value>` comments at its dispatch site.
35
36use crate::dev_log;
37
38/// Emits one ISO-timestamped line at boot listing the compiled-in value of all
39/// 17 tier variables (`TierRemoteProcedureCall` … `TierTelemetry`). Call once,
40/// from `Binary/Main/Entry::Fn`, after the logging infrastructure is ready and
41/// before the Tokio runtime spawns any tasks.
42pub fn LogResolvedTiers() {
43	dev_log!(
44		"lifecycle",
45		"[LandFix:Tier] Mountain tiers: RemoteProcedureCall={} HTTPProxy={} Logger={} FileSystem={} FindFiles={} \
46		 Glob={} FileWatcher={} SchemeAssets={} Configuration={} Diagnostics={} Clipboard={} OpenExternal={} \
47		 DocumentMirror={} ExtensionActivation={} ExtensionScan={} ModuleCache={} Telemetry={}",
48		env!("TierRemoteProcedureCall"),
49		env!("TierHTTPProxy"),
50		env!("TierLogger"),
51		env!("TierFileSystem"),
52		env!("TierFindFiles"),
53		env!("TierGlob"),
54		env!("TierFileWatcher"),
55		env!("TierSchemeAssets"),
56		env!("TierConfiguration"),
57		env!("TierDiagnostics"),
58		env!("TierClipboard"),
59		env!("TierOpenExternal"),
60		env!("TierDocumentMirror"),
61		env!("TierExtensionActivation"),
62		env!("TierExtensionScan"),
63		env!("TierModuleCache"),
64		env!("TierTelemetry"),
65	);
66}