feat(web): skip customer-source survey for SSO and invite joins - #4924
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of the new Files Reviewed (4 files)
Verification notes
Previous Review Summary (commit ad3b224)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ad3b224)Status: No Issues Found | Recommendation: Merge Executive SummaryReviewed the new Files Reviewed (4 files)
Verification notes
Reviewed by claude-opus-5 · Input: 46 · Output: 7.7K · Cached: 1.1M Review guidance: REVIEW.md from base branch |
Users who join an organization through SSO or an invitation should not be asked how they heard about Kilo. Mark the customer-source survey as dismissed (customer_source = '') at both join points, only when it is still unset (IS NULL) so an existing answer is never overwritten.
Summary
When a user joins an organization through SSO or an invitation, we should not ask them how they heard about Kilo.
The
CustomerSourceSurveyfloating card renders only whencustomer_source === null(null= never asked,''= dismissed, string = answered). Rather than gating in the frontend — which doesn't know how a user joined — this marks the survey as dismissed at the two server-side join points.Changes
apps/web/src/lib/organizations/organizations.ts: addedskipCustomerSourceSurveyForOrgJoin(userId, txn?), which setscustomer_source = ''onlyWHERE customer_source IS NULL(never overwrites an existing answer; accepts an optional transaction). Called insideacceptOrganizationInvite's transaction right after the new membership is inserted.apps/web/src/lib/user/sso.ts: calls the helper inside theif (added)block, so it fires only when the SSO user actually joins the org (not on every re-login).Tests
sso.test.ts: helper added to the module mock; asserts it's called when the user joins via SSO and not called for an existing member.organizations.test.ts: asserts accepting an invite setscustomer_sourceto'', and that an existing answer ('GitHub') is preserved.Notes / assumptions
nullsource are not retroactively marked.IS NULLguard makes both call sites idempotent and safe against overwriting real answers.Validation
pnpm --filter web run typecheck(exit 0),lint(0 warnings/errors), targetedjestsuites pass.