Skip to content

Conversation

@Zaimwa9
Copy link
Contributor

@Zaimwa9 Zaimwa9 commented Dec 18, 2025

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Closes #168

This PR upgrades the flagsmith-flag-engine from v6.1.0 to v10.0.3 following the approach from flagsmith-python-client#150, and implements the hide_disabled_flags project setting.

Changes

Engine Migration (v6 → v10)

  • Upgraded flagsmith-flag-engine from 6.1.0 to 10.0.3
  • Added flagsmith>=5 dependency for TypedDict models and mappers
  • Migrated from Pydantic models to TypedDict-based evaluation contexts
  • Replaced deprecated engine functions with new get_evaluation_result()
  • Used map_environment_document_to_context() and map_context_and_identity_data_to_context() from flagsmith-python-client
  • Updated traits handling from list[TraitModel] to dict[str, ContextValue] with backward compatibility validator
  • Updated response mappers to work with new flag result format

hide_disabled_flags

  • Added _filter_disabled_flags() helper function
  • Implemented filtering in src/edge_proxy/environments.py for both /api/v1/flags/ and /api/v1/identities/ endpoints
    ⚠️ Question: What behavior when fetching a single disabled flag with hide_disabled_flags ? 404 or still returning it ?
    EDIT: Had my response here and will implement.

Tests

  • Added new tests in tests/test_server.py for hide_disabled_flags functionality
  • Added test fixture environment_with_hide_disabled_flags in tests/fixtures/response_data.py

How did you test this code?


Local Integration Testing:
1. Start edge proxy: rye run edge-proxy-serve
2. Test with Node.js SDK pointing to http://localhost:8000/api/v1/
3. Verify responses with hide_disabled_flags both enabled and disabled:

# Get all flags
curl -s -L -H "X-Environment-Key: ser.xxx" \
  http://localhost:8000/api/v1/flags/ | jq

# Get identity flags
curl -s -L -X POST \
  -H "X-Environment-Key: ser.xxx" \
  -H "Content-Type: application/json" \
  -d '{"identifier": "test-user"}' \
  http://localhost:8000/api/v1/identities/ | jq

@Zaimwa9 Zaimwa9 requested a review from a team as a code owner December 18, 2025 11:22
@Zaimwa9 Zaimwa9 requested review from emyller and removed request for a team December 18, 2025 11:22
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.

Context Values: Engine V7 compatibility

2 participants