survey-sdk-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSurveys SDK Feature Audit Skill
调研SDK功能审核Skill
Use this skill when auditing survey feature support across PostHog SDKs for .
surveyVersionRequirements.tsFeature to audit: $ARGUMENTS
当针对审核各PostHog SDK的调研功能支持情况时,使用本Skill。
surveyVersionRequirements.ts待审核功能: $ARGUMENTS
Setup Check (Run First)
前置检查(首先执行)
Before starting, verify the SDK paths are accessible. Run on each path:
ls$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.jsonjson
{
"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 and permissions grant Claude access to these external SDK repositories without prompting each time.
ReadGrep开始前,请验证SDK路径是否可访问。在每个路径下执行命令:
ls$POSTHOG_JS_PATH$POSTHOG_IOS_PATH$POSTHOG_ANDROID_PATH$POSTHOG_FLUTTER_PATH
如果任何路径为空或不存在,请询问用户:"我需要你机器上[SDK仓库]的路径,它位于哪里?"
获取所有路径后,请询问用户是否希望将其保存到中,以便后续会话使用:
.claude/settings.local.jsonjson
{
"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/**)"
]
}
}注意:和权限允许Claude访问这些外部SDK仓库,无需每次都提示。
ReadGrepUsing SDK Paths in Commands
在命令中使用SDK路径
IMPORTANT: Environment variables like do NOT expand reliably in Bash tool commands.
$POSTHOG_JS_PATHInstead 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_PATHThen use the echoed path directly in subsequent commands.
重要提示:像这样的环境变量在Bash工具命令中无法可靠地展开。
$POSTHOG_JS_PATH请优先使用以下方式替代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:
-
Create the issue in the appropriate SDK repo (see labels below)
-
Add the issue to the tracking issue's "Tracked Issues" section as a task list item:markdown
- [ ] https://github.com/PostHog/repo/issues/123Note: GitHub automatically expands issue links to show titles, so no description is needed. -
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.mdStep 2: Use the Edit tool to modify . This ensures the user can review the diff of your changes before proceeding.
/tmp/tracking_issue_body.mdStep 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时:
-
在对应的SDK仓库中创建Issue(见下方标签说明)
-
将该Issue添加到跟踪Issue的"Tracked Issues"部分,作为任务列表项:markdown
- [ ] https://github.com/PostHog/repo/issues/123注意:GitHub会自动展开Issue链接以显示标题,因此无需添加描述。 -
如有需要,更新跟踪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路径与更新日志
| SDK | Code Path | Changelog |
|---|---|---|
| posthog-js (browser) | | |
| posthog-react-native | | |
| posthog-ios | | |
| posthog-android | | |
| posthog-flutter | | |
| SDK | 代码路径 | 更新日志 |
|---|---|---|
| posthog-js(浏览器) | | |
| posthog-react-native | | |
| posthog-ios | | |
| posthog-android | | |
| posthog-flutter | | |
Flutter Native Dependencies
Flutter原生依赖
Flutter wraps native SDKs. Check dependency versions in:
- iOS: (look for
$POSTHOG_FLUTTER_PATH/ios/posthog_flutter.podspec)s.dependency 'PostHog' - Android: (look for
$POSTHOG_FLUTTER_PATH/android/build.gradledependency)posthog-android
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 function in to understand what field/condition triggers this feature:
checksurveyVersionRequirements.ts- → search for "deviceTypes"
s.conditions?.deviceTypes - → search for "fontFamily"
s.appearance?.fontFamily - → search for "urlMatchType"
s.conditions?.urlMatchType
查看中的函数,了解触发此功能的字段/条件:
surveyVersionRequirements.tscheck- → 搜索"deviceTypes"
s.conditions?.deviceTypes - → 搜索"fontFamily"
s.appearance?.fontFamily - → 搜索"urlMatchType"
s.conditions?.urlMatchType
Step 2: Search Changelogs First
步骤2:先检查更新日志
bash
undefinedbash
undefinedSearch 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
undefinedbash
undefinedFind 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
undefinedgit tag --contains COMMIT_HASH | sort -V | head -3
undefinedStep 4: For Flutter, Find When Native Dependency Was Bumped
步骤4:对于Flutter,查找原生依赖版本升级的时间
bash
undefinedbash
undefinedFind 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
undefinedgit tag --contains COMMIT_HASH | sort -V | head -1
undefinedStep 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, etc.) for developers to render themselves. UsePostHogDisplayChoiceQuestionfor rendering-only features.issue: false - 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 with a comment.
issue: falseKey files to check for survey filtering logic:
- posthog-js (browser): - utility functions like
$POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx,canActivateRepeatedly,getSurveySeenhasEvents - posthog-js (browser): - main survey logic
$POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.tsx - posthog-react-native: - main filtering logic
$POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts - posthog-react-native: - utility functions like
$POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts,canActivateRepeatedlyhasEvents - posthog-ios: →
$POSTHOG_IOS_PATH/PostHog/Surveys/PostHogSurveyIntegration.swiftmethod,getActiveMatchingSurveys()computed propertycanActivateRepeatedly - posthog-android: →
$POSTHOG_ANDROID_PATH/posthog-android/src/main/java/com/posthog/android/surveys/PostHogSurveysIntegration.ktmethod,getActiveMatchingSurveys()functioncanActivateRepeatedly()
Key utility functions to compare across SDKs:
- - determines if a survey can be shown again after being seen
canActivateRepeatedly - - checks if survey has event-based triggers
hasEvents - - checks if user has already seen the survey
getSurveySeen
Example pitfall 1: Both iOS and Android have in their Survey model, but neither implements checking. They only call (boolean) instead of comparing .
linkedFlagKeylinkedFlagVariantisFeatureEnabled(key)flags[key] === variantExample pitfall 2: The browser checks THREE conditions: (1) event repeatedActivation, (2) , (3) survey in progress. Mobile SDKs may only check condition (1), missing the check entirely.
canActivateRepeatedlyschedule === 'always'scheduleKey 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- question ordering$POSTHOG_IOS_PATH/PostHog/Surveys/SurveySheet.swift - posthog-android: No built-in UI — only check display model exposure in and
$POSTHOG_ANDROID_PATH/posthog/src/main/java/com/posthog/surveys/PostHogDisplaySurveyQuestion.ktPostHogDisplaySurveyAppearance.kt - posthog-flutter: - question ordering;
$POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/survey_bottom_sheet.dart- choice rendering$POSTHOG_FLUTTER_PATH/lib/src/surveys/widgets/choice_question.dart
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:内置调研渲染(位于的React Native组件)
packages/react-native/src/surveys/ - posthog-ios:内置调研渲染(位于的SwiftUI视图 —
PostHog/Surveys/、SurveySheet.swift、QuestionTypes.swift)MultipleChoiceOptions.swift - posthog-android:无内置UI — 纯委托模式。暴露显示模型(、
PostHogDisplaySurvey等)供开发者自行渲染。对于仅涉及渲染的功能,标记为PostHogDisplayChoiceQuestion。issue: false - posthog-flutter:内置调研渲染(位于Flutter组件 —
lib/src/surveys/widgets/、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、getSurveySeenhasEvents - 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、canActivateRepeatedlyhasEvents - 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模型中都有,但两者都未实现检查。它们仅调用(布尔值),而非比较。
linkedFlagKeylinkedFlagVariantisFeatureEnabled(key)flags[key] === variant示例陷阱2:浏览器端的检查三个条件:(1) 事件重复激活设置,(2) ,(3) 调研是否在进行中。移动端SDK可能仅检查条件(1),完全遗漏了检查。
canActivateRepeatedlyschedule === 'always'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:
- First check to understand the complete, correct behavior
$POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.ts - Then compare mobile SDKs against posthog-react-native () which is the reference for mobile-specific implementations
$POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts
posthog-js浏览器端是标准实现 - 它包含所有功能,是功能预期工作方式的唯一来源。
审核功能时:
- 首先查看,了解完整、正确的行为
$POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.ts - 然后将移动端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 → for all mobile
issue: false - CSS selector targeting: No DOM in native apps → for all mobile
issue: false - 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
undefinedSearch 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
各仓库对应的标签
| Repository | Labels for Survey Features |
|---|---|
| PostHog/posthog-js | |
| PostHog/posthog-ios | |
| PostHog/posthog-android | |
| PostHog/posthog-flutter | |
| 仓库 | 调研功能标签 |
|---|---|
| PostHog/posthog-js | |
| PostHog/posthog-ios | |
| PostHog/posthog-android | |
| PostHog/posthog-flutter | |
Issue Creation Command
Issue创建命令
bash
undefinedbash
undefinedposthog-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 "..."
undefinedgh issue create --repo PostHog/posthog-flutter --label "Survey" --label "enhancement" --title "..." --body "..."
undefinedIssue Template
Issue模板
markdown
undefinedmarkdown
undefined🚨 IMPORTANT
🚨 重要提示
This issue is likely user-facing in the main PostHog app, see . If you delete or close this issue, be sure to update the version requirements list here.
surveyVersionRequirements.ts此问题可能会影响主PostHog应用的用户体验,详见。如果你删除或关闭此问题,请务必更新此处的版本要求列表。
surveyVersionRequirements.tsSummary
摘要
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:
For mobile-specific patterns, see posthog-react-native:
packages/browser/src/extensions/surveys.tspackages/react-native/src/surveys/getActiveMatchingSurveys.ts详见posthog-js浏览器端:
对于移动端特定模式,详见posthog-react-native:
packages/browser/src/extensions/surveys.tspackages/react-native/src/surveys/getActiveMatchingSurveys.tsTracking
跟踪
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 skill.
/survey-sdk-auditundefined此问题在调研SDK功能一致性Issue中跟踪:https://github.com/PostHog/posthog/issues/45658
此Issue由Claude使用 Skill生成。
/survey-sdk-auditundefinedCompletion 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 to update
pnpm --filter=@posthog/frontend build:survey-sdk-docsdocs/published/docs/surveys/sdk-feature-support.mdx - Update tracking issue - Add new issues to https://github.com/PostHog/posthog/issues/45658
完成审核前,请验证所有步骤均已完成:
- 理解功能 - 阅读中的check函数
surveyVersionRequirements.ts - 检查浏览器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-docsdocs/published/docs/surveys/sdk-feature-support.mdx - 更新跟踪Issue - 将新Issue添加到https://github.com/PostHog/posthog/issues/45658
Common Pitfalls
常见陷阱
- Don't guess versions - always verify with changelog or git history
- Types ≠ Implementation - having a field in a data class doesn't mean filtering logic exists
- Model field ≠ Feature support - the field may be parsed but never used in decision-making (e.g., exists but
linkedFlagKeycheck is missing)linkedFlagVariant - Test code ≠ Production code - functions only in test files aren't shipped
- Flutter inherits from native - its "support" depends on iOS/Android SDK versions it requires
- Always search for existing issues first - before creating new GitHub issues
- Compare utility function implementations - functions like may have different logic across SDKs; browser is the source of truth
canActivateRepeatedly - 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 () but for SDKs with built-in rendering, the rendering code must actually use the field
issue: false - Check rendering code, not just models - e.g., iOS exposes on
shuffleOptionsbut the SwiftUIPostHogDisplayChoiceQuestioncompletely ignores it when rendering choicesQuestionTypes.swift
- 不要猜测版本 - 始终通过更新日志或Git历史验证
- 类型定义≠实现 - 数据类中存在字段不意味着过滤逻辑已存在
- 模型字段≠功能支持 - 字段可能已被解析,但从未在决策逻辑中使用(例如存在,但缺失
linkedFlagKey检查)linkedFlagVariant - 测试代码≠生产代码 - 仅在测试文件中的函数不会被发布
- Flutter继承自原生 - 其“支持情况”取决于它所依赖的iOS/Android SDK版本
- 创建新Issue前务必先搜索 - 避免重复创建
- 对比工具函数实现 - 像这样的函数在不同SDK中可能有不同逻辑;浏览器端是唯一的事实来源
canActivateRepeatedly - 内置UI≠委托模式 - iOS、React Native和Flutter有内置调研渲染;Android是纯委托模式(无内置UI)。对于Android,显示模型中存在字段即可(),但对于有内置渲染的SDK,渲染代码必须实际使用该字段
issue: false - 检查渲染代码,而非仅模型 - 例如iOS在中暴露了
PostHogDisplayChoiceQuestion,但SwiftUI的shuffleOptions在渲染选项时完全忽略了这个字段QuestionTypes.swift
Post-Audit: Skill Improvement
审核后:Skill优化
After completing an audit, consider whether any learnings should be added to this skill file:
- New pitfalls discovered - Add to Common Pitfalls section
- New key files identified - Add to the file paths in Step 5
- New utility functions to compare - Add to the "Key utility functions" list
- 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文件中:
- 发现的新陷阱 - 添加到常见陷阱部分
- 识别的新关键文件 - 添加到步骤5的文件路径中
- 需对比的新工具函数 - 添加到“关键工具函数”列表
- 模式变更 - 如果SDK实现结构发生变化,更新路径
如果你发现了优化点,请向用户提出:
plaintext
我在本次审核中发现了一些可以优化本Skill的经验:
- [描述优化点]
是否需要我更新Skill文件?