Preserve Ford expiry guards alongside native-first AOL braking

This commit is contained in:
firestar5683
2026-10-31 23:15:31 -05:00
parent 72f16053b5
commit b158bc378a
4 changed files with 24 additions and 5 deletions
+2 -1
View File
@@ -1817,7 +1817,8 @@ class SelfdriveD:
native is None or prior is None or proof is None or anchor is None or
anchor[3] != cp_identity(self.CP) or proof[0] != self.aol_session_id or
not proof[8] or not proof[9] or not 0 < proof[2] <= now_ns or
now_ns > proof[3] and not (ordinary_ford and proof[1] < self.aol_car_state_log_ns) or
now_ns > proof[3] and not (ordinary_ford and proof[1] < self.aol_car_state_log_ns and
intent is not None and intent.allowedLatch and intent.lateralArmed and not intent.pauseLateral) or
intent is None or companion is None or proof[4] != intent.producerSessionId or
proof[5] != companion.integrity_epoch or not ((intent.allowedLatch and intent.lateralArmed) or ordinary_ford) or
not native.requestedLateral or not native.lateralAllowed or
@@ -96,3 +96,18 @@ def test_persistent_native_long_denial_keeps_original_mismatch_owner(caller, ste
break
assert sd.mismatch_counter >= 200
assert not s.enabled and not a.lateralActive and not c.latActive
@pytest.mark.parametrize('steering', [False, True])
def test_fresh_physical_gas_after_prior_deadline_uses_current_grant(caller, steering):
sd, cs, drive = caller
prior = list(sd.aol_published_input_proof)
prior[3] = 10_099_999_999
sd.aol_published_input_proof = tuple(prior)
cs.gasPressed = True
axis, state, command = drive(10, gas=True, steering=steering, native_request_lat=True,
allowed=True, native_request_long=True, long_allowed=False, panda_controls_allowed=True)
assert axis.lateralActive and command.latActive and state.enabled
assert not axis.longitudinalActive and not command.longActive
assert not sd.aol_last_intent.allowedLatch and not sd.aol_last_intent.lateralArmed
assert log.OnroadEvent.EventName.controlsMismatch not in sd.events.names
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "723acc8c1cdc255733f98c7c5d8d5ad375f8ae21683d07f75f0b0b5f6e2b4c77", "schema_version": 1}
{"protected_inventory_sha256": "63fb45ae947e658e222f3655bc8dceeeb31653ca8f867d706ce291d69e2cb027", "schema_version": 1}
+6 -3
View File
@@ -250,9 +250,12 @@ class TestVehicleCollection(unittest.TestCase):
self.assertEqual(artifact["error_phase"], "collection" if failing == "collect" else "initialization", name)
def test_native_safety_targets_are_top_level_and_complete(self):
root = Path(__file__).resolve().parents[3] / "opendbc_repo/opendbc/safety/tests"
expected = {path.name for path in root.glob("test_*.py")} | {"test_classic_startup_neutral_replacement.py"}
self.assertEqual({Path(target.split("::", 1)[0]).name for target in targets_for("safety-debug")}, expected)
root = Path(__file__).resolve().parents[3]
expected = {str(path.relative_to(root))
for folder in ('opendbc_repo/opendbc/safety/tests', 'opendbc_repo/opendbc/bluepilot_lateral/safety/tests')
for path in (root / folder).glob('test_*.py')}
expected.add('openpilot/starpilot/aol/tests/test_classic_startup_neutral_replacement.py')
self.assertEqual({target.split("::", 1)[0] for target in targets_for("safety-debug")}, expected)
self.assertTrue(all(Path(target.split("::", 1)[0]).parent.name == "tests" for target in targets_for("safety-debug")))
def test_pe_native_variants_select_healthy_acceptance_and_denial_classes_separately(self):