Repository navigation
Energy-Charts: Börsenpreisobergrenze ergänzt #4284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -634,3 +634,35 @@ def test_file_operation_0_start_behavior(file_operation_version, finished, expec | |
| with patch.object(update_config, "upgrade_file_operation_0") as upgrade_mock: | ||
| update_config._UpdateConfig__solve_breaking_changes_filesystem() | ||
| assert upgrade_mock.call_count == expected_calls | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("provider_type, configuration, expected_configuration, updated", [ | ||
| ("energycharts", {"surcharge": 0.0001}, {"surcharge": 0.0001, "price_cap": None}, True), | ||
| ("energycharts", {"price_cap": 0.0002}, {"price_cap": 0.0002}, False), | ||
| ("energycharts", {"price_cap": None}, {"price_cap": None}, False), | ||
| ("tibber", {}, {}, False), | ||
| (None, {}, {}, False), | ||
| ]) | ||
| def test_upgrade_datastore_156_adds_energycharts_price_cap( | ||
| mock_pub: Mock, provider_type, configuration, expected_configuration, updated | ||
| ): | ||
| topic = "openWB/optional/ep/flexible_tariff/provider" | ||
| uc = UpdateConfig() | ||
| uc.all_received_topics = { | ||
| topic: json.dumps({"type": provider_type, "configuration": configuration}).encode(), | ||
| "openWB/system/datastore_version": [155], | ||
| } | ||
|
|
||
| uc.upgrade_datastore_156() | ||
|
|
||
| if updated: | ||
| assert uc.all_received_topics[topic] == { | ||
| "type": provider_type, "configuration": expected_configuration | ||
| } | ||
| else: | ||
| assert json.loads(uc.all_received_topics[topic]) == { | ||
| "type": provider_type, "configuration": expected_configuration | ||
| } | ||
| updated_topics = [call.args[0] for call in mock_pub.pub.call_args_list] | ||
| assert (topic in updated_topics) is updated | ||
|
Comment on lines
+666
to
+667
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Wrong migration payload goes unnoticed When Assert that the publication for the provider topic carries the expected migrated configuration. Prompt for AI agentsIn `packages/helpermodules/update_config_test.py` at lines 666-667:
**Wrong migration payload goes unnoticed**
When `Pub.pub` receives a payload different from the migrated provider configuration, `test_upgrade_datastore_156_adds_energycharts_price_cap` extracts only `call.args[0]` at line 666 and checks only the topic at line 667, so it passes when `Pub.pub` publishes an incorrect payload for that topic. The migration can therefore publish the wrong provider configuration without this test detecting it.
Assert that the publication for the provider topic carries the expected migrated configuration. |
||
| assert uc.all_received_topics["openWB/system/datastore_version"] == [155, 156] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · Failed migration is marked complete
When the retained provider payload has not arrived, decoding fails, or an Energy-Charts payload has a missing or null configuration,
_loop_all_received_topicsleaves the provider unmigrated, butupgrade_datastore_156still calls_append_datastore_version(156), so later startups skip the migration and the configuration stays incomplete.Only append datastore version 156 after confirming the provider migration completed successfully.
Also at
packages/helpermodules/update_config.py:4201,packages/helpermodules/update_config.py:4207.Prompt for AI agents