Skip to content

test(execute): stop freeze capability flags leaking between test scenarios - #4692

Merged
springfall2008 merged 1 commit into
mainfrom
fix/execute-test-freeze-flag-isolation
Aug 24, 2026
Merged

test(execute): stop freeze capability flags leaking between test scenarios#4692
springfall2008 merged 1 commit into
mainfrom
fix/execute-test-freeze-flag-isolation

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Summary

Test-isolation bug found while reworking #4435 - independent of that ticket, so raising separately.

fetch_inverter_data() narrows set_charge_freeze / set_export_freeze / set_export_freeze_only when an inverter doesn't support freeze (execute.py:913-921), and never widens them back. In production that's correct: fetch_config_options() re-derives them from raw config every cycle before fetch_inverter_data() runs, so a narrowing lasts exactly one cycle.

run_execute_test() calls fetch_inverter_data() directly and is reused across many scenarios in a single process, so nothing re-derives them there. A single scenario using a freeze-unsupported inverter would silently disable freeze for every later scenario in the run - making test results depend on ordering.

Nothing in the suite currently trips it, so this is preventive rather than a fix to a visibly-failing test - but it's a live trap for anyone adding a freeze-capability scenario later.

Changes

  • Re-derive all three flags from config in run_execute_test() before calling fetch_inverter_data().
  • New regression test test_freeze_flags_do_not_leak_between_scenarios: runs a freeze-unsupported scenario, then a supported one, and asserts all three flags still match config.

Test plan

  • Verified the new test fails without the fix (set_charge_freeze leaked from the previous scenario - is False but config says True) and passes with it
  • ./run_all --test execute passes
  • ./run_pre_commit passes (full suite, ruff, black, cspell, markdownlint)

No production code change.

🤖 Generated with Claude Code

…arios

fetch_inverter_data() narrows set_charge_freeze/set_export_freeze/
set_export_freeze_only when an inverter doesn't support freeze, and never
widens them back. In production that's fine - fetch_config_options()
re-derives them from raw config every cycle before fetch_inverter_data()
runs, so a narrowing lasts exactly one cycle.

run_execute_test() calls fetch_inverter_data() directly and is reused
across many scenarios in one process, so the narrowing persisted for the
rest of the run instead: a single scenario using a freeze-unsupported
inverter would silently disable freeze in every later scenario, making
results depend on test ordering.

Re-derive all three from config in the helper, and add a regression test
that runs a freeze-unsupported scenario followed by a supported one and
asserts the flags survive. Verified the test fails without the fix
(set_charge_freeze stuck at False) and passes with it.

No production code change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@springfall2008
springfall2008 merged commit 0d1e1f1 into main Aug 24, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/execute-test-freeze-flag-isolation branch August 24, 2026 12:27
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