feat: capture and persist the full ErrorCode proto - #161
Open
kingchddg901 wants to merge 1 commit into
Open
kingchddg901 wants to merge 1 commit into
kingchddg901 wants to merge 1 commit into
Conversation
The novel parser read only warn[0] and NEVER read error[] — so real device
errors, simultaneous codes, timestamps, obstacle/poop reminders, and battery
swaps all arrived and were discarded. Capture the whole proto and persist a
rolling history that survives restarts.
Parsers (all three transports):
- novel: decode error[], warn[], last_time, new_code.{error,warn},
battery.restored, and obstacle_reminder[] (type/photo/accuracy/map/point).
Primary error_code now prefers a real error[] over a warn[].
- scalar/legacy: mirror error_codes[] and a fresh-fault signal so state
shape stays uniform across transports.
State (models.VacuumState): error_codes, warn_codes, last_error_time,
new_error_codes, new_warn_codes, battery_restored, obstacle_reminders,
error_log.
Coordinator: a per-device error Store (separate from the maps store, which
clobbers to one key) holds the last 50 events, newest-first, loaded on
startup. _log_error_event judges freshness from `changes` (this update's
delta), not carried-forward state fields, so an ongoing fault is logged once
rather than every update; a clear->fault transition is a legacy backstop.
Sensor: the Error Message sensor exposes error_codes, warn_codes,
last_error_time, obstacle_reminders, battery_restored, and the full history
as attributes.
Tests: full-proto capture, error[]-wins priority, clear-to-empty, dedup of
ongoing faults, legacy transition backstop, obstacle/battery logging, and
history cap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kingchddg901
force-pushed
the
feat/error-tracking
branch
from
July 26, 2026 21:40
4a4b386 to
362457f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The novel MQTT parser decodes the
ErrorCodeprotobuf but only ever readwarn[0]. It never read theerror[]array, the event timestamp,new_code, obstacle reminders, or battery-swap events — all of which arrive on the error frame and were discarded. This PR captures the whole proto and persists a rolling per-device history that survives restarts.Motivation
On some devices (verified on an Omni/X-series unit), operational faults are reported through
error[], notwarn[]. Because the parser never readerror[],error_messagestayed permanently empty for those faults. Concretely: lifting the robot reports code7002("MACHINE PICKED UP") inerror[], which the current parser resolves toerror_code = 0and an empty message — so the fault is invisible.Changes
error[],warn[],last_time,new_code.{error,warn},battery.restored, andobstacle_reminder[](type / photo_id / accuracy / map_id / point). The primaryerror_codeprefers a realerror[]over awarn[]. The scalar and legacy parsers mirrorerror_codes[]so state shape is uniform across transports.VacuumStategainserror_codes,warn_codes,last_error_time,new_error_codes,new_warn_codes,battery_restored,obstacle_reminders, anderror_log. All additive with empty defaults; no breaking changes.Store(separate from the maps store) keeps the last 50 events, newest-first, loaded on startup. "Freshness" is judged from the per-update delta, not carried-forward state, so an ongoing fault is logged once rather than every tick; a clear→fault transition is a backstop for transports withoutnew_code.Testing
Added unit tests: full-proto capture,
error[]-over-warn[]priority, clear-to-empty, dedup of an ongoing fault, the legacy transition backstop, obstacle/battery logging, and the history cap. Full suite: 546 passing. pre-commit (pyupgrade / codespell / flake8 / isort / mypy / pylint) clean.Live validation
On real hardware: lift →
7002inerror_codes[]; pulling the station tanks →6010/6025inwarn_codes[]; all persisted with timestamps and resolved labels.Notes
manifest.jsonversion is intentionally left unchanged —release_version_checkruns only on release tags, so the version bump is a maintainer/release step.