fix(cli): the graph render positional shape-discriminates op-scripts like its siblings
aura graph <op-script.json> 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
This commit is contained in:
@@ -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<Composite, String> {
|
||||
pub(crate) fn composite_from_any(text: &str, env: &crate::project::Env) -> Result<Composite, String> {
|
||||
let value: serde_json::Value =
|
||||
serde_json::from_str(text).map_err(|e| format!("invalid document: {e}"))?;
|
||||
match value {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user