Tighten bypass target read contract - #123
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request tightens the contract of the bypass supply temperature target convenience reader so that successful parameter-specific /config reads always produce a typed BypassSupplyTemperatureTarget, and missing target fields now raise an explicit DucoError instead of returning None. This aligns the helper’s behavior with observed device responses (supported zones return the field; unsupported zones return a typed “unsupported capability” error).
Changes:
- Updated
DucoClient.async_get_bypass_supply_temperature_target()to raiseDucoErrorwhen the requested target field is absent from an otherwise valid/configresponse, and to return a non-optional typed model. - Updated unit tests and API-reference generation tests to reflect the new error/return contract.
- Updated generated docs and user-facing documentation (README + config docs + API reference + changelog) to match the tightened behavior.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/api_reference.py | Updates generated API reference metadata notes to document the new “raise on missing field” contract. |
| tests/test_client.py | Adjusts unit test expectations from None to DucoError for missing bypass target fields. |
| tests/test_api_reference.py | Updates API reference content assertion to match new documentation text. |
| src/duco_connectivity/client.py | Changes helper return type to non-optional and raises DucoError if the target field is missing. |
| README.md | Updates user-facing documentation to describe the new behavior (typed result or explicit error). |
| docs/config.md | Updates behavior bullets and example code to reflect non-optional return and error on missing field. |
| docs/api-reference.md | Updates generated API reference signature and notes for the tightened contract. |
| CHANGELOG.md | Records the breaking/behavioral change under Unreleased “Changed”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
This PR tightens the contract of
async_get_bypass_supply_temperature_target().A parameter-specific
GET /config?...¶meter=TempSupTgtZoneXread now either:BypassSupplyTemperatureTargetDucoUnsupportedCapabilityErrorfor unsupported zonesDucoErrorif the requested field is missing from an otherwise successful responseWhy
Live validation against
192.168.3.179showed a clear distinction in API behavior:400 {"Code":3,"Result":"FAILED"}Because this helper already wraps the parameter-specific endpoint, silently returning
Nonefor a missing requested field is less precise than surfacing that as an error. The broader config surface can still model omission separately.Included
Validation
PYTHONPATH=$PWD/src:$PWD .venv/bin/pytest.venv/bin/ruff check src tests.venv/bin/ruff format --check src testsPYTHONPATH=$PWD/src .venv/bin/mypy src.venv/bin/bandit -r src -llpip-auditonly flagged the local.venvtool packagepip 26.1.1with an available fix in26.1.2; no project dependency issue.