Skip to content

feat: expose client readiness for local evaluation - #280

Open
vjymisal0 wants to merge 5 commits into
Flagsmith:mainfrom
vjymisal0:feat/client-readiness
Open

vjymisal0 wants to merge 5 commits into
Flagsmith:mainfrom
vjymisal0:feat/client-readiness

Conversation

@vjymisal0

Copy link
Copy Markdown

Summary

When the initial environment-document fetch fails, applications using local evaluation cannot tell whether evaluating a flag will use the local document or fall back to the remote API. Add a non-blocking Flagsmith.ready() check so callers can use their own fallback until the background poller has loaded a document.

  • Local and offline clients are ready when an environment document is available. A failed refresh leaves the last successful document usable and readiness stays true.
  • Remote-evaluation clients are immediately ready; this is not an API connectivity or freshness check.
  • Readiness makes no requests and does not alter evaluation or fallback semantics. The README shows how to guard evaluations to avoid per-evaluation remote fallback during an initial outage. Changing fallback behavior automatically would break existing callers, so this takes the explicit readiness-API approach requested in the issue.

Fixes #197

Verification

  • The three new tests fail on unchanged upstream because ready() is absent.
  • pytest -q: 381 passed, including initial fetch failure, recovery, subsequent refresh failure, remote evaluation and offline evaluation.
  • mypy --strict .: passed, 33 source files.
  • Configured Black, isort and Flake8 checks passed for both changed Python files.
  • git diff --check: passed.

Validated on Python 3.12.13 / Windows using the repository's declared dependency ranges. AI assistance was used to implement and test this contribution.

Signed-off-by: vjymisal0 <misalvijay153@gmail.com>
@vjymisal0
vjymisal0 requested a review from a team as a code owner November 11, 2026 04:48
@vjymisal0
vjymisal0 requested review from khvn26 and removed request for a team November 11, 2026 04:48
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The client adds Flagsmith.ready(). The method returns True for remote evaluation. For local or offline evaluation, it returns whether an environment document is loaded. The method does not make requests or wait for data. Tests cover readiness before and after environment updates, including a failed later update. The README documents the method and shows how to check readiness before evaluating a flag.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to f3eea

This adds a non-blocking readiness check with accompanying tests and documentation. The earlier documentation inaccuracy about realtime clients has been corrected, and no merge-blocking risk remains.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ca560bd8-0457-49cc-933f-0b0ea7f15fdf
Commits

Reviewing files that changed from the base of the PR and between 2af2aad and f3eeaf2.

Files selected for processing: 3

  • README.md
  • flagsmith/flagsmith.py
  • tests/test_flagsmith.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 18e99f3f-37bd-494d-bffb-559a107426c3
Commits

Reviewing files that changed from the base of the PR and between b995df4 and 2af2aad.

Files selected for processing: 3

  • README.md
  • flagsmith/flagsmith.py
  • tests/test_flagsmith.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread README.md Resolved
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.

Support a Client Readiness check in local evaluation mode

1 participant