1.8 KiB
1.8 KiB
Machine State Progress
Final State Model (5 states + sub-reasons)
| State | Color | Trigger |
|---|---|---|
| OFFLINE | dark gray | Heartbeat dead >2 min |
| STOPPED | red, pulse >5min | Active WO + no cycles (regardless of tracking) |
- reason machine_fault |
Tracking on, macrostop event active | |
- reason not_started |
Tracking off, has WO | |
| DATA_LOSS | red + icon, pulse | Tracking off + cycles arriving (>5 cycles or >10 min) |
| MOLD_CHANGE | blue | Active mold-change event |
| - sub at >3h | yellow accent | (Round 2) |
| - sub at >5h | red accent | (Round 2) |
| IDLE | calm gray | No tracking, no WO, no cycles |
| RUNNING | green | Tracking + WO + recent cycles |
Round 1 — Foundation: classifier + IDLE + STOPPED collapse + DATA_LOSS
- Step 1: Add
"idle"and"data-loss"toRecapMachineStatusunion - Step 2: Create
lib/recap/machineState.tsshared classifier with all reasons - Step 3: Refactor
statusFromMachinein redesign.ts to call classifier - Step 4: Plumb new fields (status reason, ongoing min) through types/responses
- Step 5: UI rendering: IDLE (calm gray) on /recap, /machines, detail
- Step 6: UI rendering: DATA_LOSS (red + icon) on all surfaces
- Step 7: STOPPED reason text: show
not_startedvsmachine_faultdistinction - Step 8: i18n keys (en + es-MX)
- Step 9: End-to-end verify each state transitions correctly
Round 2 — Mold change duration escalation (CT-only)
- MOLD_CHANGE >3h yellow accent
- MOLD_CHANGE >5h red accent
- i18n strings
Notes / parked items
- Prisma drift on (orgId,machineId,seq) unique indexes — pre-existing, not related to this work. Address as separate housekeeping task.
- Node-RED incidentKey rotation behavior verified: 10 distinct keys per real stoppage = correct.