Skip to content

Commit fbf96aa

Browse files
committed
fix(simulator): prevent pre-trip from exceeding 70h cycle limit
If cycle_hours_used = 69.9h only 6 min remain. Previous check (> 0) allowed pre-trip to fire, pushing cycle to 70.15h — over the FMCSA 70h limit. New check (>= PRE_TRIP_MINUTES) requires at least 15 min capacity before pre-trip proceeds. All 26 tests passing.
1 parent 43f9c83 commit fbf96aa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

backend/simulator/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def simulate_trip(trip_input: TripInput) -> TripPlanResult:
421421

422422
# 4. Pre-trip inspection (15 min ON_DUTY)
423423
# Skip if cycle already exhausted — restart must happen first
424-
if minutes_until_cycle_limit(state) > 0:
424+
if minutes_until_cycle_limit(state) >= PRE_TRIP_MINUTES:
425425
pre_trip_hours = PRE_TRIP_MINUTES / 60.0
426426
current_time = _add_event(
427427
timeline, DutyStatus.ON_DUTY, current_time,

0 commit comments

Comments
 (0)