From 76984ecd716d0488ea464810a22a38c73ea7fe39 Mon Sep 17 00:00:00 2001 From: Weksa Date: Tue, 10 Nov 2026 18:03:47 +0000 Subject: [PATCH] show-working: refusal carries the closed reason only, no Debug of LowerError Co-Authored-By: Claude Sonnet 5.5 --- crates/weksa/examples/show_working.rs | 21 ++++++++++++++++++++- tools/show-working/build.py | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) 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"

Closeness to the corpus ({e(data['build']['embedder'])})

{''.join(sc)}") if o["kind"] == "lower_error": er = o["error"] - return f"

Refused by the lowerer

LowerError::{e(er['variant'])}: {e(er['reason'])}
{e(er['debug'])}

No text, so no score: nothing was invented to score.

" + return f"

Refused by the lowerer

LowerError::{e(er['variant'])}: {e(er['reason'])}

No text, so no score: nothing was invented to score.

" items = "".join(f"
  • {e(r['rule'])} {e(r['detail'])}
  • " for r in o["refusals"]) return f"

    Refused at admission

      {items}

    The packet never became a lowering input, so the lowerer never saw it.

    "