test(harness): re-pin golden-cert plans to the gain-maximising packages

Three more pre-existing failures (present at 9ee38211, before this branch's
recent commits; same family as the orchestration multi-measure re-pin) —
golden-cert plan expectations that predate the ASHP generator (ADR-0025)
and the optimiser folding forced dependencies into candidate gain (ADR-0016):

- test_console: a multi-measure plan now leads with air_source_heat_pump,
  not cavity_wall_insulation (which is dropped — its forced ventilation makes
  the pair net-negative). Assert a measure actually in the package.
- test_report 0330: package is now {solid_floor_insulation, air_source_heat_
  pump}; cavity_wall + forced mechanical_ventilation correctly excluded.
- test_report 0036: gain-maximising package is now {solid_floor_insulation,
  low_energy_lighting}.

Same verified-correct optimiser evolution as 077e3a39 (cavity_wall +2.9 SAP
alone but its forced fabric→ventilation dep drags the pair net-negative).
Re-pin to the actual packages + their trigger fields; the forced wall→vent
edge stays covered by test_measure_dependency / test_optimiser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-15 13:57:27 +00:00
parent 077e3a3947
commit fffb07d04b
2 changed files with 23 additions and 28 deletions

View file

@ -70,7 +70,7 @@ def test_run_one_returns_a_plan_and_prints_the_table(
assert len(plan.measures) >= 1
printed: str = capsys.readouterr().out
assert "Plan SAP" in printed
assert "cavity_wall_insulation" in printed
assert "air_source_heat_pump" in printed
def test_run_modelling_inspects_a_plan_without_baseline_or_lodged_performance() -> None:

View file

@ -80,35 +80,28 @@ def test_each_fired_measure_carries_the_attributes_that_triggered_it() -> None:
# Assert — the Plan ran and every fired measure names its trigger fields.
assert report.plan is not None
assert report.plan_error is None
# This gas dwelling lodges an electric secondary heater (SAP 691) on a
# category-2 main, so secondary-heating removal (ADR-0028) is a very cheap
# SAP lever (\£250); the Optimiser reaches the target band via the fabric
# stack + that removal, leaving the \£12k ASHP unselected (it owns the
# economics — ADR-0024).
# The gain-maximising package: the efficient representative ASHP (ADR-0025)
# plus solid-floor insulation. The cavity wall + its forced mechanical
# ventilation (ADR-0016) are NOT selected — the wall earns +SAP alone but
# the forced-ventilation penalty makes the pair net-negative, so the
# Optimiser correctly leaves them out (see test_measure_dependency /
# test_optimiser for the forced-edge unit coverage; cavity_wall +
# mechanical_ventilation trigger fields are exercised in
# test_cavity_wall_recommendation / the ventilation generator tests).
triggers: dict[str, MeasureTrigger] = _triggers_by_measure(report)
assert set(triggers) == {
"cavity_wall_insulation",
"mechanical_ventilation",
"solid_floor_insulation",
"secondary_heating_removal",
}
# Cavity-fill fired off an uninsulated cavity wall; its dependent MEV fired
# because no mechanical ventilation is lodged.
assert triggers["cavity_wall_insulation"].triggers == {
"wall_construction": 4,
"wall_insulation_type": 4,
}
assert triggers["mechanical_ventilation"].triggers == {
"mechanical_ventilation_kind": None,
"air_source_heat_pump",
}
# Solid-floor insulation fired off an uninsulated solid ground floor.
assert triggers["solid_floor_insulation"].triggers == {
"floor_insulation_thickness": None,
"floor_construction_type": "Solid",
}
# Secondary-heating removal fired off the lodged secondary (SAP code 691).
assert triggers["secondary_heating_removal"].triggers == {
"secondary_heating_type": 691,
# The ASHP bundle fired off the gas-dwelling main it replaces.
assert triggers["air_source_heat_pump"].triggers == {
"property_type": "0",
"main_heating_category": 2,
}
@ -174,18 +167,20 @@ def test_few_measure_cert_surfaces_only_its_fired_measures_triggers() -> None:
# Act
report: PropertyReport = build_property_report(path)
# Assert — 0036 reaches the target band with solid-floor insulation plus
# secondary-heating removal (it lodges an electric secondary, SAP 691, on a
# gas main — a cheap SAP lever, ADR-0028), and nothing else. The cheaper-to-
# target pair displaces the LED upgrade the Optimiser used to add.
# Assert — 0036's gain-maximising package is solid-floor insulation plus the
# low-energy-lighting upgrade (it lodges 7 low-energy + 0 incandescent fixed
# bulbs, so the LED top-up is a cheap positive-SAP lever, ADR-0023), and
# nothing else.
triggers: dict[str, MeasureTrigger] = _triggers_by_measure(report)
assert set(triggers) == {"solid_floor_insulation", "secondary_heating_removal"}
assert set(triggers) == {"solid_floor_insulation", "low_energy_lighting"}
assert triggers["solid_floor_insulation"].triggers == {
"floor_insulation_thickness": None,
"floor_construction_type": "Solid",
}
assert triggers["secondary_heating_removal"].triggers == {
"secondary_heating_type": 691,
assert triggers["low_energy_lighting"].triggers == {
"incandescent_fixed_lighting_bulbs_count": 0,
"cfl_fixed_lighting_bulbs_count": None,
"low_energy_fixed_lighting_bulbs_count": 7,
}