Skip to content

chore(flagpole-wildcard-ops): Adding support for not_matches op (python)#115901

Merged
Abdkhan14 merged 1 commit into
masterfrom
abdk/flagpole-not-matches-m1
May 20, 2026
Merged

chore(flagpole-wildcard-ops): Adding support for not_matches op (python)#115901
Abdkhan14 merged 1 commit into
masterfrom
abdk/flagpole-not-matches-m1

Conversation

@Abdkhan14
Copy link
Copy Markdown
Contributor

@Abdkhan14 Abdkhan14 commented May 20, 2026

Notes:

Adds a new not_matches condition operator that accepts a list of glob patterns and returns true if the context property value matches none of them. Reuses the existing _glob_star_match helper and _evaluate_matches shared method introduced for matches.

Changes:

src/flagpole/conditions.py — adds NOT_MATCHES to ConditionOperatorKind, refactors MatchesCondition._operator_match into a shared _evaluate_matches method on ConditionBase, adds NotMatchesCondition class (returns not self._evaluate_matches(...)), and registers it in OPERATOR_LOOKUP.

src/flagpole/flagpole-schema.json — adds NotMatchesCondition definition and registers it in the Segment.conditions discriminator and oneOf.

src/sentry/runner/commands/createflag.py — adds NOT_MATCHES to the set of operators that initialize value as a list in the condition wizard.

tests/flagpole/test_conditions.py — adds TestNotMatchesConditions mirroring all TestMatchesConditions cases with inverted assertions: literal match, prefix wildcard, prefix+suffix wildcard, suffix wildcard, multi-star wildcard, star-only pattern, case insensitivity, no-match, multiple patterns, overlapping prefix/suffix anchor guard, and type mismatch errors for list/dict context properties.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 20, 2026
@Abdkhan14 Abdkhan14 marked this pull request as ready for review May 20, 2026 18:21
@Abdkhan14 Abdkhan14 requested review from a team as code owners May 20, 2026 18:21
@Abdkhan14 Abdkhan14 merged commit ffbbb35 into master May 20, 2026
64 checks passed
@Abdkhan14 Abdkhan14 deleted the abdk/flagpole-not-matches-m1 branch May 20, 2026 20:33
JonasBa pushed a commit that referenced this pull request May 21, 2026
…on) (#115901)

Notes:

- In par with sentry-options:
getsentry/sentry-options#127
- Task documentation:
[link](https://www.notion.so/sentry/Adding-wildcard-support-to-flagpole-condition-operators-3598b10e4b5d819e8c16e207ee3a4349)
- Test Duplication: Unlike simpler pairs like in/not_in, glob matching
has enough edge cases (overlapping anchors, multi-segment wildcards,
case folding) that explicit mirrored coverage is worth it.

Adds a new `not_matches` condition operator that accepts a list of glob
patterns and returns true if the context property value matches none of
them. Reuses the existing `_glob_star_match` helper and
`_evaluate_matches` shared method introduced for matches.

Changes:

`src/flagpole/conditions.py` — adds NOT_MATCHES to
`ConditionOperatorKind`, refactors `MatchesCondition._operator_match`
into a shared _evaluate_matches method on `ConditionBase`, adds
`NotMatchesCondition` class (returns not `self._evaluate_matches(...)`),
and registers it in `OPERATOR_LOOKUP`.

`src/flagpole/flagpole-schema.json` — adds `NotMatchesCondition`
definition and registers it in the `Segment.conditions` discriminator
and `oneOf`.

`src/sentry/runner/commands/createflag.py` — adds `NOT_MATCHES` to the
set of operators that initialize value as a list in the condition
wizard.

`tests/flagpole/test_conditions.py` — adds `TestNotMatchesConditions`
mirroring all TestMatchesConditions cases with inverted assertions:
literal match, prefix wildcard, prefix+suffix wildcard, suffix wildcard,
multi-star wildcard, star-only pattern, case insensitivity, no-match,
multiple patterns, overlapping prefix/suffix anchor guard, and type
mismatch errors for list/dict context properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants