feat(surveys): collect partial responses and resume unfinished surveys - #807
Open
lucasheriques wants to merge 3 commits into
Open
feat(surveys): collect partial responses and resume unfinished surveys#807lucasheriques wants to merge 3 commits into
lucasheriques wants to merge 3 commits into
Conversation
Honor enable_partial_responses and emit cumulative survey sent events after each submitted question. Reuse a submission UUID through completion or dismissal, and report $survey_completed using the existing branching result. Retain legacy response properties and completion-only behavior by default. Verified red/green survey tests; make test (169 XCTest + 781 Swift Testing tests); make lint; make apiCheck; iOS, macOS and Mac Catalyst builds. Other platform builds require SDKs absent from this machine. CodeScene passed.
Contributor
|
Reviews (1): Last reviewed commit: "feat(surveys): collect partial responses..." | Re-trigger Greptile |
CI exposed a race between forced survey loading and the remote-config listener's flag refresh. Seed survey data separately and await flag loading, matching the neighboring feature-flag eligibility test. The matching suite passes (10 tests), and the previously failing test passes 10 consecutive runs. CodeScene gate passed with stable test-file health.
Contributor
posthog-ios Compliance ReportDate: 2026-09-08 22:06:50 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
Save progress after nonterminal answers and restore the submission ID, answers, answer-time text/language and next branching destination. Clear state on completion, dismissal, reset or incompatible survey updates. Keep resumable surveys eligible and start built-in UI at the restored index; document the additive initialQuestionIndex contract for custom delegates. Verified: make test (169 XCTest + 789 Swift Testing), make testOniOSSimulator (190 XCTest + 911 Swift Testing), make format, make lint, make apiCheck. CodeScene safeguard passed. make build passed iOS/macOS/Catalyst SDKs but stopped at missing tvOS SDK; watchOS/visionOS and full example builds remain unverified locally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
A user can answer the first question, leave the app, and continue the unfinished survey after restarting with the same submission ID and previous answers. With
enable_partial_responses, each submitted question also emits a cumulativesurvey sentevent immediately. When the setting is false or absent, events remain completion-only; persistent resume still works.Progress is saved after each nonterminal answer using the SDK's persistent storage, keyed by survey ID and iteration. Restore the next branching destination, answers, answer-time question text and language. Completion, explicit dismissal and SDK reset clear progress; removed, ended, new-iteration or incompatible question definitions cannot reuse it. Merely showing a survey does not create progress.
Resumable surveys take priority and bypass seen/internal targeting checks, while other targeting conditions still apply. The built-in renderer starts at
initialQuestionIndex; custom survey delegates must honor this additive display-model property. Preserve legacy response properties and reuse$survey_submission_idthrough partial events, completion and dismissal.Closes #447. Includes a minor release changeset and updated public API snapshot. This does not add survey back navigation or abandonment events.
Testing
make test: 169 XCTest and 789 Swift Testing tests passed.make testOniOSSimulator: 190 XCTest and 911 Swift Testing tests passed, including restored-question and invalidated-attempt controller tests.make format,make lint(no serious violations), andmake apiCheckpassed.make build: iOS, macOS and Mac Catalyst SDK builds passed. The target stopped at tvOS because its SDK is unavailable; watchOS and visionOS SDKs are also unavailable locally. The full multi-platform/example build therefore remains unverified locally.