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

@d42me d42me commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

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
New optional client module with fail-open defaults on API errors; no changes to existing auth or sandbox flows.

Overview
Adds a Prime CLI feature flag client so callers can resolve flag values from the platform instead of hard-coding defaults.

FeatureFlagsClient POSTs to /feature-flags/evaluate with the requested flag defaults, cli_version, and optional team_id, then merges server flags with per-key fallback when a key is missing. evaluate_feature_flags wraps that and returns a copy of defaults on APIError; is_feature_enabled treats only boolean True as enabled. The new symbols are re-exported from prime_cli.

Unit tests cover request payload/context, API failure fallback, empty input (no network call), and strict boolean handling for is_feature_enabled.

Reviewed by Cursor Bugbot for commit 56f6755. 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

@cursor cursor 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.

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?

@d42me d42me force-pushed the feature/platform-feature-flags branch from b27f8f3 to 56f6755 Compare June 11, 2026 19:06
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