feat: complete dual-seat whole-vehicle orchestration
This commit is contained in:
@@ -190,6 +190,88 @@ class NativeStateSyncTests(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(after, before)
|
||||
|
||||
def test_verified_read_only_ch1_feedback_updates_only_driver(self) -> None:
|
||||
state = self.store.synchronize_physical_ch1_feedback(
|
||||
"conv-native-sync",
|
||||
[{
|
||||
"source": "physical_can_ch1",
|
||||
"channel": 1,
|
||||
"frame_id": "0x4FA",
|
||||
"feedback_frame_id": "0x4FA",
|
||||
"valid": True,
|
||||
"verification": {
|
||||
"authoritative": True,
|
||||
"channel": 1,
|
||||
"simulated": False,
|
||||
"read_only": True,
|
||||
"frame_id": "0x4FA",
|
||||
"payload_size": 8,
|
||||
},
|
||||
"actuator_state": {
|
||||
"driver": {"ventilation": {"state": "on", "level": 3}}
|
||||
},
|
||||
}],
|
||||
)
|
||||
self.assertEqual(state["devices"]["driver"]["ventilation"]["level"], 3)
|
||||
self.assertEqual(
|
||||
state["devices"]["driver"]["ventilation"]["feedback_source"],
|
||||
"physical_can_ch1",
|
||||
)
|
||||
self.assertEqual(state["devices"]["passenger"]["ventilation"]["state"], "off")
|
||||
|
||||
def test_verified_vehicle_safety_and_door_feedback_feed_whole_vehicle_state(self) -> None:
|
||||
def feedback(frame_id: str, **state_patch: dict) -> dict:
|
||||
return {
|
||||
"source": "physical_can_ch1",
|
||||
"channel": 1,
|
||||
"frame_id": frame_id,
|
||||
"feedback_frame_id": frame_id,
|
||||
"valid": True,
|
||||
"verification": {
|
||||
"authoritative": True,
|
||||
"channel": 1,
|
||||
"simulated": False,
|
||||
"read_only": True,
|
||||
"frame_id": frame_id,
|
||||
"payload_size": 8,
|
||||
},
|
||||
**state_patch,
|
||||
}
|
||||
|
||||
state = self.store.synchronize_physical_ch1_feedback(
|
||||
"conv-native-sync",
|
||||
[
|
||||
feedback("0x342", vehicle_safety={"gear": "P"}),
|
||||
feedback("0x4EB", vehicle_safety={"speed_kmh": 0.0}),
|
||||
feedback(
|
||||
"0x407",
|
||||
domain_state={
|
||||
"door": {
|
||||
"locks": {
|
||||
"front_left": {"state": "lock"},
|
||||
"front_right": {"state": "unlock"},
|
||||
"rear_left": {"state": "lock"},
|
||||
"rear_right": {"state": "lock"},
|
||||
},
|
||||
"vehicle_lock": {"state": "unknown"},
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
vehicle_status = state["domain_devices"]["vehicle_status"]
|
||||
self.assertEqual(vehicle_status["gear"], "P")
|
||||
self.assertEqual(vehicle_status["speed_kmh"], 0.0)
|
||||
self.assertTrue(vehicle_status["stationary"])
|
||||
self.assertEqual(vehicle_status["feedback_source"], "physical_can_ch1")
|
||||
door = state["domain_devices"]["door"]
|
||||
self.assertEqual(door["locks"]["front_right"]["state"], "unlock")
|
||||
self.assertEqual(
|
||||
door["locks"]["front_right"]["feedback_source"],
|
||||
"physical_can_ch1",
|
||||
)
|
||||
|
||||
def test_unverified_or_empty_feedback_never_updates_state(self) -> None:
|
||||
before = self.store.snapshot("conv-native-sync")
|
||||
for feedback in (
|
||||
|
||||
Reference in New Issue
Block a user