Reset step advance condition state on every step advance#887
Open
devnull133 wants to merge 1 commit into
Open
Conversation
`NavigationController::advance_to_next_step` carried the existing step advance condition forward unchanged. Auto-advance was unaffected because `should_advance_step` already returns a fresh condition via `advance_to_new_instance`, but manual advance — `Navigator::advance_to_next_step` called directly, e.g. from platform code wrapping a ManualStepCondition or walking out of GPS coverage — bypasses that path entirely. Stateful conditions (the entry-latch family, composites containing them, custom user implementations) leaked their per-step state into the next step. Call `new_instance()` on the carried condition so both advance paths honor the trait's documented reset contract.
Archdoog
approved these changes
May 5, 2026
Collaborator
Archdoog
left a comment
There was a problem hiding this comment.
Good catch. This looks good as it, thanks 👍
A note/question. Any thoughts on any further cleanup?
E.g. we could extract new instance out to the NavigationController so that anytime we "recycle" a continuing or advanced condition it's clear at the call site. The way I built this, where the new_instance was hidden inside the conditional logic on some conditions is definitely confusing looking from the top down. Even though it made sense from the state management process inside each one.
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.
Hi, I noticed this while working on something else. I'm not sure how often the manual step advance is used, but it feels like it should be fixed anyway.
NavigationController::advance_to_next_stepcarried the existing step advance condition forward unchanged. Auto-advance was unaffected becauseshould_advance_stepalready returns a fresh condition viaadvance_to_new_instance, but manual advance -Navigator::advance_to_next_stepbypasses that path entirely. Stateful conditions (the entry-latch family, composites containing them, custom user implementations) leaked their per-step state into the next step.