Track speed limit state independently of lookahead - #103
Open
FrogAi wants to merge 1 commit into
Open
Conversation
FrogAi
force-pushed
the
codex/track-speed-limit-state
branch
2 times, most recently
from
August 10, 2026 03:09
5838f3a to
87e3cf2
Compare
FrogAi
force-pushed
the
codex/track-speed-limit-state
branch
from
August 10, 2026 03:21
87e3cf2 to
65ff1b1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Developer summary
The current speed-limit tracker updates only when an upcoming limit exists. Without lookahead, a valid current limit reaches the suggestion but never enters tracker history, so hold-last-seen later has nothing to hold. If current data is missing while an upcoming limit is known, direction classification also compares that future limit against observed zero instead of the held current value.
This updates the priority-selected current limit on every suggestion pass, applies hold-last-seen only to a local effective value, and uses that effective value for upcoming-limit direction. Acceptance timing and upcoming-limit source policy are unchanged.
Verification
mainfails the no-lookahead history and held-current slowdown cases; this branch passes them 100 consecutive times.Compatibility
No schema, setting, output format, acceptance policy, or upcoming-source arbitration changes.
Limit.Valuecontinues to represent the observed unoffset current limit; hold fallback remains local and does not overwrite that observation.Engineering record and audit trail
Root cause
SpeedLimitState.Limit.Updatecurrently lives insideif s.NextLimit.Value > 0. On roads without a future limit, the tracker remains at its zero value even whileSuggestNewSpeedLimitreturns a valid current limit. When that current source later disappears,HoldLastSeenSpeedLimitreads an emptyLastValueand returns zero.Moving the tracker update alone is incomplete. When current data is unavailable but history exists, lookahead direction must compare the upcoming limit against the held effective current limit. Comparing against
Limit.Valuewould still classify from observed zero and can preserve a higher held target while approaching a known lower limit.State ownership
Limit.ValueLimit.LastValuecurrentLimitLastValuewhen hold is enabledSuggestion.ValueThe held fallback is intentionally not written into
Limit.Value, so later zero-to-real transitions remain observable and the tracker does not claim a source value that is currently unavailable.Behavior
20 m/s, no upcoming limit20 -> 25, no lookaheadFinal validation
The external matrix uses production
CurrentWay, offline-way accessors, priority selection, tracker state, and lookahead arithmetic. Against current main it fails at the two demonstrated ownership boundaries; the final single-commit head passes 100 repetitions.-count=100go test ./...go test -race ./...go vet ./...go build ./...git diff --checkScope limits
This change does not reinterpret upcoming map limits through current-source priority, alter offsets or trigger-distance arithmetic, change acceptance timestamps, or modify explicit acceptance inputs. Those are separate product contracts and are deliberately absent from this diff.