108 lines
3.1 KiB
Rust
108 lines
3.1 KiB
Rust
use std::fs;
|
|
|
|
use serde::Deserialize;
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct G6HostBridgeExecutionSemantics {
|
|
#[serde(rename = "decisionDate")]
|
|
decision_date: String,
|
|
scope: String,
|
|
#[serde(rename = "startingState")]
|
|
starting_state: StartingState,
|
|
#[serde(rename = "semanticModel")]
|
|
semantic_model: SemanticModel,
|
|
#[serde(rename = "semanticBoundaries")]
|
|
semantic_boundaries: Vec<SemanticBoundary>,
|
|
#[serde(rename = "selectedFollowup")]
|
|
selected_followup: SelectedFollowup,
|
|
notes: Vec<String>,
|
|
}
|
|
|
|
#[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<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct SemanticModel {
|
|
#[serde(rename = "bridgeInvocation")]
|
|
bridge_invocation: SemanticSlice,
|
|
#[serde(rename = "callbackCompletion")]
|
|
callback_completion: SemanticSlice,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct SemanticSlice {
|
|
name: String,
|
|
summary: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct SemanticBoundary {
|
|
slice: String,
|
|
status: String,
|
|
reason: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
struct SelectedFollowup {
|
|
design: String,
|
|
plan: String,
|
|
}
|
|
|
|
#[test]
|
|
fn g6_host_bridge_execution_semantics_stay_bounded() {
|
|
let asset: G6HostBridgeExecutionSemantics = serde_json::from_str(
|
|
&fs::read_to_string(
|
|
"tests/fixtures/generated_scene/g6_host_bridge_execution_semantics_2026-04-19.json",
|
|
)
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
|
|
assert_eq!(asset.decision_date, "2026-04-19");
|
|
assert_eq!(asset.scope, "g6-host-bridge-execution-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_eq!(
|
|
asset.semantic_model.bridge_invocation.name,
|
|
"host-bridge-action-invocation"
|
|
);
|
|
assert_eq!(
|
|
asset.semantic_model.callback_completion.name,
|
|
"callback-request-completion"
|
|
);
|
|
|
|
assert!(asset
|
|
.semantic_boundaries
|
|
.iter()
|
|
.any(|item| item.slice == "bridge_action_invocation" && item.status == "selected"));
|
|
assert!(asset
|
|
.semantic_boundaries
|
|
.iter()
|
|
.any(|item| item.slice == "callback_completion_semantics" && item.status == "selected"));
|
|
assert!(asset.semantic_boundaries.iter().any(|item| item.slice
|
|
== "host_runtime_transport_rebuild"
|
|
&& item.status == "out-of-scope"));
|
|
|
|
assert!(asset
|
|
.selected_followup
|
|
.design
|
|
.ends_with("2026-04-19-g6-host-bridge-callback-semantics-design.md"));
|
|
assert!(asset
|
|
.selected_followup
|
|
.plan
|
|
.ends_with("2026-04-19-g6-host-bridge-callback-semantics-plan.md"));
|
|
assert!(!asset.notes.is_empty());
|
|
}
|