Skip to content

Conversation

@petruki
Copy link
Member

@petruki petruki commented Dec 28, 2025

This pull request refactors and improves the codebase of the switcher_client library. The main focus is on standardizing imports to use relative paths, introducing a more robust strategy validation mechanism, and simplifying how entries are handled for strategy checks. Additionally, several utility and error-handling enhancements have been made.

Strategy Validation and Entry Handling

  • Added the Entry class to lib/types.py to encapsulate strategy and input values, and standardized how entries are constructed and passed throughout the codebase. The new get_entry utility function in lib/utils/__init__.py prepares entries for strategy checks. [1] [2]
  • Refactored the strategy validation logic in lib/resolver.py to use the new Entry class and get_entry function, and added more granular methods for checking strategies and configurations. [1] [2]
  • Updated the process_operation function in lib/snapshot.py to accept a StrategyConfig object directly, and standardized strategy type names (e.g., PAYLOAD_VALIDATION instead of PAYLOAD). [1] [2]

Import and Path Refactoring

  • Changed all absolute imports to relative imports within the package to improve maintainability and compatibility. This affects files such as client.py, lib/remote.py, lib/remote_auth.py, lib/snapshot_loader.py, lib/globals/global_snapshot.py, and others. [1] [2] [3] [4] [5] [6] [7] [8] [9]

API and Error Handling Improvements

  • Added the clear_resources static method to Client for cleaning up resources, improving lifecycle management.
  • Added an explicit __all__ declaration to errors/__init__.py to clarify exported error classes.

Miscellaneous Enhancements

  • Updated .coveragerc to omit version.py from coverage reports.
  • Minor docstring and typing improvements across various files for better readability and maintainability. [1] [2] [3] [4]

These changes collectively improve code clarity, maintainability, and the robustness of strategy validation within the switcher_client library.

@petruki petruki self-assigned this Dec 28, 2025
@sonarqubecloud
Copy link

@petruki petruki merged commit 8676e2b into master Dec 28, 2025
15 checks passed
@petruki petruki deleted the staging branch December 28, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants