From 61161585343b0e5f6b966928b94b0876869a6a5f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 3 Dec 2026 03:14:16 +0100 Subject: [PATCH] Attitude: schema validator reads signed integers; catalog counts include the three attitude tools Co-Authored-By: Claude Sonnet 5.5 --- .../src/clock_tests/attitude_tests.rs | 2 +- crates/ghostlight/src/patch.rs | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/crates/ghostlight/src/clock_tests/attitude_tests.rs b/crates/ghostlight/src/clock_tests/attitude_tests.rs index 0695a4e..238276c 100644 --- a/crates/ghostlight/src/clock_tests/attitude_tests.rs +++ b/crates/ghostlight/src/clock_tests/attitude_tests.rs @@ -493,7 +493,7 @@ fn the_derived_opinion_and_its_causes_reach_the_tables_view() { .expect("the table has a regard section"); assert!(line.contains("The Yard Reeve"), "{line}"); assert!(line.contains("regards The Yard Farmer"), "{line}"); - assert!(line.contains("with hostility (-70)"), "{line}"); + assert!(line.contains("with hatred (-70)"), "{line}"); assert!(line.contains("(-70)"), "{line}"); assert!(line.contains("a grievance (-30)"), "{line}"); assert!(line.contains("prejudice toward the outlander (-40)"), "{line}"); diff --git a/crates/ghostlight/src/patch.rs b/crates/ghostlight/src/patch.rs index 70287e4..ad54f2c 100644 --- a/crates/ghostlight/src/patch.rs +++ b/crates/ghostlight/src/patch.rs @@ -7796,7 +7796,7 @@ mod catalog_tests { .iter() .filter(|entry| matches!(entry.shape, PatchToolShape::Operate { .. })) .count(); - assert_eq!((declarations, operations, PATCH_TOOLS.len()), (7, 34, 43)); + assert_eq!((declarations, operations, PATCH_TOOLS.len()), (7, 37, 46)); // Every declaration variant the vocabulary owns is reachable, and the // two payload-carrying entity kinds are not exposed as an `Entity` @@ -7954,7 +7954,7 @@ mod catalog_tests { .count(); assert_eq!( (declare_tools, operate_tools, PATCH_TOOLS.len()), - (7, 34, 43) + (7, 37, 46) ); let declarations = every_declaration(); @@ -8154,16 +8154,26 @@ mod catalog_tests { let inner = schema.get("items").unwrap_or(&Value::Null); items.iter().all(|item| admits(inner, item)) }), - Some("integer") => value.as_u64().is_some_and(|number| { - schema - .get("minimum") - .and_then(Value::as_u64) - .is_none_or(|minimum| number >= minimum) - && schema - .get("maximum") - .and_then(Value::as_u64) - .is_none_or(|maximum| number <= maximum) - }), + Some("integer") => { + // Signed as well as unsigned: a regard may be negative, and + // `u64::MAX` ceilings still need to fit. + let wide = |number: &Value| { + number + .as_i64() + .map(i128::from) + .or_else(|| number.as_u64().map(i128::from)) + }; + wide(value).is_some_and(|number| { + schema + .get("minimum") + .and_then(wide) + .is_none_or(|minimum| number >= minimum) + && schema + .get("maximum") + .and_then(wide) + .is_none_or(|maximum| number <= maximum) + }) + } Some("boolean") => value.is_boolean(), Some("string") => value.is_string(), Some("null") => value.is_null(),