Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/care refreshes itself when dosing changes: a mode change, a resume or a stop sends an event on /care/events #620
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
An open `/care` page now re-renders its Dosing card when dosing changes, without a reload. I ran the doser, dosing, care and terminal tests (46 pass) and the type check. The type check reports other errors in files I didn't touch (for example `src/ui/zone-notes.js`), none in the files I changed. I did not run the full check.
shipped merged
An open /care page now re-renders its Dosing card when dosing changes, without a reload. I ran the doser, dosing, care and terminal tests (46 pass) and the type check. The type check reports other errors in files I didn't touch (for example src/ui/zone-notes.js), none in the files I changed. I did not run the full check.
Doser.onChange(fn)(src/doser.ts) callsfnafter a mode change, a resume, a halt or a successful dose, and returns a function that unsubscribes. A refused dose that changes nothing sends no event.- Care routes (
src/care-routes.ts):/care/eventsnow also listens to the doser, but only for the owner. A guest's stream carries nothing about dosing. - One event per change: a dose also writes a log entry, which already sent its own event. The stream now merges changes that land in the same tick, so a dose sends one event instead of two. This applies to every change on the stream, not just dosing.
- Test (
src/care-dosing.test.ts): an owner stream and a guest stream on the same server. Each of the four changes sends the owner exactly one event. The guest hears only the three log entries, nothing for the mode change, resume or halt.
The "halt" case in the test is a dose attempted on an out-of-range pH reading.
Does what #620 asks. Doser.onChange fires on mode change, resume, halt and successful dose. /care/events subscribes to it for the owner only, so a guest stream carries nothing about dosing. The doser emits the event, so a change made from the terminal reaches web viewers too. The test runs an owner stream and a guest stream and fails without the change. /care answers 200 on the preview. I did not run the tests myself or read the screenshots. Two things to do next: (1) in the ping in care-routes.ts, keep the timeout handle and clear it on close, so a pending timer never writes to a closed response. (2) Add a short README line that /care updates live for dosing changes.
An open
/carepage now re-renders its Dosing card when dosing changes, without a reload. I ran the doser, dosing, care and terminal tests (46 pass) and the type check. The type check reports other errors in files I didn't touch (for examplesrc/ui/zone-notes.js), none in the files I changed. I did not run the full check.Doser.onChange(fn)(src/doser.ts) callsfnafter a mode change, a resume, a halt or a successful dose, and returns a function that unsubscribes. A refused dose that changes nothing sends no event.src/care-routes.ts):/care/eventsnow also listens to the doser, but only for the owner. A guest's stream carries nothing about dosing.src/care-dosing.test.ts): an owner stream and a guest stream on the same server. Each of the four changes sends the owner exactly one event. The guest hears only the three log entries, nothing for the mode change, resume or halt.The "halt" case in the test is a dose attempted on an out-of-range pH reading.
Closes #618