From ab2baa98ea866656b3be2c5f1ca25a3538afc1f9 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:35:57 -0500 Subject: [PATCH] Cover Rivian unsupported profiles and permanent EPS retirement --- .../car/rivian/tests/test_aol_native.py | 45 ++++++++++++++++++- prebuilt.json | 2 +- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/openpilot/starpilot/car/rivian/tests/test_aol_native.py b/openpilot/starpilot/car/rivian/tests/test_aol_native.py index 8421e2e5cd..78a0ec1cb3 100644 --- a/openpilot/starpilot/car/rivian/tests/test_aol_native.py +++ b/openpilot/starpilot/car/rivian/tests/test_aol_native.py @@ -18,11 +18,19 @@ class NativeRig: for _ in range(3): self.feed(feature=0) - def feed(self, *, request=1, **kwargs): + def feed(self, *, request=1, eps_state=None, **kwargs): self.tick += 1 self.native.set_timer(1_000_000 + self.tick * 10_000) self.car.feed(**kwargs) - for address, data, bus in self.car.last_frames: + frames = self.car.last_frames + if eps_state is not None: + # Replace only the physical EPS-status sample with a fresh DBC/checksum + # frame at the original counter; all other monitored sources stay real. + frames = [frame for frame in frames if frame[0] != 0x390] + frames.append(self.car.packer.make_can_msg('EPAS_AdasStatus', 0, { + 'EPAS_AdasStatus_Counter': self.car.tick % 15, 'EPAS_EacStatus': eps_state, + })) + for address, data, bus in frames: assert self.native.safety_rx_hook(libsafety_py.make_CANPacket(address, bus, data)) self.native.safety_tick() self.native.aol_set_host_request(request) @@ -99,3 +107,36 @@ def test_native_long_axis_not_inherited_from_lateral_token(): assert rig.feed(request=3, feature=0) == 1 address, data, bus = rig.car.packer.make_can_msg('ACM_longitudinalRequest', 0, {'ACM_AccelerationRequest': 0.1}) assert not rig.native.safety_tx_hook(libsafety_py.make_CANPacket(address, bus, data)) + + +@pytest.mark.parametrize('param', [2, 3, 4, 65535]) +def test_native_unqualified_aol_profile_has_no_transmit_catalog(param): + rig = NativeRig() + rig.native.init_tests() + rig.native.set_alternative_experience(32) + assert rig.native.set_safety_hooks(structs.CarParams.SafetyModel.rivian, param) == 0 + rig.native.set_aol_test_heartbeat(True) + for _ in range(4): + assert rig.feed(feature=1, request=3) == 0 + # Even an ordinary physical cruise engagement cannot give an unsupported + # AE32 profile a steering, longitudinal, wheel-touch or cruise-cancel TX slot. + for name, bus, values in ( + ('ACM_lkaHbaCmd', 0, {'ACM_lkaStrToqReq': 0, 'ACM_lkaActToi': False}), + ('ACM_longitudinalRequest', 0, {'ACM_AccelerationRequest': 0.0}), + ('SCCM_WheelTouch', 2, {'SCCM_WheelTouch_HandsOn': 0}), + ('VDM_AdasSts', 2, {'VDM_AdasInterfaceStatus': 0}), + ): + address, data, frame_bus = rig.car.packer.make_can_msg(name, bus, values) + assert not rig.native.safety_tx_hook(libsafety_py.make_CANPacket(address, frame_bus, data)) + + +def test_native_permanent_eps_fault_retires_lateral_session(): + rig = NativeRig() + rig.engage() + assert rig.feed(brake=True, feature=0) == 1 + assert not rig.native.get_controls_allowed() + assert rig.feed(feature=0, eps_state=4) == 0 + # Healthy EPS status alone cannot resurrect the retired session. + for _ in range(4): + assert rig.feed(feature=0, eps_state=1) == 0 + rig.engage() diff --git a/prebuilt.json b/prebuilt.json index f23d165764..693dd4fe4a 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "1a510b54b75fcec29f38d764925648b99e94848ac2dab508a025d4dd748654db", "schema_version": 1} +{"protected_inventory_sha256": "0f0b8ce8948aa864e6531f3e57ff69cabd2914856d8321ca65a5f13b119710ec", "schema_version": 1}