diff --git a/crates/omnigraph-cli/tests/support/mod.rs b/crates/omnigraph-cli/tests/support/mod.rs index 855d8e0..c30ed28 100644 --- a/crates/omnigraph-cli/tests/support/mod.rs +++ b/crates/omnigraph-cli/tests/support/mod.rs @@ -218,6 +218,18 @@ pub fn spawn_server_with_cluster(cluster_dir: &Path) -> TestServer { spawn_server_process(command) } +/// Cluster boot with the server process's cwd set explicitly — used to prove +/// rule 0 never touches the cwd omnigraph.yaml search. +pub fn spawn_server_with_cluster_in(cluster_dir: &Path, cwd: &Path) -> TestServer { + let mut command = server_process(); + command + .arg("--cluster") + .arg(cluster_dir) + .arg("--unauthenticated") + .current_dir(cwd); + spawn_server_process(command) +} + pub fn spawn_server_with_cluster_env(cluster_dir: &Path, envs: &[(&str, &str)]) -> TestServer { let mut command = server_process(); command.arg("--cluster").arg(cluster_dir); diff --git a/crates/omnigraph-cli/tests/system_local.rs b/crates/omnigraph-cli/tests/system_local.rs index 4b5e4b6..b2afdab 100644 --- a/crates/omnigraph-cli/tests/system_local.rs +++ b/crates/omnigraph-cli/tests/system_local.rs @@ -2152,3 +2152,37 @@ policies: // unknown query — the server's anti-probing contract. assert_eq!(invoke("admin-token").status().as_u16(), 404); } + +/// Rule 0 (axiom 15): a --cluster server never reads omnigraph.yaml — not +/// even the implicit cwd search. A MALFORMED config in the process cwd must +/// not affect boot or serving. +#[test] +fn cluster_server_boot_ignores_local_config_in_cwd() { + let cluster = tempfile::tempdir().unwrap(); + std::fs::write( + cluster.path().join("people.pg"), + "\nnode Person {\n name: String @key\n}\n", + ) + .unwrap(); + std::fs::write( + cluster.path().join("cluster.yaml"), + "version: 1\ngraphs:\n knowledge:\n schema: ./people.pg\n", + ) + .unwrap(); + for command in ["import", "apply"] { + let output = cli() + .arg("cluster") + .arg(command) + .arg("--config") + .arg(cluster.path()) + .output() + .unwrap(); + assert!(output.status.success(), "cluster {command} failed"); + } + let cwd = tempfile::tempdir().unwrap(); + std::fs::write(cwd.path().join("omnigraph.yaml"), "{{{{ not yaml").unwrap(); + + let server = spawn_server_with_cluster_in(cluster.path(), cwd.path()); + let response = reqwest::blocking::get(format!("{}/healthz", server.base_url)).unwrap(); + assert!(response.status().is_success()); +}