Align integration fixtures with reviewed schema and planner behavior

This commit is contained in:
firestar5683
2026-11-10 19:24:16 -06:00
parent 621cc55ea4
commit fa9ff611e9
4 changed files with 100 additions and 3 deletions
@@ -920,6 +920,66 @@
}
}
]
},
"0xda96579883444c35": {
"kind": "struct",
"before_name": "StarPilotLongitudinalPlan",
"after_name": "StarPilotLongitudinalPlan",
"old_field_count": 5,
"old_storage": {
"dataWordCount": 4,
"pointerCount": 0,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
"discriminantOffset": 0
},
"new_storage": {
"dataWordCount": 5,
"pointerCount": 0,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
"discriminantOffset": 0
},
"added_fields": [
{
"slot": {
"offset": 17,
"type": {
"bool": null
},
"defaultValue": {
"bool": false
},
"hadExplicitDefault": false
},
"name": "forceStopBraking",
"codeOrder": 5,
"discriminantValue": 65535,
"ordinal": {
"explicit": 5
}
},
{
"slot": {
"offset": 4,
"type": {
"uint64": null
},
"defaultValue": {
"uint64": 0
},
"hadExplicitDefault": false
},
"name": "forceStopEpisodeMonoTime",
"codeOrder": 6,
"discriminantValue": 65535,
"ordinal": {
"explicit": 6
}
}
]
}
},
"published_addition_commits": {
@@ -290,3 +290,40 @@ def test_compiled_compatibility_check_rejects_unreviewed_changes(tmp_path, field
else:
with pytest.raises(AssertionError):
compare_node(old, new)
def test_additive_force_stop_fields_preserve_defaults_and_incumbent_relay(historical):
old = historical.StarPilotLongitudinalPlan.new_message(
version=1, sourcePlanMonoTime=11, modelMonoTime=22, driveStartMonoTime=33, forceStopHolding=True)
incumbent = old.to_dict()
with custom.StarPilotLongitudinalPlan.from_bytes(old.to_bytes()) as decoded:
assert not decoded.forceStopBraking
assert decoded.forceStopEpisodeMonoTime == 0
current = decoded.as_builder()
current.forceStopBraking = True
current.forceStopEpisodeMonoTime = 44
expected = current.to_dict()
with historical.StarPilotLongitudinalPlan.from_bytes(current.to_bytes()) as prior:
assert prior.to_dict() == incumbent
relayed = prior.as_builder().to_bytes()
with custom.StarPilotLongitudinalPlan.from_bytes(relayed) as recovered:
assert recovered.to_dict() == expected
@pytest.mark.parametrize(('before', 'after'), [
('forceStopHolding @4 :Bool;', 'forceStopHolding @4 :Bool = true;'),
('forceStopBraking @5 :Bool;', 'forceStopBraking @5 :UInt8;'),
('forceStopBraking @5 :Bool;', 'forceStopBraking @5 :Bool = true;'),
('forceStopEpisodeMonoTime @6 :UInt64;', 'forceStopEpisodeMonoTime @6 :UInt32;'),
('forceStopEpisodeMonoTime @6 :UInt64;', 'forceStopEpisodeMonoTime @6 :UInt64 = 1;'),
('forceStopEpisodeMonoTime @6 :UInt64;', 'forceStopEpisodeMonoTime @6 :UInt64; unreviewed @7 :Bool;'),
])
def test_reviewed_force_stop_addition_rejects_other_changes(historical, tmp_path, before, after):
source = Path(CEREAL_PATH, 'custom.capnp').read_text()
assert source.count(before) == 1
path = tmp_path / 'unreviewed-force-stop.capnp'
path.write_text(source.replace(before, after))
parser = capnp.SchemaParser()
changed = parser.load(str(path), imports=[CEREAL_PATH, str(files('opendbc') / 'car')])
with pytest.raises(AssertionError):
compare_node(historical.StarPilotLongitudinalPlan, changed.StarPilotLongitudinalPlan)
@@ -55,7 +55,7 @@ def test_generic_admission_is_brand_independent_and_stock_is_display_only(tmp_pa
def test_factory_defaults_and_hidden_vision_control_producer(tmp_path):
params, cp = Params(str(tmp_path)), toyota()
settings = slc_runtime_settings(params, cp, {})
assert settings.selection.slots[:2] == (Source.VISION, Source.DASHBOARD)
assert settings.selection.slots == (Source.VISION, Source.MAP, None)
assert not settings.enabled and settings.display
assert enabled(params, cp, 'conditional', {})
assert enabled(params, cp, 'slc', {}) and enabled(params, cp, 'vision', {})
@@ -87,7 +87,7 @@ def test_toyota_actual_default_plannerd_constructs_requested_hosts(tmp_path):
conditional.assert_called_once()
profiles.assert_called_once()
assert 'slcState' in publisher.call_args.args[0]
assert 'slcCruiseCommand' in publisher.call_args.args[0]
assert 'starpilotLongitudinalPlan' in publisher.call_args.args[0]
for source in ('slcDashboardObservation', 'slcVisionObservation', 'mapdOut'):
assert source in subscriber.call_args.args[0]
assert plannerd.SavedSlcLifecycle(params, cp, {}).refresh(NOW)[0] is not None
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "4b46202fb4638a6dd6d8114db0e3dedec1f76f71f26485e9c873c45231fc541f", "schema_version": 1}
{"protected_inventory_sha256": "564936502787eb31343301c5990a945d1a2b10904bbe5e7af1022bef47da7c93", "schema_version": 1}