-
Notifications
You must be signed in to change notification settings - Fork 76
feat: support starts_with and ends_with operators in local evaluation #820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| pypi/posthog: minor | ||
| --- | ||
|
|
||
| Support the `starts_with`, `not_starts_with`, `ends_with`, and `not_ends_with` property filter operators in feature flag local evaluation. Matching is case-insensitive and mirrors `icontains`, so flags using these operators no longer fall back to remote evaluation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New public API surface (STRING_OPERATORS value, str_istartswith/str_iendswith) not reflected in the generated public API snapshot
Why we think it's a valid issue
references/public_api_snapshot.txt,posthog/utils.py(for__all__),.github/workflows/ci.yml,Makefile,AGENTS.md, and counted the PR's changed files.references/public_api_snapshot.txt:667literally holds the stale valueSTRING_OPERATORS = ('icontains', 'not_icontains', 'regex', 'not_regex');posthog/utils.pyhas no__all__, so every non-underscore name is tracked, and sibling helpersstr_icontains/str_iequalsalready appear at snapshot lines 1165-1166 β meaning new publicstr_istartswith/str_iendswithmust be added too. The check is a required CI job:.github/workflows/ci.yml:65(public-api) runsmake public_api_check(line 78), backed by.github/scripts/check_public_api.pyand documented inAGENTS.md:47-51..md,feature_flags.py,utils.py, and the two test files β soreferences/public_api_snapshot.txtwas not regenerated, matching the reviewer's confirmation that it is stale.public-apiCI job fails deterministically (snapshot vs. actual surface mismatch on the changedSTRING_OPERATORSvalue and the two new functions), blocking merge untilmake public_api_snapshotis run and committed. Concrete trigger + concrete consequence, directly caused by this PR's public-API changes β a real, actionable blocker, not speculative. (Caveat: this checkout is atmain, not the PR headfd4fcab, so I validated the mechanism and corroborating metadata rather than re-running the check on the PR diff.)Issue description
This chunk changes the public value of
posthog.feature_flags.STRING_OPERATORSand adds two new public functions,posthog.utils.str_istartswithandposthog.utils.str_iendswith(posthog/utils.py:498-537). The repo enforces its public API surface via a generated snapshot atreferences/public_api_snapshot.txt, checked by.github/scripts/check_public_api.pyand run as a dedicated required CI job (public-api/make public_api_check, wired in.github/workflows/ci.yml). AGENTS.md explicitly documents that contributors must runmake public_api_snapshot && make public_api_checkwhenever the public API surface changes. I ranpython .github/scripts/check_public_api.pyagainst this PR's actual head commit (fd4fcab) and confirmed the snapshot is stale: it still showsSTRING_OPERATORS = ('icontains', 'not_icontains', 'regex', 'not_regex')(missing the four new operators) and is missing entries forstr_iendswith/str_istartswithentirely. This is a verified, concrete CI failure, not a hypothetical one, and it directly reflects the exact public API surface added in this chunk.Suggested fix
Run
make public_api_snapshot(thenmake public_api_checkto confirm) and commit the regeneratedreferences/public_api_snapshot.txtalongside this change, so the public API contract file stays in sync with the newstarts_with/ends_withoperators and the two newstr_istartswith/str_iendswithfunctions.Prompt to fix with AI (copy-paste)