Skip to content

docs(traces): READMEs, docstrings and three assertions say what the fixtures hold (#799 / #810 / #815 follow-up) - #822

Merged
GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
gdluck:docs/trace-readme-and-test-docstring-corrections
Oct 26, 2026
Merged

GreenGrassBlueOcean merged 1 commit into
OpenWebNet-HA:v2-phase1-architecturefrom
gdluck:docs/trace-readme-and-test-docstring-corrections

Conversation

@gdluck

@gdluck gdluck commented Oct 26, 2026

Copy link
Copy Markdown

Requested by A

Before: seven sentences in the trace READMEs and test docstrings of #799, #810 and #815 stated numbers or frames the fixtures do not hold (a request count double-counted, a dimension 14 "catching up 0.3 s later" that is never pushed, 34 zones for 33, 44 actuator frames for 43, "17 zones in 0.5 s" for 8), and three replay tests passed for the wrong reason.

After: every sentence states the fixture fact (each re-derived from the rows with jq before committing), and the three tests assert what their names say.

What is the problem

Docs / test-only follow-up on my trace PRs, found by an adversarial re-read after @GreenGrassBlueOcean's #140 review on OWNd. How it was found: each README sentence and docstring was read against the fixture rows and the question asked was "would this test still pass if the sentence were false?":

  • f461_live_2026-10-23/README.md:57: run 1 "165 requests mirrored from the oracle suites … plus 31 plant reads" (= 196); run 1 has 165 result rows in total (134 oracle + 31 plant reads).
  • f461_live_2026-10-23/README.md:72 and test_f461_live_2026_10_23_trace.py:413: "*#4*2*#14*0235*3## ACKed in 78 ms, dimension 12 follows at once, dimension 14 catches up 0.3 s later": no dimension 14 follows the write; the only 14 of run 3 is in the reply to the probe's own *#4*2## 2.8 s later, and the 0.3 s is the 12 → 14 gap inside that reply; the assertion evt.index(dim12) < evt.index(dim14) is satisfied by the poll order alone.
  • myhomeserver1_live_2026-10-24/README.md:18: "34 zones report a temperature": 33 do (zone 43 has an actuator, no temperature); the PR's own test asserts 33; 34 is the actuator count.
  • test_myhomeserver1_live_2026_10_24_trace.py:217: "ACKed with 44 actuator frames"; the body asserts 43 after that request (44 only with the earlier zone-35 reply).
  • test_f461_live_2026_10_23_trace.py:631 (run 4b): "23.5 in force and commanded, heating season, valve off": run 4b has no dimension 19 / 20 and the test asserted neither _target_temperature nor hvac_action.
  • test_trace_oracle_validation.py:166: "*#4*0*60## … ACK, 17 zones in 0.5 s": ACK at 0.499 s with 8 replies; the 17th zone at 0.97 s.
  • test_f461_live_2026_10_24_trace.py:577 (test(trace): ingest live F461 2.0.11 2026-10-24 climate setpoint capture (knob, antifreeze split, presets, bezel, HA write) #810 knob turn): "dimension 14 changes nothing", but every dimension 14 of run 1 carries 18.0 = the dimension 12 value, so the assertions cannot tell which dimension drove the display (a scratch replay with the fix(climate): show the setpoint in force (dimension 12), keep dimension 14 as the commanded value #791 hold disabled passed them).
  • test_f461_actuators_live_2026_10_25_trace.py:529 (test(trace): ingest the F461 and MyHomeServer1 captures of 2026-10-25 (actuator status, fan speed and humidity per zone) #815): test_replay_action_sequence_matches_the_recorded_entity_states compared replay and record as two separate literals.

@GreenGrassBlueOcean a quick confirmation is enough here; nothing in the fixtures changes.


What is the solution

  1. READMEs and docstrings (5c7474d): "165 read-only requests: 134 mirrored … plus 31 plant reads"; "no dimension 14 is pushed; the next *#4*2## reads 14 = 23.5 (0.3 s after the dimension 12 of its own reply)"; "33 zones report a temperature (34 answer the actuator request)"; "43 actuator frames (44 in the run with the zone 35 reply)"; "ACK after 0.50 s with 8 replies; 17 zones by 0.97 s"; "valve off" dropped.
  2. Assertions: run 3 asserts not any(f.startswith("*#4*2*14*") for f in _evt_between(rows, RUN3, write)); run 4b asserts _target_temperature == 23.5; the knob-turn test asserts _target_temperature == 18.0 and _local_target_reported is True (a flag only a dimension 12 report sets) and names test(trace): ingest the F461 2.0.11 heating comfort / eco preset capture (dimension 12 split from 14) #812's presets replay as the discriminating one; the test(trace): ingest the F461 and MyHomeServer1 captures of 2026-10-25 (actuator status, fan speed and humidity per zone) #815 test compares the recorded actions with the replay's first changes and says the trailing idle was read back, not recorded.

State Diagram

N/A — docs / test-text change only.


Hardware Verification

  • N/A (no code under custom_components/ changes). The 2026-10-26 live reads on the F461 and the MyHomeServer1 reproduce the same per-zone dimension 12 / 13 / 14 shapes the fixtures hold.

How is it tested

  • tests/test_f461_live_2026_10_23_trace.py (run 3 write, run 4b), tests/test_myhomeserver1_live_2026_10_24_trace.py, tests/test_trace_oracle_validation.py, tests/test_f461_live_2026_10_24_trace.py::test_replay_knob_turn_shows_dimension_12, tests/test_f461_actuators_live_2026_10_25_trace.py::test_replay_action_sequence_matches_the_recorded_entity_states.
  • pytest tests -n 4 --cov=custom_components/myhome: 4991 passed, 1 skipped, TOTAL 16810 0 100.0%; ruff check . clean; scripts/typing_ratchet.py mypy --strict: 0 error(s); scripts/verify_ha_standards.py SUCCESS; scripts/sync_documentation.py --check SUCCESS; scripts/manage_translations.py check no drift.
  • Kimi (independent review): the corrected counts and timings agree with the fixture facts; the run-3 assertion is bounded to the window after the write and cannot be vacuous; the recorded-states comparison is non-vacuous; it asked for the _local_target_reported assertion on the knob-turn test (taken).

Where are the traces

  • tests/fixtures/traces/f461_live_2026-10-23/, tests/fixtures/traces/f461_live_2026-10-24/, tests/fixtures/traces/myhomeserver1_live_2026-10-24/, tests/fixtures/traces/f461_actuators_live_2026-10-25/ (unchanged).

What does the Firmware Oracle / Encyclopedia say

  1. OpenWebNet Encyclopedia: N/A.
  2. Firmware Oracle: N/A (text about our own captures).

🤖 Generated with Claude Code

…ixtures hold (OpenWebNet-HA#799, OpenWebNet-HA#810, OpenWebNet-HA#815 follow-up)

Read against the fixture rows rather than the PR texts:

- f461_live_2026-10-23 README: run 1 is 165 read-only requests in total
  (134 mirrored from the oracle suites plus 31 plant reads), not 165 plus 31;
  the setpoint write `*michnovka#4*2*OpenWebNet-HA#14*0235*3##` is followed by dimension 12 at
  once and no dimension 14 is pushed: the "dimension 14 catches up 0.3 s
  later" was the 12 -> 14 gap inside the reply to the probe's own `*michnovka#4*2##`
  2.8 s later. test_setpoint_write_mode_3_restores_the_setpoint_in_force
  asserted only evt.index(12) < evt.index(14), which the poll reply order
  satisfies by itself; it now asserts that no dimension 14 follows the write
  before the next request, and its docstring matches.
- test_replay_run4b_zone_2_through_the_climate_entity said "valve off" for a
  run without any dimension 19 / 20 frame and never asserted the commanded
  setpoint: the docstring drops the valve, the body asserts
  _target_temperature == 23.5.
- myhomeserver1_live_2026-10-24 README: 33 zones report a temperature (zone
  43 has an actuator but no dimension 0), 34 answer the actuator request; the
  all-zone actuator test's docstring counts the 43 frames its body asserts
  (44 only with the earlier zone 35 reply).
- test_trace_oracle_validation note for `*michnovka#4*0*60##`: the MyHomeServer1 ACK
  came at 0.50 s with 8 replies; the 17th zone answered by 0.97 s.
- test_replay_knob_turn_shows_dimension_12 (OpenWebNet-HA#810) claimed "dimension 14
  changes nothing" on a run whose every dimension 14 frame carries the
  dimension 12 value, 18.0; the values cannot tell the two apart, so the test
  asserts the dimension 12 hold flag, which only a dimension 12 report sets,
  and says where the discriminating replay is (OpenWebNet-HA#812).
- test_replay_action_sequence_matches_the_recorded_entity_states (OpenWebNet-HA#815)
  compared the replay and the record with two separate literals; it now
  compares the recorded actions with the replay's first changes and says
  the trailing idle was read back, not recorded.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GreenGrassBlueOcean GreenGrassBlueOcean left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gdluck Confirmed — verified all 6 fixture readings, docstrings, and assertions directly against the trace rows (trace_payload["rows"] / frames):

  1. f461_live_2026-10-23 Run 1 & Run 3: 165 read-only requests in total (134 oracle + 31 plant), and *#4*2*#14*0235*3## pushes Dim 12 immediately with no pushed Dim 14 before the next *#4*2## poll (not any(f.startswith("*#4*2*14*") ...)).
  2. f461_live_2026-10-23 Run 4b: Carries no Dim 19/20 actuator frame and leaves zone2._target_temperature == 23.5.
  3. myhomeserver1_live_2026-10-24: 33 zones report Dim 0 temperature while 34 answer *#4*#0*20## (zone 43 has 43#1 only), and 43 actuator frames follow *#4*#0*20## (44 across the run including the earlier *#4*35*20## reply).
  4. test_trace_oracle_validation.py (*#4*0*60##): ACK on MyHomeServer1 at 0.50 s with 8 replies on the command session and 17 zones by 0.97 s.
  5. #810 & #815 assertions: zone._local_target_reported is True cleanly discriminates Dim 12 from Dim 14 when both equal 18.0, and [a.value for a in changes[:len(recorded)]] == [s["hvac_action"] for s in recorded] ties the replay directly to the recorded states.

Merging now (followed by #820 and #817).

@GreenGrassBlueOcean
GreenGrassBlueOcean merged commit 661150b into OpenWebNet-HA:v2-phase1-architecture Oct 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants