[IRRIGOAPI-114] Stop the rain-skip deferring irrigation indefinitely #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bug/IRRIGOAPI-114"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Ticket
IRRIGOAPI-114 — Rain-skip can defer irrigation indefinitely; add credit cap, critical-depletion floor, and probability weighting.
Summary
All three zones went nine days without water (last run 2026-08-02) while sitting above their watering trigger, every night skipped with reason
rain-forecast. Actual rainfall over 2026-07-28 → 08-10 was 2.90 mm total; the planner was crediting 26–48 mm of forecast rain each night.The rain-skip had unbounded forecast credit and no critical-depletion override. Because depletion only ever creeps a few mm past the trigger, the deficit a forecast has to "cover" stays tiny, so almost any prediction defers the night. Even at total soil-moisture exhaustion the deficit is smaller than the forecasts being shown — there was no depletion level at which the system was guaranteed to water, and the nightly re-plan could not self-correct against a persistent wet bias.
Three layered changes, in order of what actually fixes the bug:
RAIN_SKIP_DEPLETION_FLOOR_FRACTION, default0.7of total available water). Past this depletion the rain-skip is suppressed outright. Depletion is already a running accumulator of consecutive skips, so this needs no new cross-replan state. For the live zones the floor lands at 34.65 mm, leaving a ~10 mm band above the 24.75 mm trigger for genuine rain delays.RAIN_SKIP_MAX_DAILY_CREDIT_MM, default10). Stops one speculative convective day dominating the lookahead. Applied per day, so a real multi-day soaker (3 × 8 mm) is still credited in full.precipitation_probability_maxis now fetched, parsed, and persisted; forecast credit is scaled by it. A 66%-likely 32.8 mm day credits ~5.3 mm instead of 26.2 mm. Only the forward-looking lookahead is weighted — the day-by-day soil balance still applies observed rain undiscounted.Also:
planZoneSchedule's 6th positional argument becomes aRainSkipSettingsobject rather than growing to eight parameters.depletion-floordecision reason, recorded only when the floor overrode a rain-skip that would otherwise have fired — nights that water normally keep theirfull-refill/partial-refillreason.0020_whole_wolfsbane.sql; historical rows carrynullprobability, which reads as "no discount".Verification
bun --cwd=./api run type-check— clean.bun --cwd=./api test— 1021 pass. The 12 failures are pre-existing HA/alert tests that fail identically onmain(verified by checking outmainand re-running); this branch adds 33 tests and introduces no new failures.Follow-up
The running daemon needs a restart to pick this up; zones will water on the next evening tick once it does. The duplicate
scheduling_decisionsrows and concurrent tick loops seen while diagnosing this are tracked separately as IRRIGOAPI-115.