Merged
Conversation
1. sensor.py: double dict lookup on child_lookup could produce unexpected results — replaced with a clean single lookup using `in` check. 2. sensor.py: float()/int() conversions on settings values had no error handling — a corrupted setting would crash the sensor and make the whole integration unavailable. Added _safe_float()/_safe_int() helpers with fallback defaults. 3. coordinator.py: is_chore_available_for_child() caught ValueError but not TypeError when slicing current_iso — if the stored value was not a string (e.g. None), [:10] raises TypeError which was unhandled and would crash the availability check. Now catches (ValueError, TypeError). 4. coordinator.py / storage.py: async_reject_reward() was directly writing to storage._data["reward_claims"] bypassing the storage API, making it fragile to internal storage changes. Added remove_reward_claim() to TaskMateStorage and updated the coordinator to use it. https://claude.ai/code/session_01CkPmKWe5siThpfZ6GDpNQF
tempus2016
added a commit
that referenced
this pull request
Mar 30, 2026
…kM4P Fix four bugs found during code audit
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.
Bugs fixed
1.
sensor.py— Crash on corrupted settingsfloat()andint()were called directly on user-configurable settings with no error handling. A corrupted value (e.g. someone typed letters instead of a number) would throw aValueErrorand crash the sensor, making the whole integration unavailable. Added_safe_float()/_safe_int()helpers that fall back to sensible defaults.2.
sensor.py— Fragile double dict lookupchild_lookup.get(comp.child_id, None) and child_lookup[comp.child_id].namelooked up the same key twice. Replaced with a clean single lookup.3.
coordinator.py—TypeErrorcrash in recurrence availability checkis_chore_available_for_child()caughtValueErrorwhen parsing a stored date string, but notTypeError. If the stored value happened to beNoneor a non-string, slicing it with[:10]raisesTypeError, which was unhandled and would crash the chore availability check. Now catches(ValueError, TypeError).4.
coordinator.py/storage.py—async_reject_reward()bypassed storage APIReward rejection was directly writing to
storage._data["reward_claims"]instead of going through the storage layer. Added a properremove_reward_claim()method toTaskMateStorageand updated the coordinator to use it.Test plan