Repository navigation
fix(cars): keep a one-off goal's deadline when a profile target applies - #1887
Merged
Merged
Conversation
The session seed called SetTarget with the vehicles[] profile target, which clears targetTime. A one-off goal is not re-rolled, so the car lost its ready-by time for the whole session. Apply the profile target only when the car has no goal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Item D4 of the stable plan.
Problem
A car with a
vehicles[]profiletarget_socloses a one-off goal's ready-by time at plug-in.Scenario: profile
target_soc: 0.9; the owner sets a one-off goal of 80 % by 07:00, then plugs in. At the session seed,cars/tick.gocallslps.SetTarget(id, 0.9, time.Time{}). SetTarget sets the target to 0.9 and clearstargetTime.RollSchedulesseeds a one-off schedule only once (lastRolledForis already set), so the deadline never returns. The stored goal still says 80 % by 07:00, but the planner and the deadline reserve read 90 % with no deadline for the rest of the session. A recurring goal recovers on the next roll; a one-off goal does not.Change
Apply the profile target at the session seed only when the car has no goal (
!goal.HasTarget()). One condition insyncLocked.The plan said to delete the call, on the grounds that migration had already folded the profile target into the car. It had not:
ProfileTargetis stored apart fromGoaland this call is its only reader. Deleting it would maketarget_soca dead setting. The guard is the fallback the audit proposed, and it keeps the setting working for cars without a goal.Tests
TestProfileTargetKeepsOneOffDeadline(the audit's repro, renamed): fails on master withafter 0.90 by 0001-01-01, passes with this change.TestProfileTargetAppliesWithoutGoal: a car with no goal still gets 0.9 at plug-in.cd go && go test -race ./internal/cars/...: okgo vet ./...andgo build ./...: cleanRisk
Low. User-intent bookkeeping only; the dispatch and fuse paths are unchanged.
🤖 Generated with Claude Code