Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Fix for Case Sensitivity Issue in Python Library When Retrieving Feature Flag Payload#123

Open
reihtw wants to merge 1 commit intoPostHog:masterPostHog/posthog-python:masterfrom
reihtw:patch-1reihtw/posthog-python:patch-1Copy head branch name to clipboard
Open

Fix for Case Sensitivity Issue in Python Library When Retrieving Feature Flag Payload#123
reihtw wants to merge 1 commit intoPostHog:masterPostHog/posthog-python:masterfrom
reihtw:patch-1reihtw/posthog-python:patch-1Copy head branch name to clipboard

Conversation

@reihtw
Copy link

@reihtw reihtw commented May 15, 2024

When trying to retrieve the feature flag payload, it is not possible to do so using uppercase characters because the code always converts the provided feature flag key to lowercase.

This issue occurs only in the Python library. I tried retrieving the payload using other languages, and it works normally.

@neilkakkar neilkakkar requested a review from a team September 5, 2024 11:14
@dmarticus
Copy link
Contributor

dmarticus commented Sep 10, 2024

Hi @reihtw, sorry for the delay in reviewing this, I was OOO for the last week.

I reproduced this issue locally and confirmed that your fix works. Thanks for the contribution! Do you mind adding a test to test/test_feature_flags.py that verifies this behavior? It couldn't hurt to encode these types of bugs into our tests. Something like this

    @mock.patch("posthog.client.decide")
    def test_boolean_feature_flag_payload_for_capitalized_feature_flags_decide(
        self, patch_decide
    ):
        patch_decide.return_value = {"featureFlagPayloads": {"PERSON-FLAG": 300}}
        self.assertEqual(
            self.client.get_feature_flag_payload(
                "PERSON-FLAG", "some-distinct-id", person_properties={"region": "USA"}
            ),
            300,
        )

        self.assertEqual(
            self.client.get_feature_flag_payload(
                "PERSON-FLAG",
                "some-distinct-id",
                match_value=True,
                person_properties={"region": "USA"},
            ),
            300,
        )
        self.assertEqual(patch_decide.call_count, 2)

and maybe another one for the local evaluation path is all we would need :)

Thank you!

@rafaeelaudibert rafaeelaudibert requested review from a team February 19, 2026 03:22
@rafaeelaudibert
Copy link
Member

We've updated our release process. We require sampo now. Please rebase on master and check README to understand what should be done.

@marandaneto
Copy link
Member

@PostHog/team-feature-flags should we get this merged?

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.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.