Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
A dosing loop set to auto doses by itself once a minute, inside the same limits, and tests prove it never doses when it must not #621
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
A loop set to `auto` now doses by itself: the relay runs `Doser.tick` every `doseEveryMs` (60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass. `tsc` reports no errors in `relay.ts` or `doser.ts`, but it still fails elsewhere (the `bun` type definitions weren't found). I didn't run the full check.
shipped merged
A loop set to auto now doses by itself: the relay runs Doser.tick every doseEveryMs (60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass. tsc reports no errors in relay.ts or doser.ts, but it still fails elsewhere (the bun type definitions weren't found). I didn't run the full check.
- Wiring: a failing tick is logged and never crashes the relay. The relay test uses a short
doseEveryMswith a fake doser. It checks that ticks happen and stop afterclose(). - Fix to
tick:ticknever raised the stop. The halt on an out-of-bounds or unmoved reading only fired through a dose attempt, so an unattended pH loop could have kept dosing against a dead probe.ticknow makes one dose attempt when a loop's suggestion says "stopped", so the halt holds on the timer path as it does on the owner's tap. The attempt adds nothing. - Tests in
doser.test.ts:
- auto doses once on a tick and logs it.
- suggest and off never move a pump.
- A halted doser never doses.
- Two ticks on the same reading give one dose.
- A tick inside the mixing wait does not dose.
- README: the dosing section now says
autopumps unattended inside the per-dose and per-day limits, and that loops still ship insuggest.
The issue asks for the log cause auto, but the log book's causes are rule, crew and owner, and the automatic dose is logged as rule. I kept that rather than add a new cause across the log and page. The README and tests say rule. Tell me if you want auto as a new cause.
🤖 Generated with Claude Code
Small, on-direction change. The relay now ticks Doser.tick every 60 s, unref'd and cleared on close. A failing tick is logged and cannot crash the relay. Every limit goes through the same dose() path as the owner's tap. Tests cover auto, suggest/off, halted, same-reading and mixing-wait cases, plus the timer start and stop. No page, terminal or auth surface changed, so the doors are the same. Using rule as the cause rather than a new auto is a fair call, and the README says so. Two things I would do next: (1) add a test that isolates the new halt-on-tick branch, for example a tick on an out-of-bounds reading with no earlier dose, so it fails without that line; (2) show on /care and in /care dosing when the last automatic tick ran, so the owner can see the timer is alive.
A loop set to
autonow doses by itself: the relay runsDoser.tickeverydoseEveryMs(60 s by default) and clears that timer on close. I ran the doser, care-dosing, relay and sensors-relay tests; they pass.tscreports no errors inrelay.tsordoser.ts, but it still fails elsewhere (thebuntype definitions weren't found). I didn't run the full check.doseEveryMswith a fake doser. It checks that ticks happen and stop afterclose().tick:ticknever raised the stop. The halt on an out-of-bounds or unmoved reading only fired through a dose attempt, so an unattended pH loop could have kept dosing against a dead probe.ticknow makes one dose attempt when a loop's suggestion says "stopped", so the halt holds on the timer path as it does on the owner's tap. The attempt adds nothing.doser.test.ts:-
autodoses once on a tick and logs it. -suggestandoffnever move a pump. - A halted doser never doses. - Two ticks on the same reading give one dose. - A tick inside the mixing wait does not dose.autopumps unattended inside the per-dose and per-day limits, and that loops still ship insuggest.The issue asks for the log cause
auto, but the log book's causes arerule,crewandowner, and the automatic dose is logged asrule. I kept that rather than add a new cause across the log and page. The README and tests sayrule. Tell me if you wantautoas a new cause.🤖 Generated with Claude Code
Closes #619