From d0a44cba2351bc7c2d9d75722de8975d09897817 Mon Sep 17 00:00:00 2001 From: Ragnor Comerford Date: Fri, 5 Jun 2026 12:40:23 +0200 Subject: [PATCH] fix(config): eager-resolve the storage URI so it can't diverge from entry.uri MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit resolve_all_paths_in_place absolutized the derived entry.uri but left the raw Storage::Bare/Block uri relative, so config view showed `uri: /abs` beside `storage: ./rel` and a future reader of storage.uri (V2 region/endpoint threading) would mis-resolve. Resolve the storage uri too. The eager test now exercises the storage block form — the coverage gap that let this slip. --- crates/omnigraph-config/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/omnigraph-config/src/lib.rs b/crates/omnigraph-config/src/lib.rs index 2b78978..2a6dc99 100644 --- a/crates/omnigraph-config/src/lib.rs +++ b/crates/omnigraph-config/src/lib.rs @@ -980,6 +980,13 @@ impl OmnigraphConfig { if !graph.uri.is_empty() { graph.uri = resolve_uri_against(&base, &graph.uri); } + // Resolve the raw storage URI too (bare and block forms) so it can't + // diverge from the derived `entry.uri`. + match &mut graph.storage { + Some(Storage::Bare(uri)) => *uri = resolve_uri_against(&base, uri), + Some(Storage::Block(block)) => block.uri = resolve_uri_against(&base, &block.uri), + None => {} + } if let Some(file) = graph.policy.file.take() { graph.policy.file = Some(resolve_path_against(&base, &file)); } @@ -1417,6 +1424,8 @@ graphs: policy: { file: ./p/emb.yaml } queries: q: { file: ./q/emb.gq } + emb_block: + storage: { uri: ./eb.omni, region: r } rem: server: s serve: @@ -1437,6 +1446,18 @@ query: assert!(Path::new(&emb.uri).is_absolute(), "graph uri: {}", emb.uri); assert!(Path::new(emb.policy.file.as_ref().unwrap()).is_absolute()); assert!(Path::new(&emb.queries["q"].file).is_absolute()); + // The raw storage URI (bare and block forms) must be resolved too, not + // just the derived `entry.uri` — else `storage` diverges from `uri`. + let bare_storage = emb.storage.as_ref().unwrap().uri(); + assert!( + Path::new(bare_storage).is_absolute(), + "bare storage uri: {bare_storage}" + ); + let block_storage = config.graphs["emb_block"].storage.as_ref().unwrap().uri(); + assert!( + Path::new(block_storage).is_absolute(), + "block storage uri: {block_storage}" + ); // A remote graph's `uri` is the server endpoint (scheme URL) — passes through. assert!(config.graphs["rem"].uri.contains("://")); assert!(Path::new(config.serve.policy.file.as_ref().unwrap()).is_absolute());