From c2db7b5002bd1294ac1190e49578a6fa007cb049 Mon Sep 17 00:00:00 2001 From: Ragnor Comerford Date: Thu, 4 Jun 2026 08:56:39 +0200 Subject: [PATCH] fix(cli,server): correct remaining --target references to --graph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L6 renamed the flag but left stragglers. Two were functional: the `resolve_target_uri` "URI must be provided …" error still named `--target`, and `docker/entrypoint.sh` passed `--target` to omnigraph-server (which now only accepts `--graph`) — so the container failed to boot. Both fixed (plus the entrypoint smoke test's expected args). The rest are code comments across the config/server/cli crates and tests, and the cheat sheet, swept `--target` → `--graph`. `--target-branch` (policy explain) is a distinct flag and untouched; past release notes keep `--target` (accurate for those versions). --- crates/omnigraph-cli/src/main.rs | 4 ++-- crates/omnigraph-cli/tests/system_remote.rs | 2 +- crates/omnigraph-config/src/lib.rs | 4 ++-- crates/omnigraph-server/src/lib.rs | 10 +++++----- crates/omnigraph-server/tests/server.rs | 6 +++--- docker/entrypoint.sh | 2 +- docker/entrypoint_test.sh | 2 +- og-cheet-sheet.md | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/omnigraph-cli/src/main.rs b/crates/omnigraph-cli/src/main.rs index 65d8f8d..6fd308b 100644 --- a/crates/omnigraph-cli/src/main.rs +++ b/crates/omnigraph-cli/src/main.rs @@ -1771,7 +1771,7 @@ struct QueriesListOutput { /// Resolve the selected graph to `(local URI, registry selection)` from one /// precedence, so a command's schema and its stored-query registry can never /// come from different graphs. A **positional URI is anonymous** (top-level -/// registry, ignoring the configured default graph); otherwise `--target` +/// registry, ignoring the configured default graph); otherwise `--graph` /// or the configured `cli.graph` names the graph (its per-graph block). /// Mirrors the server's single-mode identity rule. fn resolve_selected_graph( @@ -1861,7 +1861,7 @@ async fn execute_queries_validate( ) -> Result<()> { let config = load_cli_config(config_path)?; // One selection drives both the schema URI and the registry, so a - // positional URI and a `--target` can't validate different graphs. + // positional URI and a `--graph` can't validate different graphs. let (uri, selected) = resolve_selected_graph(&config, uri, target.as_deref(), "queries validate")?; let registry = load_registry_or_report(&config, selected.as_deref())?; diff --git a/crates/omnigraph-cli/tests/system_remote.rs b/crates/omnigraph-cli/tests/system_remote.rs index 73d088a..795d7ae 100644 --- a/crates/omnigraph-cli/tests/system_remote.rs +++ b/crates/omnigraph-cli/tests/system_remote.rs @@ -1028,7 +1028,7 @@ graphs: )], ); - // Client config — the CLI's `--target dev` resolves to `server.base_url`. + // Client config — the CLI's `--graph dev` resolves to `server.base_url`. let client_config_path = cfg_dir.path().join("client.yaml"); fs::write( &client_config_path, diff --git a/crates/omnigraph-config/src/lib.rs b/crates/omnigraph-config/src/lib.rs index 99aae41..e93ba02 100644 --- a/crates/omnigraph-config/src/lib.rs +++ b/crates/omnigraph-config/src/lib.rs @@ -498,7 +498,7 @@ impl OmnigraphConfig { /// with a populated top-level block is rejected; /// * an unknown name errors with the **same** message /// [`OmnigraphConfig::resolve_target_uri`] produces, so a command that - /// opens no URI rejects an unknown `--target` exactly like the + /// opens no URI rejects an unknown `--graph` exactly like the /// URI-resolving commands do; /// * an anonymous selection (`None`, e.g. a bare URI) stays anonymous, /// resolving to the top-level registry downstream (top-level honored). @@ -781,7 +781,7 @@ impl OmnigraphConfig { } let target_name = explicit_target.or(default_target).ok_or_else(|| { - color_eyre::eyre::eyre!("URI must be provided via , --target, or config") + color_eyre::eyre::eyre!("URI must be provided via , --graph, or config") })?; let target = self.graphs.get(target_name).ok_or_else(|| { color_eyre::eyre::eyre!( diff --git a/crates/omnigraph-server/src/lib.rs b/crates/omnigraph-server/src/lib.rs index 49c724e..8d10d2d 100644 --- a/crates/omnigraph-server/src/lib.rs +++ b/crates/omnigraph-server/src/lib.rs @@ -136,7 +136,7 @@ const SERVER_SOURCE_VERSION: Option<&str> = option_env!("OMNIGRAPH_SOURCE_VERSIO #[derive(Debug, Clone)] pub struct ServerConfig { /// Server topology + the graphs to open at startup. Single-mode - /// invocations (`omnigraph-server ` or `--target `) + /// invocations (`omnigraph-server ` or `--graph `) /// produce `ServerConfigMode::Single`; multi-mode invocations /// (`--config omnigraph.yaml` with a non-empty `graphs:` map and /// no single-mode selector) produce `ServerConfigMode::Multi`. @@ -159,7 +159,7 @@ pub struct ServerConfig { pub enum ServerConfigMode { /// Legacy invocation — one graph at the given URI. Either: /// * `omnigraph-server ` (CLI positional), or - /// * `omnigraph-server --target --config omnigraph.yaml`, or + /// * `omnigraph-server --graph --config omnigraph.yaml`, or /// * `omnigraph-server --config omnigraph.yaml` with `server.graph` /// set to a named target. Single { @@ -937,13 +937,13 @@ pub fn load_server_settings( // MR-668 decision 2 — four-rule mode inference matrix. // // 1. CLI `` positional → Single (URI = the value) - // 2. CLI `--target ` → Single (URI = graphs..uri) + // 2. CLI `--graph ` → Single (URI = graphs..uri) // 3. `server.graph` in config → Single (URI = graphs..uri) // 4. `--config` + non-empty `graphs:` + no single-mode selector // → Multi (every entry in `graphs:`) // 5. otherwise → error with migration hint // - // Rules 1-3 are mutually compatible (CLI URI wins over `--target` + // Rules 1-3 are mutually compatible (CLI URI wins over `--graph` // wins over `server.graph`), reusing the existing // `resolve_target_uri` precedence. let has_cli_uri = cli_uri.is_some(); @@ -3388,7 +3388,7 @@ server: ) .unwrap(); - // `--target dev` overrides `server.graph: local`, resolving the named + // `--graph dev` overrides `server.graph: local`, resolving the named // embedded graph. (A remote target is now rejected — see // `single_mode_rejects_named_remote_graph` in tests/server.rs.) let settings = diff --git a/crates/omnigraph-server/tests/server.rs b/crates/omnigraph-server/tests/server.rs index 0e97706..4f0a001 100644 --- a/crates/omnigraph-server/tests/server.rs +++ b/crates/omnigraph-server/tests/server.rs @@ -5642,7 +5642,7 @@ graphs: } } - /// Rule 2: --target picks one graph from `graphs:` map → Single. + /// Rule 2: --graph picks one graph from `graphs:` map → Single. #[test] fn mode_inference_cli_target_is_single() { let temp = tempfile::tempdir().unwrap(); @@ -5772,7 +5772,7 @@ graphs: #[test] fn single_mode_named_graph_rejects_top_level_blocks() { - // Serving a graph by name (`--target`/`server.graph`) uses its + // Serving a graph by name (`--graph`/`server.graph`) uses its // per-graph block; a populated top-level block would be silently // shadowed, so boot refuses and names the per-graph location. let temp = tempfile::tempdir().unwrap(); @@ -5799,7 +5799,7 @@ graphs: #[test] fn single_mode_named_graph_uses_per_graph_policy_and_queries() { - // The identity rule: `--target prod` attaches `graphs.prod`'s own + // The identity rule: `--graph prod` attaches `graphs.prod`'s own // policy + queries, not the top-level ones (which are absent here). let temp = tempfile::tempdir().unwrap(); fs::write( diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a5fb275..cdeda39 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -21,7 +21,7 @@ fi if [ -n "${OMNIGRAPH_CONFIG:-}" ]; then if [ -n "${OMNIGRAPH_TARGET:-}" ]; then - exec "$SERVER_BIN" --config "${OMNIGRAPH_CONFIG}" --target "${OMNIGRAPH_TARGET}" --bind "${bind}" + exec "$SERVER_BIN" --config "${OMNIGRAPH_CONFIG}" --graph "${OMNIGRAPH_TARGET}" --bind "${bind}" fi exec "$SERVER_BIN" --config "${OMNIGRAPH_CONFIG}" --bind "${bind}" fi diff --git a/docker/entrypoint_test.sh b/docker/entrypoint_test.sh index 01fbee2..49c9d4f 100755 --- a/docker/entrypoint_test.sh +++ b/docker/entrypoint_test.sh @@ -52,7 +52,7 @@ check "CONFIG only" \ got=$(OMNIGRAPH_CONFIG="/etc/omnigraph/omnigraph.yaml" OMNIGRAPH_TARGET="active" OMNIGRAPH_BIND="0.0.0.0:8080" sh "$ep") check "CONFIG + TARGET" \ - "ARGS: --config /etc/omnigraph/omnigraph.yaml --target active --bind 0.0.0.0:8080" "$got" + "ARGS: --config /etc/omnigraph/omnigraph.yaml --graph active --bind 0.0.0.0:8080" "$got" got=$(sh "$ep" some-uri --bind 1.2.3.4:9 --extra) check "explicit args passthrough" \ diff --git a/og-cheet-sheet.md b/og-cheet-sheet.md index 2cb4d76..8f71f46 100644 --- a/og-cheet-sheet.md +++ b/og-cheet-sheet.md @@ -19,7 +19,7 @@ omnigraph check --query ./queries.gq s3://bucket/repo Use `omnigraph.yaml` target resolution: ```bash -omnigraph lint --query ./queries.gq --target local --config ./omnigraph.yaml +omnigraph lint --query ./queries.gq --graph local --config ./omnigraph.yaml ``` > The previous `omnigraph query lint` / `omnigraph query check` spellings