Keep entity._is_included's default gate permissive on confirmed-empty reps
Opus review of #149 caught that swapping is_stub_rep(rep) in for the default field-presence gate (not just the 9 hand-audited exists_fn call sites) was too broad: it silently excludes entities on ANY resource whose normal, valid state includes reporting {} -- /alarms/vs/0's {} is fridge.py's documented no-alarm state, not an absence signal, and it's not the only one (job_beginning_status, diagnosis_status, sabbath_mode, defrost_delay, ice_maker_enabled all lost entities on real fixtures under the broader change). That's the opposite of #127's fix: a real fridge would have dropped its alarm sensor on first-poll timing, not just its phantom energy sensors. Restored the default gate to include on either a stub or a genuinely-empty rep -- verified byte-identical to the pre-#149 baseline across all 40 fixtures, apart from the 9 deliberately-audited exists_fn sites (energy meter, self-check error, cooktop burner, range-hood auto-op), which are unaffected and still fix #127. Added tests/test_entity.py exercising _is_included directly (previously untested) and fixed two now-stale "not rep" doc references the review also flagged.
This commit is contained in:
4 files changed
+100
-9
No files matched your search
@@ -503,7 +503,7 @@ AI_ENERGY_LEVEL = Capability(
|
||||
href='/energy/ailevel/vs/0',
|
||||
poll_tier='cold',
|
||||
entities=(
|
||||
# No `not rep` stub carve-out on either side, unlike most exists_fn
|
||||
# No is_stub_rep carve-out on either side, unlike most exists_fn
|
||||
# gates in this file -- entity creation only ever runs once, against
|
||||
# whichever snapshot happens to be current the moment platforms are
|
||||
# set up (see entity._is_included / __init__.py's
|
||||
|
||||
Reference in new issue
Block a user