Commit 2a45532
fix(server): align FeatureFlagCacheKey shape across put and get paths
The 2.5.0 release added flagKeys and disableGeoip to FeatureFlagCacheKey
and threaded them through getFeatureFlagsFromRemote (put-side), but the
legacy read paths (getFeatureFlagsFromCache, getFeatureFlagError,
getFeatureFlagDetails, getRequestId, getEvaluatedAt) still constructed
the cache key with only the original four fields.
Because the put-side writes under a 6-field key while these read-side
helpers look up under a 4-field key, every cache read from the legacy
flow misses — even after a successful remote evaluation. The visible
symptoms were getFeatureFlagError returning UNKNOWN_ERROR for flags
that actually resolved successfully (it hits the ?: return
FeatureFlagError.UNKNOWN_ERROR fallback when cache.getEntry misses),
$feature_flag_called events on legacy isFeatureEnabled / getFeatureFlag
calls carrying a spurious $feature_flag_error: 'unknown_error' even
though the SDK reached PostHog and got an answer, and
getFeatureFlagDetails / getRequestId / getEvaluatedAt returning null
for flags that were just evaluated.
This change inlines flagKeys = null, disableGeoip = false at each of
the five legacy read sites so their keys match the keys
getFeatureFlagsFromRemote writes when called from the legacy flow
(which always passes those parameters as their defaults). The
evaluateFlags() path is unaffected — it already builds the 6-field
key consistently on both sides.
Adds LegacyCacheKeyRegressionTest with two cases that fail without
this change and pass with it.1 parent cb2b4ed commit 2a45532
3 files changed
Lines changed: 94 additions & 0 deletions
File tree
- .changeset
- posthog-server/src
- main/java/com/posthog/server/internal
- test/java/com/posthog/server/internal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
| |||
648 | 650 | | |
649 | 651 | | |
650 | 652 | | |
| 653 | + | |
| 654 | + | |
651 | 655 | | |
652 | 656 | | |
653 | 657 | | |
| |||
670 | 674 | | |
671 | 675 | | |
672 | 676 | | |
| 677 | + | |
| 678 | + | |
673 | 679 | | |
674 | 680 | | |
675 | 681 | | |
| |||
705 | 711 | | |
706 | 712 | | |
707 | 713 | | |
| 714 | + | |
| 715 | + | |
708 | 716 | | |
709 | 717 | | |
710 | 718 | | |
| |||
824 | 832 | | |
825 | 833 | | |
826 | 834 | | |
| 835 | + | |
| 836 | + | |
827 | 837 | | |
828 | 838 | | |
829 | 839 | | |
| |||
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
0 commit comments