Skip to content

Commit db81c4a

Browse files
MaStrclaude
andcommitted
Housekeeping: update stale comments after rebase on main
- UtilityConfig: update comment to reflect that vat/fees/markup are now validated by validate_provider_required_fields, not by downstream code - dynamictariff.py: add note that required_fields checks are secondary safety guards — primary validation is now in Pydantic at load time Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eb9c525 commit db81c4a

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/batcontrol/config_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ class UtilityConfig(BaseModel):
105105
type: str
106106
apikey: Optional[str] = None
107107
url: Optional[str] = None
108-
# vat/fees/markup are Optional so that downstream required_fields checks
109-
# (in dynamictariff.py) can detect missing config for providers that need them.
110-
# With exclude_none=True, absent keys won't appear in the output dict.
108+
# vat/fees/markup are Optional; validate_provider_required_fields below
109+
# enforces them for known providers at config load time.
110+
# With exclude_none=True, unset fields won't appear in the output dict.
111111
vat: Optional[float] = None
112112
fees: Optional[float] = None
113113
markup: Optional[float] = None

src/batcontrol/dynamictariff/dynamictariff.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def create_tarif_provider(config: dict, timezone,
4242
"""
4343
selected_tariff = None
4444
provider = config.get('type')
45+
# Note: required-field checks below are secondary safety guards.
46+
# Primary validation happens at config load time via Pydantic (config_model.py).
4547

4648
if provider.lower() == 'awattar_at':
4749
required_fields = ['vat', 'markup', 'fees']

0 commit comments

Comments
 (0)