test(sigenergy): cover the pVPower REST key fallback - #4772
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_realtimeused a fake response keyed"pvPower"- the natural-looking spelling the original #4663 bug actually read - so it would keep passing even if thepVPower->pvTotalPower->pvPowerfallback 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 --quickand pre-commit both green.🤖 Generated with Claude Code