From c1971d4ed7d6bfe72ef70ec0bf028d8463b7f3f1 Mon Sep 17 00:00:00 2001 From: Brummel Date: Fri, 10 Jul 2026 19:20:33 +0200 Subject: [PATCH] fix(cli): the graph render positional shape-discriminates op-scripts like its siblings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aura graph exited 2 mislabeling the valid JSON array as 'blueprint document is not valid JSON' — dispatch_graph parsed the render positional with the envelope-only blueprint_from_json while the introspect siblings (register, --params, --content-id) route through composite_from_any. The render positional now uses the same shape-discriminating path (made pub(crate)); an op-script renders byte-identically to its built envelope, and a genuinely-bad document gets the shared honest error including the unresolved-namespace hint (preserved verbatim in composite_from_any's envelope arm). Verified: RED test green, full workspace suite green (independent mini-verify). closes #226 --- crates/aura-cli/src/graph_construct.rs | 2 +- crates/aura-cli/src/main.rs | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/aura-cli/src/graph_construct.rs b/crates/aura-cli/src/graph_construct.rs index 75a56fb..a6a190e 100644 --- a/crates/aura-cli/src/graph_construct.rs +++ b/crates/aura-cli/src/graph_construct.rs @@ -431,7 +431,7 @@ pub(crate) fn blueprint_slot_prose(doc: &str, env: &crate::project::Env) -> Resu /// envelope (a JSON object: `format_version` + `blueprint`) OR a construction /// op-list (a JSON array) — shape-discriminated on the top-level JSON type, /// each canonicalized by its own rules. -fn composite_from_any(text: &str, env: &crate::project::Env) -> Result { +pub(crate) fn composite_from_any(text: &str, env: &crate::project::Env) -> Result { let value: serde_json::Value = serde_json::from_str(text).map_err(|e| format!("invalid document: {e}"))?; match value { diff --git a/crates/aura-cli/src/main.rs b/crates/aura-cli/src/main.rs index 83ae95b..3b64908 100644 --- a/crates/aura-cli/src/main.rs +++ b/crates/aura-cli/src/main.rs @@ -2730,12 +2730,7 @@ fn dispatch_graph(a: GraphCmd, env: &project::Env) { eprintln!("aura: {path}: {e}"); std::process::exit(2); }); - let bp = blueprint_from_json(&doc, &|t| env.resolve(t)).unwrap_or_else(|e| { - let mut msg = graph_construct::blueprint_load_prose(&e); - if let Some(hint) = graph_construct::unresolved_namespace_hint(&e, env) { - msg.push_str(" — "); - msg.push_str(&hint); - } + let bp = graph_construct::composite_from_any(&doc, env).unwrap_or_else(|msg| { eprintln!("aura: {path}: {msg}"); std::process::exit(2); });