Skip to content

Conversation

@liudger
Copy link
Owner

@liudger liudger commented Jan 10, 2026

This pull request introduces support for filtering API section validation by specific parameter names, improving efficiency and flexibility when interacting with the BSB-LAN API. It updates both the core implementation and the test suite to allow for selective validation of parameters, rather than always validating all parameters in a section. This is especially useful for performance-sensitive scenarios or when only a subset of parameters is needed.

API section validation filtering:

  • The _ensure_section_validated, _validate_api_section, and validate_section methods in bsblan.py and utility.py now accept an optional include parameter, allowing validation of only the specified parameter names within a section. [1] [2] [3] [4] [5] [6] [7]
  • The _fetch_section_data method now passes the include filter to section validation, ensuring only relevant parameters are validated and fetched.

Testing and validation:

  • The test suite is updated to mock and verify the new include parameter in validation-related methods, ensuring correctness and maintaining test coverage. [1] [2] [3] [4]
  • New tests are added to test_include_parameter.py to confirm that parameter filtering works as expected during section validation and that unfiltered parameters are not inadvertently removed.

Benchmarking and examples:

  • A new examples/speed_test.py script is added to benchmark different API call strategies, including the new parameter filtering capability, to compare performance between various approaches.

Copilot AI review requested due to automatic review settings January 10, 2026 20:36
@liudger liudger added enhancement Enhancement of the code, not introducing new features. refactor Improvement of existing code, not introducing new features. performance Improving performance, not introducing new features. labels Jan 10, 2026
@codecov
Copy link

codecov bot commented Jan 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (bddbd6e) to head (ef4897e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1311   +/-   ##
=======================================
  Coverage   99.88%   99.88%           
=======================================
  Files           6        6           
  Lines         886      890    +4     
  Branches      121      123    +2     
=======================================
+ Hits          885      889    +4     
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

Copilot AI left a comment

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 adds parameter filtering support to BSB-LAN API section validation, enabling selective validation and fetching of specific parameters within sections. This improves efficiency by allowing API calls to request only needed parameters instead of all section parameters. A comprehensive benchmark script is also added to measure and compare different API call strategies.

Changes:

  • Added optional include parameter to validation methods (_ensure_section_validated, _validate_api_section, validate_section) allowing selective parameter validation within sections
  • Updated test suite to verify the new filtering functionality with comprehensive test cases and properly updated mock signatures
  • Added examples/speed_test.py benchmark script to measure and compare performance of different API call strategies including parameter filtering

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/bsblan/bsblan.py Added include parameter to _ensure_section_validated and _validate_api_section methods; filters section data to only requested parameters before validation
src/bsblan/utility.py Added include parameter to validate_section method; skips validation of parameters not in include list while preserving them in config
tests/test_include_parameter.py Added two new tests verifying parameter filtering during validation and that non-filtered params remain in configuration
tests/test_api_validation.py Updated mock function signatures to accept the new include parameter in four test functions
examples/speed_test.py New benchmark script with 11 tests comparing various API call strategies, parameter filtering, and parallelization approaches

@sonarqubecloud
Copy link

@liudger liudger merged commit 795cf8f into main Jan 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement of the code, not introducing new features. performance Improving performance, not introducing new features. refactor Improvement of existing code, not introducing new features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants