fix(flags): align local case folding with the flags service - #902
fix(flags): align local case folding with the flags service#902marandaneto wants to merge 4 commits into
Conversation
posthog-python Compliance ReportDate: 2026-08-28 06:27:56 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Prompt To Fix All With AI### Issue 1
posthog/test/test_feature_flags.py:5105-5106
**Parameterize matching test cases**
The new exact-matching cases run several input tuples through manual loops, so failures identify only the enclosing test method rather than the individual case. Using the existing parameterized-test pattern would provide clearer case-level diagnostics; the same pattern applies to the new float-stringification cases.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(flags): preserve the utils module ex..." | Re-trigger Greptile |
|
|
|
Addressed the current-backend parity concerns in signed commit |
💡 Motivation and Context
Local feature flag evaluation returned different
exactand string-operator results from the released/flagsservice.This fixes PostHog/posthog#78019 against the service's current Rust matcher. A separate draft proposes simplifying the backend's unusual boolean behavior: PostHog/posthog#90694. This PR intentionally mirrors the released behavior until that proposal merges.
The evaluator now:
serde_json, including exponent thresholds and negative zero/flagsexactandis_notPython preserves integer and float types after JSON parsing, but it does not preserve a number's original source spelling. Matching uses the canonical spelling produced from the parsed value, as the backend does with
serde_json::Value.💚 How did you test it?
Red-green regression coverage reproduces the released backend's boolean precedence, empty arrays, composite JSON, float spellings, final sigma, and dotted capital I.
uv run pytest -q- 2,285 passed, 15 skippeduv run ruff check .uv run ruff format --check .uv run mypy --no-site-packages --config-file mypy.ini . | uv run mypy-baseline filteruv run python .github/scripts/check_public_api.pyuv run python -W error -c 'import posthog'serde_jsonformatting in a temporary differential checkautoreview --mode local- no actionable findings after one accepted blocker was fixed📝 Checklist
If releasing new changes
sampo addto generate a changeset fileThe patch changeset is
.sampo/changesets/standardize-flag-case-folding.md.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi used the address-pr-comments, check-pr, autoreview, and karpathy-guidelines skills. The final review caught a non-finite value bypass in the boolean path, which was fixed before publication. A human must review before merge.