Skip to content

Added load_snapshot in-memory from remote API#13

Merged
petruki merged 1 commit intomasterfrom
staging
Aug 24, 2025
Merged

Added load_snapshot in-memory from remote API#13
petruki merged 1 commit intomasterfrom
staging

Conversation

@petruki
Copy link
Member

@petruki petruki commented Aug 24, 2025

This pull request introduces significant improvements to the snapshot loading and validation logic in the switcher_client library, particularly enhancing support for remote snapshot validation and updates. The changes include new methods for checking and resolving snapshot versions remotely, refactoring of the Snapshot class for more robust JSON parsing, and new tests to ensure correct remote snapshot behavior. Dependency and workflow updates are also included.

Snapshot loading and validation enhancements:

  • Added a LoadSnapshotOptions class and updated Client.load_snapshot to support remote snapshot validation and updating, including a new check_snapshot method to verify and update the snapshot if needed. (switcher_client/client.py, switcher_client/lib/globals/global_snapshot.py) [1] [2] [3]
  • Implemented new remote methods in Remote for checking snapshot version and resolving snapshots via GraphQL, with appropriate error handling. (switcher_client/lib/remote.py) [1] [2]
  • Refactored validate_snapshot and load_domain to use the new remote methods and improved the snapshot loading logic. (switcher_client/lib/snapshot_loader.py) [1] [2]

Refactoring and code structure:

  • Refactored the Snapshot class to encapsulate JSON parsing logic, moving parsing methods into the class for better maintainability. (switcher_client/lib/types.py) [1] [2]
  • Updated error class hierarchy for remote errors to improve consistency and error handling. (switcher_client/errors/__init__.py)

Testing improvements:

  • Added comprehensive tests for remote snapshot loading, validation, and error handling. (tests/test_client_load_snapshot_remote.py, tests/snapshots/default_load_1.json) [1] [2]

Dependency and workflow updates:

  • Upgraded requests and responses dependencies to latest patch versions. (Pipfile)
  • Updated SonarCloud GitHub Action to v5.3.0 in CI workflows. (.github/workflows/master.yml, .github/workflows/sonar.yml) [1] [2]

@petruki petruki self-assigned this Aug 24, 2025
@sonarqubecloud
Copy link

@petruki petruki merged commit 81d406c into master Aug 24, 2025
13 checks passed
@petruki petruki deleted the staging branch August 24, 2025 00:30
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.

1 participant