Skip to content

test(sigenergy): cover the pVPower REST key fallback - #4772

Merged
springfall2008 merged 1 commit into
mainfrom
test/sigenergy-pv-key-fallback-coverage
Aug 27, 2026
Merged

test(sigenergy): cover the pVPower REST key fallback#4772
springfall2008 merged 1 commit into
mainfrom
test/sigenergy-pv-key-fallback-coverage

Conversation

@chalfontchubby

Copy link
Copy Markdown
Collaborator

Follow-up to #4755, addressing a Copilot review comment that landed 5 minutes before merge and wasn't picked up.

#4755 fixed two independent bugs but only added a regression test for one of them. The existing test_sigenergy_fetch_inverter_realtime used a fake response keyed "pvPower" - the natural-looking spelling the original #4663 bug actually read - so it would keep passing even if the pVPower -> pvTotalPower -> pvPower fallback chain regressed back to reading the wrong key.

Adds test_sigenergy_fetch_inverter_realtime_pv_power_key_fallback, covering all three positions in the fallback chain plus the "none present" case. Verified it fails against the pre-#4755 behavior (AssertionError: pVPower should be read as the primary PV key, got 0.0) and passes with the fix in place.

Test-only change, no production code touched. ./run_all --quick and pre-commit both green.

🤖 Generated with Claude Code

Copilot flagged this on #4755 after merge: the PR fixed two independent bugs
(REST pVPower key + MQTT never-reported-field clobbering) but only the second
got a regression test. The existing fetch_inverter_realtime test used a fake
response keyed "pvPower" - the natural-looking spelling the original bug
actually read - so it would keep passing even if the pVPower fallback chain
regressed back to reading the wrong key.

Verified the new test fails against the pre-#4755 behavior (asserts "got 0.0"
for the primary pVPower case) and passes with the fallback chain restored.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@springfall2008
springfall2008 merged commit 387b937 into main Aug 27, 2026
2 checks passed
@springfall2008
springfall2008 deleted the test/sigenergy-pv-key-fallback-coverage branch August 27, 2026 17:44
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