Skip to content

feat: added silent_mode feature#28

Merged
petruki merged 1 commit intomasterfrom
staging
Feb 7, 2026
Merged

feat: added silent_mode feature#28
petruki merged 1 commit intomasterfrom
staging

Conversation

@petruki
Copy link
Member

@petruki petruki commented Feb 7, 2026

This pull request introduces a robust "silent mode" feature to the Switcher client, allowing the client to gracefully handle remote API failures by temporarily switching to local snapshot evaluation and retrying remote calls after a configurable interval. The implementation includes new retry logic, enhancements to context and authentication handling, and comprehensive tests for the silent mode and date utilities.

Silent mode and retry logic:

  • Added silent mode support to ContextOptions and integrated it into client initialization, enabling automatic fallback to local evaluation and retrying remote API calls after a specified interval. (switcher_client/client.py, switcher_client/lib/globals/global_context.py, [1] [2]
  • Implemented retry configuration via the new RetryOptions class and integrated silent mode retry logic in RemoteAuth, including token expiration and renewal handling. (switcher_client/lib/globals/global_retry.py, switcher_client/lib/remote_auth.py, [1] [2] [3] [4]
  • Enhanced remote API health checking and fallback logic, ensuring that the client attempts to re-authenticate and resume remote operations when the API becomes available again. (switcher_client/lib/remote.py, switcher_client/lib/remote.pyR32-R38)

Utility and error handling improvements:

  • Introduced the DateMoment utility class for flexible date/time manipulation, used for calculating retry intervals in silent mode. (switcher_client/lib/utils/date_moment.py, switcher_client/lib/utils/date_moment.pyR1-R26)
  • Improved error handling in the Switcher evaluation flow to trigger silent mode and local snapshot fallback on remote errors. (switcher_client/switcher.py, switcher_client/switcher.pyR40-R51)

Testing and documentation:

  • Added comprehensive tests for silent mode behavior and retry logic, as well as unit tests for the DateMoment utility. (tests/test_switcher_silent_mode.py, tests/utils/test_date_moment.py, [1] [2]
  • Updated documentation to clarify silent mode configuration and removed obsolete TODO comments. (README.md, README.mdL135-R135)

@petruki petruki self-assigned this Feb 7, 2026
@petruki petruki added the enhancement New feature or request label Feb 7, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@petruki petruki merged commit 47a75e0 into master Feb 7, 2026
15 checks passed
@petruki petruki deleted the staging branch February 7, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant