diff --git a/crates/gateway/src/main.rs b/crates/gateway/src/main.rs index a88aa38..e44a7a4 100644 --- a/crates/gateway/src/main.rs +++ b/crates/gateway/src/main.rs @@ -68,6 +68,27 @@ async fn main() { let access = access::AccessControl::new(config.auth.enabled); access.register_defaults().await; + // Phase 42 — file-backed truth rules. Probes the `truth/` directory + // at repo root (or $LAKEHOUSE_TRUTH_DIR override) and logs how many + // rules load. Current request paths still build their own stores + // via truth::default_truth_store() / truth::sql_query_guard_store(); + // the composed-at-boot store gets plumbed through V1State in a + // follow-up. This boot probe catches parse errors + duplicate-ID + // collisions early rather than at first request. + { + let truth_dir = std::env::var("LAKEHOUSE_TRUTH_DIR") + .unwrap_or_else(|_| "/home/profit/lakehouse/truth".to_string()); + if std::path::Path::new(&truth_dir).exists() { + let mut probe_store = truth::default_truth_store(); + match truth::loader::load_from_dir(&mut probe_store, &truth_dir) { + Ok(n) => tracing::info!("truth: loaded {n} file-backed rule(s) from {truth_dir}"), + Err(e) => tracing::warn!("truth: failed to load rules from {truth_dir}: {e}"), + } + } else { + tracing::debug!("truth: no rule dir at {truth_dir}, skipping file-backed load"); + } + } + // Workspace manager for agent-specific overlays let workspace_mgr = queryd::workspace::WorkspaceManager::new(store.clone()); if let Err(e) = workspace_mgr.rebuild().await {