Skip to content

chore: fallback funnel analytics - #2031

Draft
shazarre wants to merge 4 commits into
shazarre/canonical_onboarding_funnel_followupfrom
shazarre/chore/fallback_funnel_analytics
Draft

chore: fallback funnel analytics#2031
shazarre wants to merge 4 commits into
shazarre/canonical_onboarding_funnel_followupfrom
shazarre/chore/fallback_funnel_analytics

Conversation

@shazarre

@shazarre shazarre commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Linear: SELF-2747

Summary

Introduces fallback mini-funnel analytics as per https://github.com/selfxyz/self/blob/main/specs/projects/sdk/workstreams/analytics/SPEC.md

Test plan

TBD

Summary by CodeRabbit

  • Chores

    • Enhanced analytics collection across verification fallback flows to capture when alternatives are offered, accepted, or declined.
    • Standardized telemetry constants for tracking verification decision points.
  • Tests

    • Added comprehensive test coverage for fallback decision analytics, including payload validation, deduplication behavior, and property merging.

@shazarre shazarre self-assigned this Apr 29, 2026
@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
self-webview-app Ready Ready Preview, Comment May 6, 2026 2:04pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2bfd13e5-2350-405a-bed1-d493929de001

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add comprehensive fallback decision analytics throughout the KYC flow. New FallbackStage and FallbackReason enums standardize categorical values, a trackFallbackDecision function records fallback offer/accept/decline events with contextual metadata, and multiple screens integrate this tracking to instrument user decision points during alternative verification paths.

Changes

Cohort / File(s) Summary
Analytics Constants & SDK Exports
packages/mobile-sdk-alpha/src/constants/analytics.ts, packages/mobile-sdk-alpha/src/index.ts
Added FallbackReason and FallbackStage enums, extended OnboardingEvents with FALLBACK_OFFERED, FALLBACK_ACCEPTED, FALLBACK_DECLINED, and re-exported new types and tracking function from SDK entrypoint.
Fallback Decision Tracking
packages/mobile-sdk-alpha/src/analytics/onboardingFunnel.ts
Introduced trackFallbackDecision function that ensures an onboarding attempt exists, records fallback events with from_stage and reason metadata, and merges caller-supplied properties without deduplication.
KYC Launcher Hook
app/src/hooks/useKycLauncher.ts
Updated showKycFallbackModal signature to accept fromStage and reason parameters; added fallback analytics instrumentation for modal display, user acceptance, and dismissal.
Document Scanning Screens
app/src/screens/documents/scanning/DocumentCameraScreen.tsx, app/src/screens/documents/scanning/DocumentNFCScanScreen.tsx, app/src/screens/documents/scanning/RegistrationFallbackMRZScreen.tsx, app/src/screens/documents/scanning/RegistrationFallbackNFCScreen.tsx
Updated cancellation and fallback flows to pass FallbackStage and FallbackReason context to modal invocations; added trackFallbackDecision calls for offered/accepted/declined events tied to scan stage failures.
Document Selection Screens
app/src/screens/documents/selection/DocumentOnboardingScreen.tsx, app/src/screens/documents/selection/LogoConfirmationScreen.tsx
Updated cancel actions to pass fallback stage and reason; added fallback offer/accept tracking for unsupported document and biometric chip scenarios.
Test Suite
packages/mobile-sdk-alpha/tests/analytics/canonicalEvents.test.ts, packages/mobile-sdk-alpha/tests/analytics/trackFallbackDecision.test.ts
Expanded canonical events test to include new fallback event keys; introduced comprehensive test suite for trackFallbackDecision covering bootstrap behavior, payload structure, non-deduplication, property merging, and attempt ID alignment.
Specifications
specs/projects/sdk/workstreams/analytics/SPEC.md, specs/projects/sdk/workstreams/analytics/plans/ANA-05-fallback-decision-events.md
Marked ANA-05 workstream as completed; documented fallback decision events specification with enum definitions, event firing points, payload structure, and test coverage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: fallback funnel analytics' accurately describes the main change—adding analytics instrumentation for fallback decision flows across the KYC funnel.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shazarre/chore/fallback_funnel_analytics

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@shazarre
shazarre marked this pull request as draft April 29, 2026 11:39
@shazarre

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@transphorm

Copy link
Copy Markdown
Member

Targeting this for the next build: 2.9.23. Tracked in the Mobile App release: 2.9.23 project.

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.

2 participants