fix(config): eager-resolve the storage URI so it can't diverge from entry.uri

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.
This commit is contained in:
Ragnor Comerford 2026-06-05 12:40:23 +02:00
parent 34c0af8469
commit d0a44cba23
No known key found for this signature in database

View file

@ -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());