Skip to main content

DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_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
22//! `Binary::Main::Entry::Fn` before the Tokio runtime begins spawning tasks.
23//! `dev_log!` is synchronous, so the banner is guaranteed to land in the log
24//! before any extension code 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 build-baked tier variables + 1 runtime tier. Call once from
40/// `Binary::Main::Entry::Fn`, after the logging infrastructure is ready
41/// and before the Tokio runtime spawns any tasks.
42pub fn LogResolvedTiers() {
43	// Build-baked tiers use env!() - values are baked from .env.Land at build time.
44	dev_log!(
45		"lifecycle",
46		"[LandFix:Tier] Mountain tiers: RemoteProcedureCall={} HTTPProxy={} Logger={} FileSystem={} FindFiles={} \
47		 Glob={} FileWatcher={} SchemeAssets={} Configuration={} Diagnostics={} Clipboard={} OpenExternal={} \
48		 DocumentMirror={} ExtensionActivation={} ExtensionScan={} ModuleCache={} Telemetry={}",
49		env!("TierRemoteProcedureCall"),
50		env!("TierHTTPProxy"),
51		env!("TierLogger"),
52		env!("TierFileSystem"),
53		env!("TierFindFiles"),
54		env!("TierGlob"),
55		env!("TierFileWatcher"),
56		env!("TierSchemeAssets"),
57		env!("TierConfiguration"),
58		env!("TierDiagnostics"),
59		env!("TierClipboard"),
60		env!("TierOpenExternal"),
61		env!("TierDocumentMirror"),
62		env!("TierExtensionActivation"),
63		env!("TierExtensionScan"),
64		env!("TierModuleCache"),
65		env!("TierTelemetry"),
66	);
67	// Runtime-only tiers use std::env::var - readable without a rebuild.
68	let IPC = std::env::var("TierIPC").unwrap_or_else(|_| "Mountain".into());
69	dev_log!("lifecycle", "[LandFix:Tier] Runtime: IPC={}", IPC);
70}