Repository navigation
chore(react-native): deprecate flag APIs removed in the next major - #5431
turnipdabeets wants to merge 3 commits into
Conversation
|
Coherence0 spec problems · 0 failing chokepoints · 2 spec gaps · 0 guard failures 44 components, 7 bullets (5 invariants, 2 requirements), 0 problems Chokepoints: none declared. Spec gaps: 2 entrances with outside or unknown trust and no traced control, and 10 more held by the adoption baseline
Close one with |
|
Size Change: -6.84 kB (-0.03%) Total Size: 25.2 MB 📦 View Changed
ℹ️ View Unchanged
|
Node SDK compliance v2Commit: e9503ab Capture v0 — acceptance✅ 28 passed / ❌ 3 non-passing / Drill-down: run artifacts → ❌ server_snapshot_payload_false — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_zero — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_null — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: Harness exit: 1; report validation exit: 1. Capture v1 — acceptance✅ 28 passed / ❌ 3 non-passing / Drill-down: run artifacts → ❌ server_snapshot_payload_false — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_zero — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: ❌ server_snapshot_payload_null — failed_assertionExpected native data result Code: Failed step: acceptance/public/evaluate-flags.feature:868 the public snapshot outcomes should have these semantics: Harness exit: 1; report validation exit: 1. Capture v0 — migration✅ 55 passed / ❌ 1 non-passing / Drill-down: run artifacts → ❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. Capture v1 — migration✅ 120 passed / ❌ 1 non-passing / Drill-down: run artifacts → ❌ migration/yaml-parity-v1/remote-flags-v1.feature::Omitted GeoIP settings default to enabled in flag requests — failed_assertionFlags field differs Code: Failed step: migration/yaml-parity-v1/remote-flags-v1.feature:134 the first flags request field "geoip_disable" should equal JSON false Operation: Field: Expected: false Actual value: true Harness exit: 1; report validation exit: 1. |
posthog-js Compliance ReportDate: 2026-10-26 17:46:43 UTC ✅ All Tests Passed!26/26 tests passed Capture Tests✅ 26/26 tests passed View Details
|
| } | ||
|
|
||
| /** | ||
| * @deprecated Use `getAllFeatureFlags()` for every flag, or `getFeatureFlagResult()` for one flag. |
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
[suggestion] Is getFeatureFlagDetails() ready to deprecate yet? PostHogFeatureFlagDetails still carries requestId, errorsWhileComputingFlags, quotaLimited and the per-flag reason/metadata, and FeatureFlagResult only has key, enabled, variant and payload, so anyone reading details?.errorsWhileComputingFlags now gets pointed at APIs that can't give them that.
Your description defers errorsLoading to the major, so maybe hold this one back until then, or say in the message which fields have no replacement yet? Worth it or overkill?
There was a problem hiding this comment.
Agreed. Dropped the getFeatureFlagDetails() deprecation in 82e4864. It moves to the major with the loaded-flags object, as noted in the description.
| } | ||
|
|
||
| /** | ||
| * @deprecated Use `getAllFeatureFlags()` instead, which returns each flag's value and payload together. |
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
[nit] Worth a one-line summary above each @deprecated tag, the way getFeatureFlagPayload has one? The docs parser only emits the TSDoc summary (scripts/docs/documentation.js:15), not the deprecation text, which is why the regenerated reference now has "description": "" on all five entries. On the docs site they'll show a bare deprecated tag with no hint where to go.
There was a problem hiding this comment.
Added a one-line summary above each @deprecated and regenerated the RN reference in 82e4864. The entries now have descriptions.
…FlagWithPayload Add doc summaries to the deprecated flag APIs so the reference shows them.
Problem
posthog-ios 4.0, posthog-android 4.0 and posthog-flutter 6.0 converge on one feature flags API:
getFeatureFlagResult(),getAllFeatureFlags(), anonFeatureFlags()listener, and a reload you can await. React Native still exposes several older map-shaped getters and callbacks that the native SDKs don't have. Deprecating them now lets the next RN major remove them without a surprise.Changes
Adds
@deprecatedJSDoc, with a one-line summary so the docs reference has a description, in@posthog/core.posthog-react-nativeandposthog-js-liteinherit it, since RN doesn't override these methods. No behavior or signature changes.getFeatureFlags()getAllFeatureFlags()getFeatureFlagPayloads()getAllFeatureFlags()getFeatureFlagsAndPayloads()getAllFeatureFlags()onFeatureFlag(key, cb)onFeatureFlags()+getFeatureFlagResult()reloadFeatureFlags({ cb })(thecboption only)reloadFeatureFlagsAsync()useFeatureFlagWithPayload()hook (RN)useFeatureFlagResult()overrideFeatureFlag()updateFlags(), plusdisableRemoteFeatureFlagsto keep the values across flag loadsAlso regenerates the RN
-latestAPI reference, which now tags these methods as deprecated.For reviewers:
reloadFeatureFlags()override already takes no options, so thecbdeprecation only shows up forposthog-js-liteusers.useFeatureFlags()hook still returnsgetFeatureFlags(). I left the hook alone, since there's no hook built ongetAllFeatureFlags()yet. We should decide what it returns in the major.getFeatureFlagDetails()is not deprecated yet:requestId,errorsWhileComputingFlags,quotaLimitedand the per-flagreason/metadatahave no replacement until the loaded-flags object below lands.getFeatureFlags()andgetFeatureFlagDetails()internally. That's fine; the deprecation is for callers.Changes for the major, not made here (they can't be deprecated without changing signatures):
onFeatureFlagsandreloadFeatureFlagsAsync()return a loaded-flags object witherrorsLoading, matchingPostHogFeatureFlagsLoadedon iOS, Android and Flutter. DeprecategetFeatureFlagDetails()once that object carries its fields.{ sendEvent }, while native and Flutter usesendFeatureFlagEvent.captureFeatureView()/captureFeatureInteraction()are missing in RN. They're additive and can ship in a minor.Release info Sub-libraries affected
Libraries affected
(
@posthog/coreis also bumped.)Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
getFeatureFlagPayload()the same way. I searched PRs and issues for these method names and found no earlier attempt or rejection.🤖 Generated with Claude Code