mirror of
https://github.com/ultraworkers/claw-code.git
synced 2026-05-30 11:45:20 +08:00
fix(#704): DiagnosticCheck.json_value now emits stable snake_case id field; doctor checks addressable without scraping name prose
This commit is contained in:
parent
f6cab2711f
commit
8f809d9a9e
@ -2018,7 +2018,14 @@ impl DiagnosticCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn json_value(&self) -> Value {
|
fn json_value(&self) -> Value {
|
||||||
|
// Derive a stable snake_case id from the check name for machine-readable keying (#704).
|
||||||
|
let id = self
|
||||||
|
.name
|
||||||
|
.to_ascii_lowercase()
|
||||||
|
.replace(' ', "_")
|
||||||
|
.replace('-', "_");
|
||||||
let mut value = Map::from_iter([
|
let mut value = Map::from_iter([
|
||||||
|
("id".to_string(), Value::String(id.clone())),
|
||||||
(
|
(
|
||||||
"name".to_string(),
|
"name".to_string(),
|
||||||
Value::String(self.name.to_ascii_lowercase()),
|
Value::String(self.name.to_ascii_lowercase()),
|
||||||
|
|||||||
@ -536,6 +536,12 @@ fn doctor_and_resume_status_emit_json_when_requested() {
|
|||||||
assert!(check["status"].as_str().is_some());
|
assert!(check["status"].as_str().is_some());
|
||||||
assert!(check["summary"].as_str().is_some());
|
assert!(check["summary"].as_str().is_some());
|
||||||
assert!(check["details"].is_array());
|
assert!(check["details"].is_array());
|
||||||
|
// #704: each check must have a stable snake_case id
|
||||||
|
assert!(
|
||||||
|
check["id"].as_str().is_some(),
|
||||||
|
"doctor check missing stable id field: {:?}",
|
||||||
|
check["name"]
|
||||||
|
);
|
||||||
check["name"].as_str().expect("doctor check name")
|
check["name"].as_str().expect("doctor check name")
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user