survey-sdk-audit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Surveys SDK Feature Audit Skill

调研SDK功能审核Skill

Use this skill when auditing survey feature support across PostHog SDKs for
surveyVersionRequirements.ts
.
Feature to audit: $ARGUMENTS
当针对
surveyVersionRequirements.ts
审核各PostHog SDK的调研功能支持情况时,使用本Skill。
待审核功能: $ARGUMENTS

Setup Check (Run First)

前置检查(首先执行)

Before starting, verify the SDK paths are accessible. Run
ls
on each path:
  • $POSTHOG_JS_PATH
  • $POSTHOG_IOS_PATH
  • $POSTHOG_ANDROID_PATH
  • $POSTHOG_FLUTTER_PATH
If any path is empty or doesn't exist, ask the user: "I need the path to [SDK repo] on your machine. Where is it located?"
Once you have all paths, ask the user if they'd like to save them for future sessions by adding to
.claude/settings.local.json
:
json
{
  "env": {
    "POSTHOG_JS_PATH": "/path/to/posthog-js",
    "POSTHOG_IOS_PATH": "/path/to/posthog-ios",
    "POSTHOG_ANDROID_PATH": "/path/to/posthog-android",
    "POSTHOG_FLUTTER_PATH": "/path/to/posthog-flutter"
  },
  "permissions": {
    "allow": [
      "Read(/path/to/posthog-js/**)",
      "Read(/path/to/posthog-ios/**)",
      "Read(/path/to/posthog-android/**)",
      "Read(/path/to/posthog-flutter/**)",
      "Grep(/path/to/posthog-js/**)",
      "Grep(/path/to/posthog-ios/**)",
      "Grep(/path/to/posthog-android/**)",
      "Grep(/path/to/posthog-flutter/**)"
    ]
  }
}
Note: The
Read
and
Grep
permissions grant Claude access to these external SDK repositories without prompting each time.
开始前,请验证SDK路径是否可访问。在每个路径下执行
ls
命令:
  • $POSTHOG_JS_PATH
  • $POSTHOG_IOS_PATH
  • $POSTHOG_ANDROID_PATH
  • $POSTHOG_FLUTTER_PATH
如果任何路径为空或不存在,请询问用户:"我需要你机器上[SDK仓库]的路径,它位于哪里?"
获取所有路径后,请询问用户是否希望将其保存到
.claude/settings.local.json
中,以便后续会话使用:
json
{
  "env": {
    "POSTHOG_JS_PATH": "/path/to/posthog-js",
    "POSTHOG_IOS_PATH": "/path/to/posthog-ios",
    "POSTHOG_ANDROID_PATH": "/path/to/posthog-android",
    "POSTHOG_FLUTTER_PATH": "/path/to/posthog-flutter"
  },
  "permissions": {
    "allow": [
      "Read(/path/to/posthog-js/**)",
      "Read(/path/to/posthog-ios/**)",
      "Read(/path/to/posthog-android/**)",
      "Read(/path/to/posthog-flutter/**)",
      "Grep(/path/to/posthog-js/**)",
      "Grep(/path/to/posthog-ios/**)",
      "Grep(/path/to/posthog-android/**)",
      "Grep(/path/to/posthog-flutter/**)"
    ]
  }
}
注意
Read
Grep
权限允许Claude访问这些外部SDK仓库,无需每次都提示。

Using SDK Paths in Commands

在命令中使用SDK路径

IMPORTANT: Environment variables like
$POSTHOG_JS_PATH
do NOT expand reliably in Bash tool commands.
Instead of bash commands, prefer:
  • Use the Read tool to read files (works with permissions)
  • Use the Grep tool to search files (works with permissions)
If you must use bash, first expand the variable:
bash
echo $POSTHOG_JS_PATH
Then use the echoed path directly in subsequent commands.
重要提示:像
$POSTHOG_JS_PATH
这样的环境变量在Bash工具命令中无法可靠地展开。
请优先使用以下方式替代Bash命令:
  • 使用Read工具读取文件(权限验证有效)
  • 使用Grep工具搜索文件(权限验证有效)
如果必须使用Bash,请先展开变量:
bash
echo $POSTHOG_JS_PATH
然后在后续命令中直接使用输出的路径。

Tracking Issue

跟踪Issue

All survey SDK feature parity work is tracked in: https://github.com/PostHog/posthog/issues/45658
When creating new issues for missing features:
  1. Create the issue in the appropriate SDK repo (see labels below)
  2. Add the issue to the tracking issue's "Tracked Issues" section as a task list item:
    markdown
    - [ ] https://github.com/PostHog/repo/issues/123
    Note: GitHub automatically expands issue links to show titles, so no description is needed.
  3. Update the relevant feature table in the tracking issue if needed
To update the tracking issue body:
Step 1: Fetch the current body to a temp file:
bash
gh api repos/PostHog/posthog/issues/45658 --jq '.body' > /tmp/tracking_issue_body.md
Step 2: Use the Edit tool to modify
/tmp/tracking_issue_body.md
. This ensures the user can review the diff of your changes before proceeding.
Step 3: After the user has approved the edits, push the update:
bash
gh api repos/PostHog/posthog/issues/45658 -X PATCH -f body="$(cat /tmp/tracking_issue_body.md)"
Important: Always use the Edit tool on the temp file rather than writing directly. This gives the user visibility into exactly what changes are being made to the tracking issue.
所有调研SDK功能一致性工作都在以下地址跟踪: https://github.com/PostHog/posthog/issues/45658
为缺失功能创建新Issue时:
  1. 在对应的SDK仓库中创建Issue(见下方标签说明)
  2. 将该Issue添加到跟踪Issue的"Tracked Issues"部分,作为任务列表项:
    markdown
    - [ ] https://github.com/PostHog/repo/issues/123
    注意:GitHub会自动展开Issue链接以显示标题,因此无需添加描述。
  3. 如有需要,更新跟踪Issue中相关的功能表格
更新跟踪Issue内容的步骤:
步骤1:将当前内容获取到临时文件:
bash
gh api repos/PostHog/posthog/issues/45658 --jq '.body' > /tmp/tracking_issue_body.md
步骤2:使用Edit工具修改
/tmp/tracking_issue_body.md
。这样可以确保用户在继续操作前,能够查看你所做更改的差异。
步骤3:用户批准修改后,推送更新:
bash
gh api repos/PostHog/posthog/issues/45658 -X PATCH -f body="$(cat /tmp/tracking_issue_body.md)"
重要提示】:始终先在临时文件上使用Edit工具,而非直接写入。这样用户可以清楚地看到你对跟踪Issue所做的具体更改。

SDK Paths and Changelogs

SDK路径与更新日志

SDKCode PathChangelog
posthog-js (browser)
$POSTHOG_JS_PATH/packages/browser
$POSTHOG_JS_PATH/packages/browser/CHANGELOG.md
posthog-react-native
$POSTHOG_JS_PATH/packages/react-native
$POSTHOG_JS_PATH/packages/react-native/CHANGELOG.md
posthog-ios
$POSTHOG_IOS_PATH
$POSTHOG_IOS_PATH/CHANGELOG.md
posthog-android
$POSTHOG_ANDROID_PATH
$POSTHOG_ANDROID_PATH/CHANGELOG.md
posthog-flutter
$POSTHOG_FLUTTER_PATH
$POSTHOG_FLUTTER_PATH/CHANGELOG.md
SDK代码路径更新日志
posthog-js(浏览器)
$POSTHOG_JS_PATH/packages/browser
$POSTHOG_JS_PATH/packages/browser/CHANGELOG.md
posthog-react-native
$POSTHOG_JS_PATH/packages/react-native
$POSTHOG_JS_PATH/packages/react-native/CHANGELOG.md
posthog-ios
$POSTHOG_IOS_PATH
$POSTHOG_IOS_PATH/CHANGELOG.md
posthog-android
$POSTHOG_ANDROID_PATH
$POSTHOG_ANDROID_PATH/CHANGELOG.md
posthog-flutter
$POSTHOG_FLUTTER_PATH
$POSTHOG_FLUTTER_PATH/CHANGELOG.md

Flutter Native Dependencies

Flutter原生依赖

Flutter wraps native SDKs. Check dependency versions in:
  • iOS:
    $POSTHOG_FLUTTER_PATH/ios/posthog_flutter.podspec
    (look for
    s.dependency 'PostHog'
    )
  • Android:
    $POSTHOG_FLUTTER_PATH/android/build.gradle
    (look for
    posthog-android
    dependency)
Flutter封装了原生SDK。请在以下位置检查依赖版本:
  • iOS:
    $POSTHOG_FLUTTER_PATH/ios/posthog_flutter.podspec
    (查找
    s.dependency 'PostHog'
  • Android:
    $POSTHOG_FLUTTER_PATH/android/build.gradle
    (查找
    posthog-android
    依赖)

Audit Process

审核流程

Step 1: Understand the Feature

步骤1:理解功能

Look at the
check
function in
surveyVersionRequirements.ts
to understand what field/condition triggers this feature:
  • s.conditions?.deviceTypes
    → search for "deviceTypes"
  • s.appearance?.fontFamily
    → search for "fontFamily"
  • s.conditions?.urlMatchType
    → search for "urlMatchType"
查看
surveyVersionRequirements.ts
中的
check
函数,了解触发此功能的字段/条件:
  • s.conditions?.deviceTypes
    → 搜索"deviceTypes"
  • s.appearance?.fontFamily
    → 搜索"fontFamily"
  • s.conditions?.urlMatchType
    → 搜索"urlMatchType"

Step 2: Search Changelogs First

步骤2:先检查更新日志

bash
undefined
bash
undefined

Search changelog for the feature keyword

在更新日志中搜索功能关键词

grep -n -i "KEYWORD" /path/to/CHANGELOG.md

If found, read the surrounding lines to get the version number.
grep -n -i "KEYWORD" /path/to/CHANGELOG.md

如果找到,请阅读周围内容以获取版本号。

Step 3: Search Code If Not in Changelog

步骤3:如果更新日志中没有找到,搜索代码

bash
undefined
bash
undefined

Find commits that added the keyword (use -S for exact string match)

查找添加了该关键词的提交(使用-S进行精确字符串匹配)

cd /path/to/sdk && git log --oneline --all -S "KEYWORD" -- ".swift" ".kt" ".ts" ".tsx"
cd /path/to/sdk && git log --oneline --all -S "KEYWORD" -- ".swift" ".kt" ".ts" ".tsx"

Then find the first version tag containing that commit

然后找到包含该提交的首个版本标签

git tag --contains COMMIT_HASH | sort -V | head -3
undefined
git tag --contains COMMIT_HASH | sort -V | head -3
undefined

Step 4: For Flutter, Find When Native Dependency Was Bumped

步骤4:对于Flutter,查找原生依赖版本升级的时间

bash
undefined
bash
undefined

Find when Flutter started requiring iOS version X.Y.Z

查找Flutter开始要求iOS版本X.Y.Z的时间

cd $POSTHOG_FLUTTER_PATH && git log --oneline -p -- "ios/posthog_flutter.podspec" | grep -B10 "X.Y.Z"
cd $POSTHOG_FLUTTER_PATH && git log --oneline -p -- "ios/posthog_flutter.podspec" | grep -B10 "X.Y.Z"

Get the Flutter version for that commit

获取该提交对应的Flutter版本

git tag --contains COMMIT_HASH | sort -V | head -1
undefined
git tag --contains COMMIT_HASH | sort -V | head -1
undefined

Step 5: Verify Feature Actually Works (Not Just Types)

步骤5:验证功能是否真正可用(不只是类型定义)

CRITICAL: Having a field in a data model does NOT mean the feature is implemented. You must check the actual filtering/matching logic.
SDK rendering capabilities:
  • posthog-js (browser): Built-in survey rendering (HTML/CSS popup)
  • posthog-react-native: Built-in survey rendering (React Native components in
    packages/react-native/src/surveys/
    )
  • posthog-ios: Built-in survey rendering (SwiftUI views in
    PostHog/Surveys/
    SurveySheet.swift
    ,
    QuestionTypes.swift
    ,
    MultipleChoiceOptions.swift
    )
  • posthog-android: No built-in UI — pure delegate pattern. Exposes display models (
    PostHogDisplaySurvey
    ,
    PostHogDisplayChoiceQuestion
    , etc.) for developers to render themselves. Use
    issue: false
    for rendering-only features.
  • posthog-flutter: Built-in survey rendering (Flutter widgets in
    lib/src/surveys/widgets/
    survey_bottom_sheet.dart
    ,
    choice_question.dart
    )
For SDKs with built-in rendering, a feature must be actually implemented in the rendering code, not just present as a field on the data model. For Android (delegate-only), exposing the field on the display model is sufficient — mark as
issue: false
with a comment.
Key files to check for survey filtering logic:
  • posthog-js (browser):
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx
    - utility functions like
    canActivateRepeatedly
    ,
    getSurveySeen
    ,
    hasEvents
  • posthog-js (browser):
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.tsx
    - main survey logic
  • posthog-react-native:
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts
    - main filtering logic
  • posthog-react-native:
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts
    - utility functions like
    canActivateRepeatedly
    ,
    hasEvents
  • posthog-ios:
    $POSTHOG_IOS_PATH/PostHog/Surveys/PostHogSurveyIntegration.swift
    getActiveMatchingSurveys()
    method,
    canActivateRepeatedly
    computed property
  • posthog-android:
    $POSTHOG_ANDROID_PATH/posthog-android/src/main/java/com/posthog/android/surveys/PostHogSurveysIntegration.kt
    getActiveMatchingSurveys()
    method,
    canActivateRepeatedly()
    function
Key utility functions to compare across SDKs:
  • canActivateRepeatedly
    - determines if a survey can be shown again after being seen
  • hasEvents
    - checks if survey has event-based triggers
  • getSurveySeen
    - checks if user has already seen the survey
Example pitfall 1: Both iOS and Android have
linkedFlagKey
in their Survey model, but neither implements
linkedFlagVariant
checking. They only call
isFeatureEnabled(key)
(boolean) instead of comparing
flags[key] === variant
.
Example pitfall 2: The browser
canActivateRepeatedly
checks THREE conditions: (1) event repeatedActivation, (2)
schedule === 'always'
, (3) survey in progress. Mobile SDKs may only check condition (1), missing the
schedule
check entirely.
Key files to check for survey rendering logic:
  • posthog-js (browser):
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx
    -
    getDisplayOrderQuestions()
    ,
    getDisplayOrderChoices()
  • posthog-react-native:
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts
    -
    getDisplayOrderQuestions()
    ,
    getDisplayOrderChoices()
  • posthog-ios:
    $POSTHOG_IOS_PATH/PostHog/Surveys/QuestionTypes.swift
    -
    SingleChoiceQuestionView
    ,
    MultipleChoiceQuestionView
    ;
    $POSTHOG_IOS_PATH/PostHog/Surveys/SurveySheet.swift
    - question ordering
  • posthog-android: No built-in UI — only check display model exposure in
    $POSTHOG_ANDROID_PATH/posthog/src/main/java/com/posthog/surveys/PostHogDisplaySurveyQuestion.kt
    and
    PostHogDisplaySurveyAppearance.kt
  • posthog-flutter:
    $POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/survey_bottom_sheet.dart
    - question ordering;
    $POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/choice_question.dart
    - choice rendering
What to look for:
  • Is the field parsed from JSON into the model? (necessary but not sufficient)
  • Is the field used in filtering logic like
    getActiveMatchingSurveys()
    ?
  • For rendering features: Is the field actually used by the built-in UI? (check rendering code, not just data models)
  • Does the logic match the reference implementation behavior?
  • Test files don't count as implementation
关键提示:数据模型中存在某个字段并不意味着该功能已实现。你必须检查实际的过滤/匹配逻辑。
SDK渲染能力:
  • posthog-js(浏览器):内置调研渲染(HTML/CSS弹窗)
  • posthog-react-native:内置调研渲染(位于
    packages/react-native/src/surveys/
    的React Native组件)
  • posthog-ios:内置调研渲染(位于
    PostHog/Surveys/
    的SwiftUI视图 —
    SurveySheet.swift
    QuestionTypes.swift
    MultipleChoiceOptions.swift
  • posthog-android无内置UI — 纯委托模式。暴露显示模型(
    PostHogDisplaySurvey
    PostHogDisplayChoiceQuestion
    等)供开发者自行渲染。对于仅涉及渲染的功能,标记为
    issue: false
  • posthog-flutter:内置调研渲染(位于
    lib/src/surveys/widgets/
    Flutter组件 —
    survey_bottom_sheet.dart
    choice_question.dart
对于有内置渲染的SDK,功能必须在渲染代码中实际实现,而不仅仅是在数据模型中存在字段。对于Android(仅委托模式),只要在显示模型中暴露字段即可 — 标记为
issue: false
并添加注释。
调研过滤逻辑需检查的关键文件:
  • posthog-js(浏览器)
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx
    - 工具函数如
    canActivateRepeatedly
    getSurveySeen
    hasEvents
  • posthog-js(浏览器)
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.tsx
    - 主调研逻辑
  • posthog-react-native
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts
    - 主过滤逻辑
  • posthog-react-native
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts
    - 工具函数如
    canActivateRepeatedly
    hasEvents
  • posthog-ios
    $POSTHOG_IOS_PATH/PostHog/Surveys/PostHogSurveyIntegration.swift
    getActiveMatchingSurveys()
    方法、
    canActivateRepeatedly
    计算属性
  • posthog-android
    $POSTHOG_ANDROID_PATH/posthog-android/src/main/java/com/posthog/android/surveys/PostHogSurveysIntegration.kt
    getActiveMatchingSurveys()
    方法、
    canActivateRepeatedly()
    函数
各SDK需对比的关键工具函数:
  • canActivateRepeatedly
    - 确定调研在被查看后是否可以再次显示
  • hasEvents
    - 检查调研是否有基于事件的触发条件
  • getSurveySeen
    - 检查用户是否已查看过该调研
示例陷阱1:iOS和Android的Survey模型中都有
linkedFlagKey
,但两者都未实现
linkedFlagVariant
检查。它们仅调用
isFeatureEnabled(key)
(布尔值),而非比较
flags[key] === variant
示例陷阱2:浏览器端的
canActivateRepeatedly
检查三个条件:(1) 事件重复激活设置,(2)
schedule === 'always'
,(3) 调研是否在进行中。移动端SDK可能仅检查条件(1),完全遗漏了
schedule
检查。
调研渲染逻辑需检查的关键文件:
  • posthog-js(浏览器)
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx
    -
    getDisplayOrderQuestions()
    getDisplayOrderChoices()
  • posthog-react-native
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts
    -
    getDisplayOrderQuestions()
    getDisplayOrderChoices()
  • posthog-ios
    $POSTHOG_IOS_PATH/PostHog/Surveys/QuestionTypes.swift
    -
    SingleChoiceQuestionView
    MultipleChoiceQuestionView
    $POSTHOG_IOS_PATH/PostHog/Surveys/SurveySheet.swift
    - 问题排序
  • posthog-android:无内置UI — 仅检查
    $POSTHOG_ANDROID_PATH/posthog/src/main/java/com/posthog/surveys/PostHogDisplaySurveyQuestion.kt
    PostHogDisplaySurveyAppearance.kt
    中的显示模型暴露情况
  • posthog-flutter
    $POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/survey_bottom_sheet.dart
    - 问题排序;
    $POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/choice_question.dart
    - 选项渲染
需要检查的内容:
  • 该字段是否从JSON解析到模型中?(必要但不充分)
  • 该字段是否在
    getActiveMatchingSurveys()
    等过滤逻辑中使用?
  • 对于渲染功能:该字段是否被内置UI实际使用?(检查渲染代码,而非仅数据模型)
  • 逻辑是否与参考实现的行为一致?
  • 测试文件不计入实现

Reference Implementation

参考实现

posthog-js browser is the canonical implementation - it has every feature and is the source of truth for how things are supposed to work.
When auditing a feature:
  1. First check
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.ts
    to understand the complete, correct behavior
  2. Then compare mobile SDKs against posthog-react-native (
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts
    ) which is the reference for mobile-specific implementations
posthog-js浏览器端是标准实现 - 它包含所有功能,是功能预期工作方式的唯一来源。
审核功能时:
  1. 首先查看
    $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.ts
    ,了解完整、正确的行为
  2. 然后将移动端SDK与posthog-react-native(
    $POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts
    )进行对比,后者是移动端特定实现的参考

Web-Only vs Cross-Platform Features

仅Web端与跨平台功能

Some features only make sense on web:
  • URL targeting: No concept of "current URL" in native apps →
    issue: false
    for all mobile
  • CSS selector targeting: No DOM in native apps →
    issue: false
    for all mobile
  • Custom fonts via CSS: May need native implementation or may not be applicable
有些功能仅在Web端有意义:
  • URL定向:原生应用中没有"当前URL"的概念 → 所有移动端SDK标记为
    issue: false
  • CSS选择器定向:原生应用中没有DOM → 所有移动端SDK标记为
    issue: false
  • 通过CSS自定义字体:可能需要原生实现或不适用

Output Format

输出格式

For each feature, produce:
typescript
{
    feature: 'Feature Name',
    sdkVersions: {
        'posthog-js': 'X.Y.Z',
        'posthog-react-native': 'X.Y.Z',  // or omit if unsupported
        'posthog-ios': 'X.Y.Z',
        'posthog-android': 'X.Y.Z',
        'posthog_flutter': 'X.Y.Z',  // add comment: first version to require native SDK >= X.Y
    },
    unsupportedSdks: [
        { sdk: 'sdk-name', issue: 'https://github.com/PostHog/repo/issues/123' },  // needs implementation
        { sdk: 'sdk-name', issue: false },  // not applicable (e.g., web-only feature)
    ],
    check: (s) => ...,
}
对于每个功能,生成如下内容:
typescript
{
    feature: '功能名称',
    sdkVersions: {
        'posthog-js': 'X.Y.Z',
        'posthog-react-native': 'X.Y.Z',  // 若不支持可省略
        'posthog-ios': 'X.Y.Z',
        'posthog-android': 'X.Y.Z',
        'posthog_flutter': 'X.Y.Z',  // 添加注释:首个要求原生SDK >= X.Y的版本
    },
    unsupportedSdks: [
        { sdk: 'sdk名称', issue: 'https://github.com/PostHog/repo/issues/123' },  // 需要实现
        { sdk: 'sdk名称', issue: false },  // 不适用(如仅Web端功能)
    ],
    check: (s) => ...,
}

Creating GitHub Issues

创建GitHub Issues

IMPORTANT: Always search for existing issues BEFORE creating new ones.
bash
undefined
重要提示:创建新Issue前,请务必先搜索现有Issue。
bash
undefined

Search in the SDK-specific repo

在SDK专属仓库中搜索

gh issue list --repo PostHog/posthog-ios --search "FEATURE_KEYWORD" --state all --limit 20 gh issue list --repo PostHog/posthog-android --search "FEATURE_KEYWORD" --state all --limit 20 gh issue list --repo PostHog/posthog-flutter --search "FEATURE_KEYWORD" --state all --limit 20
gh issue list --repo PostHog/posthog-ios --search "FEATURE_KEYWORD" --state all --limit 20 gh issue list --repo PostHog/posthog-android --search "FEATURE_KEYWORD" --state all --limit 20 gh issue list --repo PostHog/posthog-flutter --search "FEATURE_KEYWORD" --state all --limit 20

Also search with broader terms

也可以用更宽泛的关键词搜索

gh issue list --repo PostHog/posthog-ios --search "survey feature flag" --state all --limit 20

Always search issues in the main repo `PostHog/posthog` AND the SDK-specific repo(s) to ensure an issue does not already exist anywhere.
gh issue list --repo PostHog/posthog-ios --search "survey feature flag" --state all --limit 20

务必在主仓库`PostHog/posthog`和SDK专属仓库中搜索Issue,确保该问题尚未在任何地方存在。

Labels by Repository

各仓库对应的标签

RepositoryLabels for Survey Features
PostHog/posthog-js
feature/surveys
PostHog/posthog-ios
Survey
,
enhancement
PostHog/posthog-android
Survey
,
enhancement
PostHog/posthog-flutter
Survey
,
enhancement
仓库调研功能标签
PostHog/posthog-js
feature/surveys
PostHog/posthog-ios
Survey
,
enhancement
PostHog/posthog-android
Survey
,
enhancement
PostHog/posthog-flutter
Survey
,
enhancement

Issue Creation Command

Issue创建命令

bash
undefined
bash
undefined

posthog-js (covers browser and react-native)

posthog-js(覆盖浏览器和react-native)

gh issue create --repo PostHog/posthog-js --label "feature/surveys" --title "..." --body "..."
gh issue create --repo PostHog/posthog-js --label "feature/surveys" --title "..." --body "..."

posthog-ios

posthog-ios

gh issue create --repo PostHog/posthog-ios --label "Survey" --label "enhancement" --title "..." --body "..."
gh issue create --repo PostHog/posthog-ios --label "Survey" --label "enhancement" --title "..." --body "..."

posthog-android

posthog-android

gh issue create --repo PostHog/posthog-android --label "Survey" --label "enhancement" --title "..." --body "..."
gh issue create --repo PostHog/posthog-android --label "Survey" --label "enhancement" --title "..." --body "..."

posthog-flutter

posthog-flutter

gh issue create --repo PostHog/posthog-flutter --label "Survey" --label "enhancement" --title "..." --body "..."
undefined
gh issue create --repo PostHog/posthog-flutter --label "Survey" --label "enhancement" --title "..." --body "..."
undefined

Issue Template

Issue模板

markdown
undefined
markdown
undefined

🚨 IMPORTANT

🚨 重要提示

This issue is likely user-facing in the main PostHog app, see
surveyVersionRequirements.ts
. If you delete or close this issue, be sure to update the version requirements list here.
此问题可能会影响主PostHog应用的用户体验,详见
surveyVersionRequirements.ts
。如果你删除或关闭此问题,请务必更新此处的版本要求列表。

Summary

摘要

The [SDK] SDK does not support [feature] for surveys.
[SDK] SDK不支持调研的[功能]。

Current State

当前状态

  • [What exists, if anything - types, partial implementation, etc.]
  • [已有的内容(如果有):类型定义、部分实现等]

Expected Behavior

预期行为

[What should happen when this feature is configured]
[配置此功能后应有的表现]

Reference Implementation

参考实现

See posthog-js browser:
packages/browser/src/extensions/surveys.ts
For mobile-specific patterns, see posthog-react-native:
packages/react-native/src/surveys/getActiveMatchingSurveys.ts
详见posthog-js浏览器端:
packages/browser/src/extensions/surveys.ts
对于移动端特定模式,详见posthog-react-native:
packages/react-native/src/surveys/getActiveMatchingSurveys.ts

Tracking

跟踪

This is tracked in the survey SDK feature parity issue: https://github.com/PostHog/posthog/issues/45658
This issue was generated by Claude using the
/survey-sdk-audit
skill.
undefined
此问题在调研SDK功能一致性Issue中跟踪:https://github.com/PostHog/posthog/issues/45658
此Issue由Claude使用
/survey-sdk-audit
Skill生成。
undefined

Completion Checklist

完成检查清单

Before finishing the audit, verify all steps are complete:
  • Understand the feature - Read the check function in
    surveyVersionRequirements.ts
  • Check browser SDK - Find version in changelog (this is the reference implementation)
  • Check react-native SDK - Find version in changelog
  • Check iOS SDK - Verify if feature is actually implemented (not just types)
  • Check Android SDK - Verify if feature is actually implemented (not just types)
  • Check Flutter SDK - Check native dependency versions
  • Search for existing issues - Before creating new ones
  • Create GitHub issues - For any unsupported SDKs (with proper labels)
  • Update surveyVersionRequirements.ts - Fix versions and add issue links to unsupportedSdks
  • Regenerate SDK parity docs - Run
    pnpm --filter=@posthog/frontend build:survey-sdk-docs
    to update
    docs/published/docs/surveys/sdk-feature-support.mdx
  • Update tracking issue - Add new issues to https://github.com/PostHog/posthog/issues/45658
完成审核前,请验证所有步骤均已完成:
  • 理解功能 - 阅读
    surveyVersionRequirements.ts
    中的check函数
  • 检查浏览器SDK - 在更新日志中查找版本(这是参考实现)
  • 检查react-native SDK - 在更新日志中查找版本
  • 检查iOS SDK - 验证功能是否实际实现(不只是类型定义)
  • 检查Android SDK - 验证功能是否实际实现(不只是类型定义)
  • 检查Flutter SDK - 检查原生依赖版本
  • 搜索现有Issue - 创建新Issue前先搜索
  • 创建GitHub Issues - 为所有不支持的SDK创建Issue(使用正确标签)
  • 更新surveyVersionRequirements.ts - 修正版本号,并为unsupportedSdks添加Issue链接
  • 重新生成SDK一致性文档 - 执行
    pnpm --filter=@posthog/frontend build:survey-sdk-docs
    以更新
    docs/published/docs/surveys/sdk-feature-support.mdx
  • 更新跟踪Issue - 将新Issue添加到https://github.com/PostHog/posthog/issues/45658

Common Pitfalls

常见陷阱

  1. Don't guess versions - always verify with changelog or git history
  2. Types ≠ Implementation - having a field in a data class doesn't mean filtering logic exists
  3. Model field ≠ Feature support - the field may be parsed but never used in decision-making (e.g.,
    linkedFlagKey
    exists but
    linkedFlagVariant
    check is missing)
  4. Test code ≠ Production code - functions only in test files aren't shipped
  5. Flutter inherits from native - its "support" depends on iOS/Android SDK versions it requires
  6. Always search for existing issues first - before creating new GitHub issues
  7. Compare utility function implementations - functions like
    canActivateRepeatedly
    may have different logic across SDKs; browser is the source of truth
  8. Built-in UI ≠ delegate - iOS, React Native, and Flutter have built-in survey rendering; Android is delegate-only (no built-in UI). A field on the display model is sufficient for Android (
    issue: false
    ) but for SDKs with built-in rendering, the rendering code must actually use the field
  9. Check rendering code, not just models - e.g., iOS exposes
    shuffleOptions
    on
    PostHogDisplayChoiceQuestion
    but the SwiftUI
    QuestionTypes.swift
    completely ignores it when rendering choices
  1. 不要猜测版本 - 始终通过更新日志或Git历史验证
  2. 类型定义≠实现 - 数据类中存在字段不意味着过滤逻辑已存在
  3. 模型字段≠功能支持 - 字段可能已被解析,但从未在决策逻辑中使用(例如
    linkedFlagKey
    存在,但缺失
    linkedFlagVariant
    检查)
  4. 测试代码≠生产代码 - 仅在测试文件中的函数不会被发布
  5. Flutter继承自原生 - 其“支持情况”取决于它所依赖的iOS/Android SDK版本
  6. 创建新Issue前务必先搜索 - 避免重复创建
  7. 对比工具函数实现 - 像
    canActivateRepeatedly
    这样的函数在不同SDK中可能有不同逻辑;浏览器端是唯一的事实来源
  8. 内置UI≠委托模式 - iOS、React Native和Flutter有内置调研渲染;Android是纯委托模式(无内置UI)。对于Android,显示模型中存在字段即可(
    issue: false
    ),但对于有内置渲染的SDK,渲染代码必须实际使用该字段
  9. 检查渲染代码,而非仅模型 - 例如iOS在
    PostHogDisplayChoiceQuestion
    中暴露了
    shuffleOptions
    ,但SwiftUI的
    QuestionTypes.swift
    在渲染选项时完全忽略了这个字段

Post-Audit: Skill Improvement

审核后:Skill优化

After completing an audit, consider whether any learnings should be added to this skill file:
  1. New pitfalls discovered - Add to Common Pitfalls section
  2. New key files identified - Add to the file paths in Step 5
  3. New utility functions to compare - Add to the "Key utility functions" list
  4. Pattern changes - If SDK implementations have changed structure, update paths
If you find improvements, propose them to the user:
plaintext
I found some learnings during this audit that could improve the skill:
- [describe the improvement]

Would you like me to update the skill file?
完成审核后,考虑是否应将任何经验添加到此Skill文件中:
  1. 发现的新陷阱 - 添加到常见陷阱部分
  2. 识别的新关键文件 - 添加到步骤5的文件路径中
  3. 需对比的新工具函数 - 添加到“关键工具函数”列表
  4. 模式变更 - 如果SDK实现结构发生变化,更新路径
如果你发现了优化点,请向用户提出:
plaintext
我在本次审核中发现了一些可以优化本Skill的经验:
- [描述优化点]

是否需要我更新Skill文件?