Populate advisory distance and acceptance outputs - #118
Merged
Conversation
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.
Summary
nextAdvisorySpeedDistancethrough its existing dedicated field.speedLimitAccepted.Motivation
MapdOutalready defines separate fields for upcoming hazard and advisory-speed distances.State.Sendfirst writesNextHazard.Distancecorrectly, then writesNextAdvisorySpeed.DistancethroughSetNextHazardDistanceagain. Every resulting message replaces the hazard distance with the advisory distance and leavesnextAdvisorySpeedDistanceat its default value.The message also defines
speedLimitAccepted, and the settings owner already exposes the acceptance state used by speed-limit control. That generated output setter is never called, so the serialized field remains false even after acceptance and when explicit acceptance is disabled.Implementation
The advisory-distance write now uses
SetNextAdvisorySpeedDistance. The existing hazard-distance write remains unchanged.State.Sendalso copiesSettings.SpeedLimitAccepted()into the existing output field. This preserves the current semantics: false while a required change is pending, true after acceptance, and true when explicit acceptance is not required.Behavior
68813e05123.25, advisory distance456.75456.75; advisory0123.25; advisory456.75falsefalsefalsetruefalsetrueValidation
An external Linux oracle exercised the real
State.Sendpath through the cereal event envelope, gomsgq publisher/subscriber, Cap'n Proto serialization, and generated readers.68813e05failed both focused checks: the hazard distance was456.75instead of123.25, andspeedLimitAcceptedremained false after acceptance.go test ./...,go test -race ./...,go vet ./..., andgo build ./...passed on Linux/amd64 with Go 1.25.1.make buildpath successfully for exact commit996754c.Compatibility
Audit follow-up
An independent audit confirmed both fields are now set from the correct sources and match the schema and
docs/outputs.md, with one addition to the compatibility note: these are wire-visible changes for any fork that adapted to the buggy build. A consumer readingnextHazardDistanceand expecting the advisory distance now receives the hazard distance, andspeedLimitAcceptedflips from constantly false to constantly true under stock defaults. Both are the intended correction rather than regressions, but a fork carrying a workaround will need to drop it.Composition with #106 is clean, verified by trial merge, build, and test: both corrected fields survive verbatim and sit on the valid path after #106's early return.