Skip to content

Add Prime feature flag evaluation client#574

Open
d42me wants to merge 1 commit into
mainfrom
feature/platform-feature-flags
Open

Add Prime feature flag evaluation client#574
d42me wants to merge 1 commit into
mainfrom
feature/platform-feature-flags

Conversation

@d42me
Copy link
Copy Markdown
Contributor

@d42me d42me commented Apr 28, 2026

Adds a Prime CLI feature flag client that evaluates defaults via the platform feature-flags endpoint with CLI version and team context, falling back to defaults when evaluation is unavailable.


Note

Low Risk
Low risk: additive client/utilities plus unit tests, with failures explicitly falling back to provided defaults and no changes to auth or existing request flows.

Overview
Introduces feature-flag evaluation support in the Prime CLI via a new FeatureFlagsClient plus convenience helpers evaluate_feature_flags and is_feature_enabled, which POST defaults along with cli_version and optional team_id to /feature-flags/evaluate and merge missing keys back to defaults.

Exports these utilities from prime_cli.__init__ and adds unit tests covering payload context, empty-flag short-circuiting, API-error fallback behavior, and strict boolean handling for is_feature_enabled.

Reviewed by Cursor Bugbot for commit b27f8f3. Bugbot is set up for automated code reviews on this repo. Configure here.

@d42me d42me force-pushed the feature/platform-feature-flags branch from 9f24c73 to b27f8f3 Compare May 19, 2026 20:41
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b27f8f3. Configure here.


def __init__(self, client: APIClient | None = None, config: Config | None = None) -> None:
self.client = client or APIClient()
self.config = config or self.client.config
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Config without client desyncs

Medium Severity

When FeatureFlagsClient or evaluate_feature_flags get a config but no client, a new APIClient uses its own Config for auth and base URL while team_id in the evaluate payload comes from the passed config, so evaluation context can disagree with the request identity.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b27f8f3. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@d42me should we fix or OK?

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