use std::fs; use serde::Deserialize; #[derive(Debug, Deserialize)] struct G6HostBridgeCallbackSemantics { #[serde(rename = "decisionDate")] decision_date: String, scope: String, #[serde(rename = "startingState")] starting_state: StartingState, #[serde(rename = "completionStates")] completion_states: Vec, #[serde(rename = "semanticRules")] semantic_rules: Vec, #[serde(rename = "selectedFollowup")] selected_followup: SelectedFollowup, notes: Vec, } #[derive(Debug, Deserialize)] struct StartingState { #[serde(rename = "targetGroup")] target_group: String, #[serde(rename = "realExecutionOutOfScope")] real_execution_out_of_scope: bool, #[serde(rename = "implementationOutOfScope")] implementation_out_of_scope: bool, #[serde(rename = "heldGroups")] held_groups: Vec, } #[derive(Debug, Deserialize)] struct CompletionState { state: String, definition: String, } #[derive(Debug, Deserialize)] struct SemanticRule { rule: String, summary: String, } #[derive(Debug, Deserialize)] struct SelectedFollowup { design: String, plan: String, } #[test] fn g6_host_bridge_callback_semantics_stay_bounded() { let asset: G6HostBridgeCallbackSemantics = serde_json::from_str( &fs::read_to_string( "tests/fixtures/generated_scene/g6_host_bridge_callback_semantics_2026-04-19.json", ) .unwrap(), ) .unwrap(); assert_eq!(asset.decision_date, "2026-04-19"); assert_eq!(asset.scope, "g6-host-bridge-callback-semantics"); assert_eq!(asset.starting_state.target_group, "G6"); assert!(asset.starting_state.real_execution_out_of_scope); assert!(asset.starting_state.implementation_out_of_scope); assert_eq!(asset.starting_state.held_groups, vec!["G8"]); assert!(asset .completion_states .iter() .any(|item| item.state == "ok")); assert!(asset .completion_states .iter() .any(|item| item.state == "partial")); assert!(asset .completion_states .iter() .any(|item| item.state == "blocked")); assert!(asset .completion_states .iter() .any(|item| item.state == "error")); assert!(asset .semantic_rules .iter() .any(|item| item.rule == "blocked_has_priority")); assert!(asset .semantic_rules .iter() .any(|item| item.rule == "fatal_error_maps_to_error")); assert!(asset .semantic_rules .iter() .any(|item| item.rule == "non_ok_callback_maps_to_partial")); assert!(asset .semantic_rules .iter() .any(|item| item.rule == "all_ok_maps_to_ok")); assert!(asset .selected_followup .design .ends_with("2026-04-19-g6-host-bridge-callback-state-verification-design.md")); assert!(asset .selected_followup .plan .ends_with("2026-04-19-g6-host-bridge-callback-state-verification-plan.md")); assert!(!asset.notes.is_empty()); }