You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The posthog-server local evaluator could disagree with the released /flags service for exact matching, JSON values, and case-insensitive string operators.
exact and is_not apply the backend's boolean-like filter gate before ordinary array membership.
Boolean-only and empty filter arrays preserve the backend's aggregate truthiness behavior.
Composite values use compact JSON with recursively sorted keys and backend-compatible escaping.
Integer values retain their JSON spelling.
Floating-point matching falls back to the server because JVM formatting is not identical to serde_json for every finite double.
Exact comparisons use full Unicode lowercase, including final sigma and dotted İ.
Contains, prefix, and suffix comparisons retain ASCII-only lowercase.
The proposed backend cleanup in PostHog/posthog#90694 is a separate draft. This PR intentionally follows the released backend until that proposal is accepted.
The patch changes only posthog-server and includes a patch changeset.
💚 How did you test it?
Red-green regression evidence:
Boolean coercion initially failed for false versus "banana"; the focused evaluator suite now passes.
Composite stringification initially failed for "[1,2]" versus [1, 2]; the focused evaluator suite now passes.
Review follow-ups reproduced null-member omission, broad long-s boolean matching, and nested non-finite failures before their fixes.
$HOME/.pi/agent/skills/autoreview/scripts/autoreview --mode local
The full :posthog-server:test suite reached 512 passing tests. Five unrelated Mockito inline-agent tests fail on the local JDK. Required CI remains the authoritative full-suite check.
Autoreview findings about operand direction and whole-array matching were rejected after verification: propertyValue is the filter operand, and the focused 100-test evaluator class passes the cited vectors.
📝 Checklist
I reviewed the submitted code.
I added tests to verify the changes.
I updated the docs if needed.
No breaking change or entry added to the changelog.
If releasing new changes
Ran pnpm changeset to generate a changeset file
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi implemented and reviewed the change under human direction using the address-pr-comments, check-pr, autoreview, and karpathy-guidelines skills. The released Rust matcher was the source of truth; the separate backend draft was not adopted.
computeExactMatch (posthog-server/src/main/java/com/posthog/server/internal/FlagEvaluator.kt:238) still skips the service's boolean-coercion gate (is_truthy_or_falsy_property_value, rust/feature-flags/src/properties/property_matching.rs:212-220), so exact with filter ["false"] and property "pro" returns false locally and true on /flags (same for filter false vs "banana" and filter [] vs true), while filter ["true","false"] vs "true" returns true locally and false on /flags; pre-existing (identical results on main) and posthog-python's compute_exact_match has the same gap, so follow-up rather than a blocker here.
Addressed the released-backend parity findings in 41fa02a. A focused red test reproduced false versus "banana" returning false locally before the fix; the evaluator now applies the backend boolean-array gate first, including empty-array truthiness, and the same suite passes. Composite values now use compact recursively sorted JSON, while floating-point values return inconclusive and fall back to /flags because JVM formatting cannot reproduce every serde_json spelling. Strong final-sigma and dotted-I vectors pass without changing Kotlin lowercase. PostHog/posthog#90694 remains the separate proposed backend cleanup.
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
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.
💡 Motivation and Context
The
posthog-serverlocal evaluator could disagree with the released/flagsservice for exact matching, JSON values, and case-insensitive string operators.This fixes PostHog/posthog#78019 by matching the current Rust backend contract:
exactandis_notapply the backend's boolean-like filter gate before ordinary array membership.serde_jsonfor every finite double.İ.The proposed backend cleanup in PostHog/posthog#90694 is a separate draft. This PR intentionally follows the released backend until that proposal is accepted.
The patch changes only
posthog-serverand includes a patch changeset.💚 How did you test it?
Red-green regression evidence:
falseversus"banana"; the focused evaluator suite now passes."[1,2]"versus[1, 2]; the focused evaluator suite now passes.Validation:
./gradlew :posthog-server:test --tests 'com.posthog.server.internal.FlagEvaluatorTest' --no-daemonmake checkFormat./gradlew :posthog-server:animalsnifferMain :posthog-server:animalsnifferTest --no-daemon$HOME/.pi/agent/skills/autoreview/scripts/autoreview --mode localThe full
:posthog-server:testsuite reached 512 passing tests. Five unrelated Mockito inline-agent tests fail on the local JDK. Required CI remains the authoritative full-suite check.Autoreview findings about operand direction and whole-array matching were rejected after verification:
propertyValueis the filter operand, and the focused 100-test evaluator class passes the cited vectors.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi implemented and reviewed the change under human direction using the address-pr-comments, check-pr, autoreview, and karpathy-guidelines skills. The released Rust matcher was the source of truth; the separate backend draft was not adopted.