Skip to content

Rename API config profiles to API_FULL/API_BASIC#1526

Merged
liudger merged 2 commits into
mainfrom
refactor/drop-api-version-stage-3
Jun 8, 2026
Merged

Rename API config profiles to API_FULL/API_BASIC#1526
liudger merged 2 commits into
mainfrom
refactor/drop-api-version-stage-3

Conversation

@liudger

@liudger liudger commented Jun 8, 2026

Copy link
Copy Markdown
Owner

This pull request refactors the API configuration versioning system in the bsblan project to use clearer, more descriptive identifiers (API_BASIC, API_FULL) instead of version numbers (API_V2, API_V3). It also updates error messages for better clarity and simplifies the API configuration building logic. All usages in the codebase and tests are updated accordingly.

API configuration refactor:

  • Replaces API_V2/API_V3 constants and terminology with API_BASIC/API_FULL throughout the codebase and tests for improved clarity. (src/bsblan/constants.py, src/bsblan/bsblan.py, tests/conftest.py, tests/test_api_initialization.py, tests/test_api_validation.py, tests/test_circuit.py, tests/test_constants.py, tests/test_hot_water_additional.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26]

  • Refactors the build_api_config function to use a full: bool parameter instead of version strings, removing support for version-based configuration selection and simplifying its interface. (src/bsblan/constants.py)

Error handling improvements:

  • Updates error messages and exception handling to use more descriptive text, such as replacing "API version not set" with "API configuration not resolved". (src/bsblan/constants.py, src/bsblan/bsblan.py, tests/test_api_initialization.py) [1] [2] [3]

Documentation and comments:

  • Updates comments and docstrings to reflect the new terminology and clarify the distinction between basic and full configurations, removing references to legacy version numbers. (src/bsblan/constants.py) [1] [2]

Test updates:

  • Refactors all tests to use the new API_BASIC/API_FULL constants and the updated build_api_config interface, ensuring consistency and removing version-based test logic. (tests/conftest.py, tests/test_api_initialization.py, tests/test_api_validation.py, tests/test_circuit.py, tests/test_constants.py, tests/test_hot_water_additional.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22]

These changes make the API configuration system more maintainable and easier to understand, and improve the clarity of error handling and documentation.

liudger added 2 commits June 8, 2026 16:48
…stants

- Rename API_V3 -> API_FULL and API_V2 -> API_BASIC across src and tests
- Refactor build_api_config to a keyword-only full flag and drop the
  SUPPORTED_API_VERSIONS membership check / ValueError path
- Remove SUPPORTED_API_VERSION(S) and BASIC_API_VERSION constants
- Rename ErrorMsg.API_VERSION -> CONFIG_NOT_RESOLVED
  ("API configuration not resolved")
- Update tests and stale v2/v3 comments to capability-based wording
Copilot AI review requested due to automatic review settings June 8, 2026 16:31
@liudger liudger added the refactor Improvement of existing code, not introducing new features. label Jun 8, 2026
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (664f4eb) to head (5ff0f80).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1526   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         1230      1223    -7     
  Branches       140       139    -1     
=========================================
- Hits          1230      1223    -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liudger liudger merged commit 5a746d1 into main Jun 8, 2026
15 checks passed
@liudger liudger deleted the refactor/drop-api-version-stage-3 branch June 8, 2026 16:33
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors how the library represents and selects its API configuration profile by replacing version-number naming (API_V2/API_V3) with clearer profile naming (API_BASIC/API_FULL), and by aligning related error messaging and tests to the new terminology.

Changes:

  • Renamed API configuration constants across the codebase and tests to API_BASIC / API_FULL.
  • Simplified API config construction by switching build_api_config from version strings to a full: bool keyword argument.
  • Updated error messaging for the “capability/config not resolved” defensive paths and adjusted tests accordingly.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/bsblan/constants.py Introduces API_BASIC/API_FULL, updates build_api_config(full=...), and renames related error message constants.
src/bsblan/bsblan.py Switches client config-copy logic and defensive errors to the new config naming and messages.
src/bsblan/_version.py Updates JSON-API threshold constant usage and constructor naming for capability resolution.
tests/conftest.py Updates shared fixture setup to use API_FULL.
tests/test_api_initialization.py Aligns initialization assertions and error expectations to API_FULL and the new error message.
tests/test_api_validation.py Updates validation tests to reference API_FULL instead of legacy naming.
tests/test_circuit.py Updates circuit tests to use the new default build_api_config() interface.
tests/test_constants.py Updates constants/build config tests for API_BASIC/API_FULL and build_api_config(full=...).
tests/test_hot_water_additional.py Updates hot water tests to use API_FULL and the updated “config not resolved” wording.
tests/test_hotwater_state.py Refactors hot water state test config construction to use API_FULL.
tests/test_include_parameter.py Updates include-parameter tests to use API_FULL and adjusted validator setup.
tests/test_initialization.py Updates defensive-path error expectations to the new CONFIG_NOT_RESOLVED message.
tests/test_pps.py Updates PPS setup to use the new default build_api_config() interface.
tests/test_read_parameters.py Updates parameter-reading tests to use API_FULL.
tests/test_sensor.py Renames sensor test fixtures/constants to API_FULL naming.
tests/test_state.py Updates state tests to use API_FULL and updates copied-config construction accordingly.
tests/test_static_state.py Updates static state tests to use API_FULL.
tests/test_temperature_validation.py Updates temperature validation tests to use API_FULL.
tests/test_utility_edge_cases.py Updates API validator edge-case tests to use API_FULL.
tests/test_version_errors.py Updates version/config defensive-path test to assert the new CONFIG_NOT_RESOLVED error message.

Comment thread src/bsblan/constants.py
Comment on lines +17 to +18
# is rejected, the [MIN_SUPPORTED_JSON_API, V3_JSON_API_MINIMUM) range selects
# the basic single-circuit config, and a version >= V3_JSON_API_MINIMUM selects
Comment thread src/bsblan/_version.py
Comment on lines 34 to 36
json_api_minimum: str = MIN_SUPPORTED_JSON_API,
json_api_v3_minimum: str = V3_JSON_API_MINIMUM,
json_api_v2_minimum: str = V2_JSON_API_MINIMUM,
) -> None:
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

refactor Improvement of existing code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants