Skip to content

Fuse stack follow-ups after stable: offline battery relief (#1910) #1935

Open

Description

@frahlg

Follow-ups from the final review of #1910 (head ddab122) on 28 Oct 2026. None of them makes the PR worse than master or breaks the owner's fuse rule, so they wait until after stable.

  • Offline battery relief clock does not run in idle or charge mode

Offline battery relief clock does not run in idle or charge mode

On #1910 (ddab122), ComputeDispatch returns early for ModeIdle and ModeCharge (dispatch.go ~1422-1437). Those returns come before state.expireOfflineFuseRelief(onlineBats) (dispatch.go:1545), but they still call recordFuseRelief through applyDispatchSafetyPipeline. The clock is also skipped on holdoff ticks (fuseSaverEarlyExit). Two effects:

  1. Hidden margin. A battery goes offline while it holds fuse relief, and the mode turns idle or charge within evSettle (a manual switch, or a legacy planner slot that returns "charge"). Its clock entry then never expires, and recordFuseRelief carries the relief over on every tick. Closed-loop probe on newIdleBatteryEVSite: house +8 kW, then 3 s, battery offline, then 5 s, Mode = ModeIdle, then 1 min, house -4 kW, then 9 min. Relief stays map[pixii:4790], and the car stays at 5520 W (18.14 A) under a 24 A line. In self mode the same sequence reaches 8970 W.
  2. No wait. A battery that goes offline while the mode is already idle or charge loses its relief on the first tick, and the car may build on a discharge Core ordered a second earlier. Probe: Mode = ModeIdle from the start, house +8 kW, 3 s, offline. The result after 1 s is "relief 0 W, want 4790 W". This is no worse than master, which counts all relief as room.

Fix idea: run the clock once at the top of ComputeDispatch, before the idle/charge short-circuit and the holdoff. Build the online set from DriverHealth(name).IsOnline() over driverCapacities.

Test idea: put both probes in ev_battery_sequence_test.go. Relief counts whole for evSettle-1s and is 0 after evSettle, in ModeIdle, in ModeCharge, and when the mode switches mid-clock. The probe file is at /private/tmp/claude-501/-Users-fredde-repositories-FTW-stack-FTW/537b9257-d4c9-4474-be2c-419b77da7e14/scratchpad/zz_review_offline_relief_test.go.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions