Skip to content

fix(surveys): exclude web-only display conditions on non-web SDKs - #20

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/exclude-web-only-survey-conditions
Draft

fix(surveys): exclude web-only display conditions on non-web SDKs#20
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/exclude-web-only-survey-conditions

Conversation

@posthog

@posthog posthog Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Why

posthog-ios#733 ("don't show web-only surveys (selector/url) on iOS") fixed iOS's getActiveMatchingSurveys eligibility filter, which decoded a survey's conditions.selector/conditions.url display-targeting fields but never evaluated them — a survey scoped to web via CSS selector/URL matching rendered natively on iOS with non-functional buttons, since those conditions have no meaning outside a browser DOM. The PR description claims this "keeps parity with the other native SDKs (Android, Flutter, React Native)."

That claim only holds up partially. I checked source directly rather than trusting the PR description:

  • React Native (posthog-js's getActiveMatchingSurveys.ts) already excludes selector/URL-only-conditioned surveys, with dedicated test coverage — it was never affected.
  • Android (PostHogSurveysIntegration.getActiveMatchingSurveys()) never reads conditions.selector/conditions.url at all — the exact same gap iOS just fixed, still present.
  • Flutter has no independent eligibility logic; it delegates to whichever native SDK it wraps, so it inherits Android's gap on Android and iOS's (now-fixed) behavior on iOS.

openspec/specs/surveys/spec.md behavior item 5 only names "platform-specific display constraints" — vague enough to not actually state this rule. Per this repo's stated purpose (state the canonical winner where SDKs diverge), React Native's pre-existing correct behavior — now matched by iOS — is the target; Android and Flutter are documented as not yet conforming rather than silently assumed fixed.

What this PR does

  • Names the concrete exclusion rule in Behavior item 5 instead of the vague "platform-specific display constraints" phrase.
  • Adds one new @client scenario to the Canonical surveys behavior requirement (via openspec/changes/archive/2026-07-31-exclude-web-only-survey-conditions/, following this repo's propose→archive convention).
  • openspec validate --specs --strict passes.

Uncertain / flagged for reviewer attention

  • posthog-android does not conform — confirmed by reading PostHogSurveysIntegration.kt directly, not just trusting the iOS PR's parity claim. This PR only documents the target contract; it does not fix Android or open tracking work for it (noted in tasks.md §4).
  • posthog-flutter's conformance is inherited from whichever native SDK it wraps at runtime, so it's non-conforming on Android today too.

Created with PostHog Code

iOS just fixed rendering CSS-selector/URL-scoped surveys natively; verified Android has the same gap and RN already excludes them, so the spec should state the exclusion as the canonical target rather than staying silent.

Generated-By: PostHog Code
Task-Id: 7d7cb7ed-0d67-4718-ada0-2b2cd585f3a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants