From a418c284b57fd79cd1eccaa59b12a5d22d88dbf3 Mon Sep 17 00:00:00 2001 From: beardthelion <56458543+beardthelion@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:20:32 -0500 Subject: [PATCH] fix(gl): report quickstart registration failure when the node returns no UCAN (#355) A 2xx with a non-JSON or ucan-less body still printed "Registered successfully / UCAN saved to ..." while nothing was written, and left a stale ucan.json from another node in place. Print the success lines only when a UCAN was actually persisted. --- crates/gl/src/quickstart.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/gl/src/quickstart.rs b/crates/gl/src/quickstart.rs index 8b901ad9..1f67d339 100644 --- a/crates/gl/src/quickstart.rs +++ b/crates/gl/src/quickstart.rs @@ -108,11 +108,17 @@ pub async fn run(args: QuickstartArgs) -> Result<()> { "saved_at": chrono::Utc::now().to_rfc3339(), }); std::fs::write(&ucan_path, serde_json::to_string_pretty(&record)?)?; + let trust = payload["trust_score"].as_f64().unwrap_or(0.0); + println!(" ✓ Registered successfully"); + println!(" Trust score: {trust:.2}"); + println!(" UCAN saved to {}", ucan_path.display()); + } else { + // A 2xx without a usable ucan is not a registration; the + // response may not even be JSON. Saying success here would + // also leave a stale ucan.json from another node in place. + println!(" ✗ Registration returned no UCAN (unexpected response body)"); + println!(" You can retry with: gl register --node {}", args.node); } - let trust = payload["trust_score"].as_f64().unwrap_or(0.0); - println!(" ✓ Registered successfully"); - println!(" Trust score: {trust:.2}"); - println!(" UCAN saved to {}", ucan_path.display()); println!(); } Ok(resp) => {