feat(surveys): auto-submit rating and single-choice selections - #769
Open
lucasheriques wants to merge 2 commits into
Open
feat(surveys): auto-submit rating and single-choice selections#769lucasheriques wants to merge 2 commits into
lucasheriques wants to merge 2 commits into
Conversation
Decode skipSubmitButton and preserve it in public display questions. Submit eligible Compose selections immediately and hide the submit button. Keep explicit submission for multi-select and questions with an open option. Preserve existing display-question JVM constructors with @jvmoverloads. Validation: parameterized decoding/mapping and eligibility tests passed; make format, make api, and CI=true make compile passed. CodeScene safeguard passed: SurveySheet improved; the existing complex display mapper stayed stable and is intentionally not broadly refactored. Interaction behavior still requires renderer-level coverage.
Contributor
Prompt To Fix All With AI### Issue 1
posthog-android-surveys-compose/src/test/java/com/posthog/android/surveys/compose/internal/ui/SurveyAutoSubmitTest.kt:17-28
**Renderer behavior remains untested**
This parameterized test only checks the `shouldAutoSubmit` eligibility rule. It does not render or interact with `SurveySheet`, so regressions where selecting an eligible rating or choice fails to submit exactly once, advance the survey, or hide the submit button would pass this suite. Adding an interaction test for that new flow would close this non-blocking coverage gap.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(surveys): auto-submit rating and si..." | Re-trigger Greptile |
Contributor
posthog-android Compliance ReportDate: 2026-09-09 14:23:06 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Mount SurveySheet and tap numeric/emoji ratings and choice controls to verify immediate submission, manual fallbacks, branching, payloads, exactly-once callbacks, and clearing selection between questions. Run these debug-host tests explicitly in CI because the normal CI build disables debug variants. Lock the new test-only dependencies. Validation: make testSurveyUI (27 tests), make format, make checkFormat, CI=true make compile, local publishing, and CodeScene pre-commit passed. Disabling auto-submit callbacks temporarily failed exactly the three eligible interaction cases; restoring the implementation passed.
2 tasks
3 tasks
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
Honor
skipSubmitButtonin Android Compose surveys, moving toward survey feature parity across all PostHog SDKs, with posthog-js as the reference. Eligible selections submit through the existing response/navigation callback without an extra tap.skipSubmitButton: trueThe raw flag is exposed to custom renderers and defaults to false. Each selection forwards its answer once; the next question starts without the previous selection. Existing JVM display-question constructor signatures are preserved.
Partial-response collection and persistent resume are covered separately in #768.
Review path
💚 How did you test it?
Passed:
make testSurveyUI(27 Compose tests, including 10 mounted cases),CI=true make compile, formatting checks and CodeScene. Tests cover decoding/mapping, eligible/manual paths, open-choice text, returned branching destinations and exact answer sequences. Disabling auto-submit callbacks made the eligible interaction cases fail.Tests mount the real Compose sheet in Robolectric with a response recorder. Before combining with #768, reconcile Makefile/CI conflicts and test auto-submit through persistent resume and partial-event capture together.
Sample app screenshots
Captured from this PR's SDK (
bd4008e) running in the sample app on Pixel 7 emulator, Android 16 / API 36. A local HTTP fixture supplies the survey; SDK fetching, event targeting and native presentation run through the normal app integration.Tapping 4, then Easy to use, advanced without a submit tap. Entering Better search under Other required Submit; the local receiver recorded one
survey sentevent with all three answers.📝 Checklist
🤖 Agent context
Autonomy: Human-driven (agent-assisted). Codex implemented the changes with independent QA agents; human review is required.