From 7fbe552da896dfac848e5fd488bdd0618f2fc40b Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sat, 28 Nov 2026 23:20:14 -0600 Subject: [PATCH] Repair CI fixtures after Card and UI changes --- .../test_blended_longitudinal_lifecycle.py | 2 +- .../test_classic_family_cancel_caller.py | 2 +- .../test_classic_family_startup_caller.py | 2 +- .../tests/test_ordinary_classic_caller.py | 2 +- .../aol/tests/test_gm_startup_continuity.py | 1 + .../starpilot/galaxy/tests/test_models.py | 4 ++- .../tests/test_vehicle_state_context.py | 2 +- .../starpilot/ui/feature_settings_owner.py | 33 ++++++++++++------- .../ui/tests/test_chestnut_display.py | 2 +- .../ui/tests/test_native_settings_pages.py | 4 +-- .../ui/tests/test_spacepilot_entry.py | 1 + .../starpilot/ui/tests/test_widget_layers.py | 2 +- prebuilt.json | 2 +- 13 files changed, 37 insertions(+), 22 deletions(-) diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_blended_longitudinal_lifecycle.py b/opendbc_repo/opendbc/car/hyundai/tests/test_blended_longitudinal_lifecycle.py index ce86c9fd3c..7abac14c01 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_blended_longitudinal_lifecycle.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_blended_longitudinal_lifecycle.py @@ -329,7 +329,7 @@ class TestBlendedLifecycle(unittest.TestCase): car._deferred_radar_can = None vars(car)['RI'] = SimpleNamespace(update=lambda can_list: None) vars(car)['state_publish'] = lambda *args: calls.append('state') - car.CP = SimpleNamespace(passive=False) + car.CP = SimpleNamespace(brand='hyundai', passive=False) car.ci_initialized = False class SM(dict): diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_cancel_caller.py b/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_cancel_caller.py index 58a46236b4..bc866f485c 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_cancel_caller.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_cancel_caller.py @@ -216,7 +216,7 @@ def test_actual_classic_family_cancel_and_manual_withdrawal(identity, monkeypatc config = card.CP.safetyConfigs[0] model, word = int(config.safetyModel.raw), int(config.safetyParam) configured = [False] - dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body + dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body assignments = [node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)] decisions = [node for node in dispatch_tree if isinstance(node, ast.If) and ast.unparse(node.test) == 'not self.CP.passive and initialized'] diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_startup_caller.py b/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_startup_caller.py index d8bceb4162..e15b6f87cb 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_startup_caller.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_classic_family_startup_caller.py @@ -243,7 +243,7 @@ def test_classic_family_actual_startup_cancel_and_manual_withdrawal(identity, mo config = card.CP.safetyConfigs[0] model, word = int(config.safetyModel.raw), int(config.safetyParam) configured = [False] - dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body + dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body assignments = [ node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets) ] diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_ordinary_classic_caller.py b/opendbc_repo/opendbc/car/hyundai/tests/test_ordinary_classic_caller.py index f9e9f6cdd8..213b59f89f 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_ordinary_classic_caller.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_ordinary_classic_caller.py @@ -227,7 +227,7 @@ def test_prepublication_classic_owner_preserves_real_boot_and_independent_axes(i config = card.CP.safetyConfigs[0] model, word = int(config.safetyModel.raw), int(config.safetyParam) configured = [False] - dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body + dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body assignments = [ node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets) ] diff --git a/openpilot/starpilot/aol/tests/test_gm_startup_continuity.py b/openpilot/starpilot/aol/tests/test_gm_startup_continuity.py index e8306a322b..1bbab487fb 100644 --- a/openpilot/starpilot/aol/tests/test_gm_startup_continuity.py +++ b/openpilot/starpilot/aol/tests/test_gm_startup_continuity.py @@ -27,6 +27,7 @@ def test_all_gm_initializing_steps_keep_servicing_handoff(cp): state_update=Mock(return_value=(cs, None)), state_publish=Mock(), controls_update=Mock(), _deferred_radar_can=None, radar_update=Mock(), radar_publish=Mock()) + card._step = Car._step.__get__(card) events = [SimpleNamespace(name=1)] card.sm = type('SM', (), {'seen': {'onroadEvents': True}, '__getitem__': lambda _, key: events if key == 'onroadEvents' else None})() for method in ('gm_startup_keepalive', 'volt_startup_keepalive', 'volt_sdgm_startup_keepalive'): diff --git a/openpilot/starpilot/galaxy/tests/test_models.py b/openpilot/starpilot/galaxy/tests/test_models.py index 23234f0822..15b03b2d92 100644 --- a/openpilot/starpilot/galaxy/tests/test_models.py +++ b/openpilot/starpilot/galaxy/tests/test_models.py @@ -148,7 +148,9 @@ class LocalModelManagerHttpTest(unittest.TestCase): self.assertEqual(status, 200) self.assertTrue(laboratory['runtimeSupported']) self.assertFalse(laboratory['runtime']['active']) - self.assertEqual(laboratory['summary']['published'], 92) + published = {row['value'] for row in laboratory['models'] if row['modelLabArtifactAvailable']} + self.assertLessEqual({'gwm8223', 'sc23'}, published) + self.assertEqual(laboratory['summary']['published'], len(published)) pair = {'enabled': False, 'lateralModel': 'gwm8223', 'longitudinalModel': 'sc23'} self.assertEqual(request('/api/models/laboratory', pair)[0], 200) self.assertEqual(request('/api/models/laboratory', {**pair, 'enabled': True})[0], 409) diff --git a/openpilot/starpilot/tests/test_vehicle_state_context.py b/openpilot/starpilot/tests/test_vehicle_state_context.py index 4ca26c52bc..ebb09f8c8f 100644 --- a/openpilot/starpilot/tests/test_vehicle_state_context.py +++ b/openpilot/starpilot/tests/test_vehicle_state_context.py @@ -108,7 +108,7 @@ class TestVehicleStateContext(unittest.TestCase): enable_edge = next(node for node in helper.body[0].body if isinstance(node, ast.If) and initialize in ast.walk(node)) self.assertEqual(ast.unparse(enable_edge.test), "self.sm['carControl'].enabled and (not self.CC_prev.enabled)") self.assertIn(initialize, list(ast.walk(enable_edge))) - step = inspect.getsource(card.Car.step) + step = inspect.getsource(card.Car._step) step_tree = ast.parse(textwrap.dedent(step)) state_update = next(node for node in ast.walk(step_tree) if isinstance(node, ast.Call) and ast.unparse(node.func) == 'self.state_update') diff --git a/openpilot/starpilot/ui/feature_settings_owner.py b/openpilot/starpilot/ui/feature_settings_owner.py index f536c68d51..c57fe2b130 100644 --- a/openpilot/starpilot/ui/feature_settings_owner.py +++ b/openpilot/starpilot/ui/feature_settings_owner.py @@ -7,8 +7,12 @@ Reset and migration actions additionally require a parked vehicle. from __future__ import annotations -from openpilot.starpilot.ui.feature_profile_edit import (edit_document, PRESETS as PRESETS, - PROFILE_NAMES as PROFILE_NAMES, DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES) +from openpilot.starpilot.ui.feature_profile_edit import ( + edit_document, + PRESETS as PRESETS, + PROFILE_NAMES as PROFILE_NAMES, + DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES, +) from collections.abc import Callable from contextvars import ContextVar @@ -37,9 +41,12 @@ from openpilot.starpilot.longitudinal.profile_document import ( personality_reference_curves, serialize_personality_profiles, synchronise_profile_document_enabled, ) -from openpilot.starpilot.ui.feature_defaults import (AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION, - AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY, - BOOL_DEFAULTS as BOOL_DEFAULTS, FLOAT_SPECS as FLOAT_SPECS) +from openpilot.starpilot.ui.feature_defaults import ( + AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION, + AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY, + BOOL_DEFAULTS as BOOL_DEFAULTS, + FLOAT_SPECS as FLOAT_SPECS, +) from openpilot.starpilot.ui.feature_settings_state import ( FeaturePage, FeatureRow, FeatureSettingsRequest, FeatureSettingsState, SettingLevel, SLC_CONFIRM_ACTIONS, SLC_OFFSET_KEYS, TORQUE_CONFIRM_ACTIONS, ) @@ -59,8 +66,14 @@ from openpilot.starpilot.ui.controller_feature import ControllerFeature, SETUP_A from openpilot.starpilot.ui.slc_offset_feature import SlcOffsetOwner from openpilot.starpilot.ui.slc_policy_feature import SLC_ADVANCE_CHOICES, policy_rows from openpilot.starpilot.longitudinal.profile_preferences import read_document_value, read_profile_health -from openpilot.starpilot.ui.long_profile_feature import (LongProfileFeature, is_long_confirm_action, VALUE_HELP, CATEGORY_HELP, - preset_label, preset_value) +from openpilot.starpilot.ui.long_profile_feature import ( + LongProfileFeature, + is_long_confirm_action, + VALUE_HELP, + CATEGORY_HELP, + preset_label, + preset_value, +) from openpilot.starpilot.ui.traffic_feature import TrafficFeature, EDIT_KEYS as TRAFFIC_EDIT_KEYS from openpilot.starpilot.ui.cruise_steps_feature import CRUISE_KEYS, apply_cruise, apply_reverse_cruise, cruise_rows from openpilot.starpilot.ui.lane_change_feature import LaneChangeFeature, KEYS as LANE_CHANGE_KEYS @@ -87,8 +100,6 @@ from openpilot.starpilot.curve_speed.preferences import ( DOCUMENT_LIMIT as CURVE_DOCUMENT_LIMIT, read_learning, ) from openpilot.starpilot.curve_speed.actions import ACTION_KEYS as CURVE_ACTION_KEYS, apply_learning, learning_snapshot - - from openpilot.starpilot.controllers.toyota_cruise import capability as toyota_cruise_capability @@ -164,8 +175,8 @@ class FeatureSettingsOwner: self.volt_radar = VoltRadarFeature(self, galaxy=galaxy) self.panda_wake = PandaWakeFeature(self, galaxy=galaxy) self.traffic_profiles = TrafficFeature(self) - self.lane_changes = LaneChangeFeature(params, authority, vehicle_fingerprint, self.vehicle_params, - configuration_longitudinal=self.configuration_longitudinal) + self.lane_changes = LaneChangeFeature( + params, authority, vehicle_fingerprint, self.vehicle_params, configuration_longitudinal=self.configuration_longitudinal) self.conditional = ConditionalFeature(self) self.wheel = TeslaWheelRows(self) diff --git a/openpilot/starpilot/ui/tests/test_chestnut_display.py b/openpilot/starpilot/ui/tests/test_chestnut_display.py index 068ee34f1c..8939c3a530 100644 --- a/openpilot/starpilot/ui/tests/test_chestnut_display.py +++ b/openpilot/starpilot/ui/tests/test_chestnut_display.py @@ -16,7 +16,7 @@ def test_native_chestnut_status_accepts_typed_params(raw, expected, tmp_path): params.get_param_path.side_effect = lambda key: str(tmp_path / key) params.get.return_value = raw params.get_bool.return_value = False - state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False) + state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False, _gpu_artifacts=None) with patch('openpilot.selfdrive.ui.ui_state.get_cache', return_value=None), \ patch('openpilot.selfdrive.ui.ui_state.cable_connected', return_value=False): UIState.update_params(state) diff --git a/openpilot/starpilot/ui/tests/test_native_settings_pages.py b/openpilot/starpilot/ui/tests/test_native_settings_pages.py index e424720669..0a2403cccd 100644 --- a/openpilot/starpilot/ui/tests/test_native_settings_pages.py +++ b/openpilot/starpilot/ui/tests/test_native_settings_pages.py @@ -505,14 +505,14 @@ class NativeSettingsPageTests(unittest.TestCase): # Run the real controller methods with only device services isolated. source = Path('openpilot/selfdrive/ui/layouts/settings/toggles.py') layout = next(node for node in ast.parse(source.read_text()).body if isinstance(node, ast.ClassDef) and node.name == 'TogglesLayout') - methods = {'_update_toggles', '_update_state', '_toggle_callback', + methods = {'_update_toggles', '_update_state', '_toggle_callback', '_toggle_action', 'request_toggle', 'request_personality', '_set_longitudinal_personality'} layout.bases = [] layout.body = [node for node in layout.body if isinstance(node, ast.FunctionDef) and node.name in methods] ui = NS(CP=None, engaged=False, parked=True, update_params=Mock(), sm=NS(updated={'selfdriveState': False})) app = NS(push_widget=Mock()) namespace = ModuleType('toggles_controller_test') - namespace.__dict__.update(tr=lambda text: text, ui_state=ui) + namespace.__dict__.update(tr=lambda text: text, ui_state=ui, ToggleAction=ToggleAction) exec(compile(ast.Module(body=[layout], type_ignores=[]), str(source), 'exec'), namespace.__dict__) owner = namespace.TogglesLayout() class SavedParams(Params): diff --git a/openpilot/starpilot/ui/tests/test_spacepilot_entry.py b/openpilot/starpilot/ui/tests/test_spacepilot_entry.py index 57210c33d6..8b268117b4 100644 --- a/openpilot/starpilot/ui/tests/test_spacepilot_entry.py +++ b/openpilot/starpilot/ui/tests/test_spacepilot_entry.py @@ -158,6 +158,7 @@ def test_actual_c4_startup_redirect_only_yields_to_fresh_open_parked_game(monkey owner._prev_onroad, owner._prev_standstill = True, True owner._onroad_time_delay = 5. owner._onboarding_window = Mock() + owner._home_layout = Mock() page = object.__new__(native.SpacePilotPage) page.closed = condition == 'closed' page.session = Mock(stage=native.Stage.CLOSED if page.closed else native.Stage.VERIFYING) diff --git a/openpilot/starpilot/ui/tests/test_widget_layers.py b/openpilot/starpilot/ui/tests/test_widget_layers.py index ea4486b002..390ffb6855 100644 --- a/openpilot/starpilot/ui/tests/test_widget_layers.py +++ b/openpilot/starpilot/ui/tests/test_widget_layers.py @@ -112,7 +112,7 @@ def test_renderer_dispatches_each_widget_in_saved_order(profile, viewport): method = next(node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == '_ordered_widgets') namespace: dict[str, Any] = {'CLOCK_WIDGET': CLOCK_WIDGET, 'MODE_WIDGET': MODE_WIDGET, 'placement': placement, 'widget_order': widget_order, 'RAIL_WIDGETS': RAIL_WIDGETS, 'STOPPED_TIMER_WIDGET': STOPPED_TIMER_WIDGET, - 'render_rear_fog': lambda *args: seen.append('rear_fog'), + 'render_rear_fog': lambda *args: seen.append('rear_fog'), 'compact_wheel_warning': lambda state: False, 'manual_slc_confirmation': lambda profile, state: False, 'AlertSize': NS(NONE='none', FULL='full'), 'CameraViewChoice': NS(NONE='none'), 'rl': NS(Rectangle=lambda x, y, width, height: NS(x=x, y=y, width=width, height=height))} exec(compile(ast.Module(body=[method], type_ignores=[]), str(source), 'exec'), namespace) diff --git a/prebuilt.json b/prebuilt.json index e2d9ea247b..14626cfcc3 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "f3801b032f033ab7d96e20097ad6b98e749424787d0f655095a6ba2b7e68b40f", "schema_version": 1} +{"protected_inventory_sha256": "47869c49a5ca66ab4b8ce2e706f5b1f864b6fbf767cbf9342d57a9f1f443d453", "schema_version": 1}