Skip to content

test(annual): land the heat pump tests stranded in PR #33 - #49

Merged
dandwhelan merged 1 commit into
mainfrom
test/annual-heat-coverage
Aug 20, 2026
Merged

dandwhelan merged 1 commit into
mainfrom
test/annual-heat-coverage

Conversation

@dandwhelan

Copy link
Copy Markdown
Owner

Closes the CI coverage gap on the heat pump comparison. Supersedes #33.

Why not just merge #33

The heat pump feature shipped its production code — annual_heat.py (881 lines), annual_costs.py, and the annual.py / web_annual.py additions are all on main and running live on v712.23. Its tests never landed, and have sat in #33 since 2 August.

#33 can't be merged now to fix that. main's copies have moved a long way past it:

file main vs #33
web_annual.py +336 / −101
annual.py +104 / −31
annual_heat.py +1 / −4

That drift includes the upstream v8.49.0 merge (#46) and the battery-cycles fix (#47). A trial merge conflicts on four files, and resolving it would risk dragging production code back to 2 August to fix a test gap. So this takes the tests only, rebased on current main.

What's here

  • test_annual_heat.py — 752 lines, a file main does not have at all
  • make_heat_model, test_annual_heat_integration → test_annual_integration.py
  • heat_results, test_web_annual_heat, test_web_annual_predheat_prefill → test_web_annual.py
  • 4 suites registered in unit_test.py; subtractable added to the workspace dictionary

One deliberate change from #33

test_annual_heat_integration is registered through a run_annual_heat_integration_isolated wrapper rather than against the shared instance. #33 predates run_annual_integration_isolated, which exists because that test plans a year of sampled days without setting up the state it depends on — inheriting ambient state made it 13x slower (34s → 463s) without ever failing. test_annual_heat_integration is the same shape of test and wants the same treatment for the same reason.

The guards worth having

  • test_annual_heat_integration pins the heat leg's extra no_pvbat import to exactly one day of heat and explicitly not the two-day figure — this is what catches the unbounded end_record regression, where run_prediction() returns running totals over the whole 48-hour plan rather than the end_record window.
  • The model tests hold the identity that the modelled gas bill must not move when the heat pump is added, and that space heating and hot water divide by their own separate efficiencies.

Verification

Full quick suite 242 passed, 0 failed (3 new non-slow suites; annual_heat_integration is slow-marked). All four heat suites pass individually against current main. black and ruff --select=F401 clean.

🤖 Generated with Claude Code

The heat pump comparison shipped without any of its tests. annual_heat.py is 881
lines of production code carrying zero CI coverage, and every test written for it
has sat unmerged in PR #33 since 2 August while the production side landed by
another route.

That PR cannot simply be merged now: main's copies of annual.py, web_annual.py and
annual_heat.py have moved a long way past it (web_annual.py alone is +336/-101,
including the upstream v8.49.0 merge and the battery-cycles fix), so merging the
branch would drag production code backwards to fix a test gap. This takes the tests
only, against current main:

- test_annual_heat.py, absent from the repo entirely (752 lines)
- make_heat_model and test_annual_heat_integration, into test_annual_integration.py
- heat_results, test_web_annual_heat and test_web_annual_predheat_prefill, into
  test_web_annual.py

test_annual_heat_integration is registered through an isolated runner rather than
the shared instance, matching run_annual_integration_isolated. PR #33 predates that
change and registered it directly; it is the same shape of test - it plans a year of
sampled days and never sets up the state it depends on - so it wants the same
treatment for the same documented reason.

Two guards here are the ones worth having: test_annual_heat_integration pins the
heat leg's extra import to exactly one day of heat and explicitly not the two-day
figure, which is what catches the unbounded end_record regression; and the model
tests hold the identity that the modelled gas bill must not move when the heat pump
is added.

Full quick suite 242 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dandwhelan
dandwhelan merged commit 041dbaa into main Aug 20, 2026
2 checks passed
@dandwhelan
dandwhelan deleted the test/annual-heat-coverage branch August 20, 2026 07:13
@dandwhelan dandwhelan mentioned this pull request Aug 21, 2026
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.

2 participants