diff --git a/crates/weksa/examples/show_working.rs b/crates/weksa/examples/show_working.rs index 897bc13..dae9ca9 100644 --- a/crates/weksa/examples/show_working.rs +++ b/crates/weksa/examples/show_working.rs @@ -260,7 +260,7 @@ fn lower_error(e: &LowerError) -> Value { LowerError::AskerNotAddressee { predication } => ("AskerNotAddressee", format!("the agent of {predication} is not the addressee")), LowerError::EntityRead { entity, why } => ("EntityRead", format!("reading {entity}: {why}")), }; - json!({ "variant": variant, "reason": reason, "debug": format!("{e:?}") }) + json!({ "variant": variant, "reason": reason }) } struct World { @@ -375,3 +375,22 @@ fn main() { let _ = std::fs::remove_dir_all(&dir); println!("{}", serde_json::to_string_pretty(&json!({ "fixtures": out })).expect("json")); } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn refusal_carries_the_closed_reason_never_a_debug_of_the_error() { + // UnknownPhone holds the ruled IPA text; no field of the output may. + let e = LowerError::UnknownPhone { + entity: EntityId::parse("entity:nibu").expect("entity id"), + at: 3, + text: "CANARY-IPA".into(), + }; + let v = lower_error(&e); + assert!(!v.to_string().contains("CANARY")); + let keys: Vec<_> = v.as_object().expect("object").keys().cloned().collect(); + assert_eq!(keys, ["reason", "variant"]); + } +} diff --git a/tools/show-working/build.py b/tools/show-working/build.py index a4c9bc5..bc863f4 100755 --- a/tools/show-working/build.py +++ b/tools/show-working/build.py @@ -182,7 +182,7 @@ def outcome_html(fx): f"