Conversation
Route new users through a one-time survey page after account verification and before /get-started. Existing users without a response are intercepted on their next sign-in. Users can submit a free-text answer or skip. - Add nullable `customer_source` column to kilocode_users - Add `submitCustomerSource` tRPC mutation - Create /customer-source-survey page with skip/submit form - Update account-verification to redirect through survey - Intercept existing users in after-sign-in route
- Add Jest tests for submitCustomerSource tRPC mutation (validation, persistence, overwrite, boundary lengths) - Add Playwright e2e tests for survey page (render, submit, skip, callbackPath, already-answered redirect) - Update auth.setup.ts to handle survey page in login flow - Add survey page to visual regression screenshot list - Add customer_source field to test user helper
- H1: reject whitespace-only input via .trim().min(1) on submitCustomerSource - H2: persist skip as empty string sentinel via skipCustomerSource mutation - H3: skip survey redirect when customer_source is already set - Skip button uses mutation instead of direct navigation - Add account-verification redirect unit tests (13 tests) - Expand user-router tests for whitespace and skip semantics - Rewrite E2E tests with fresh user isolation per test
Fixes typecheck errors in route.test.ts and token.test.ts caused by the new required customer_source field on the user type.
… survey Consolidate duplicated survey-intercept logic from account-verification and after-sign-in into a single pure helper function. This collapses 12 lines of branching in account-verification to 2 lines and provides a single point of change if survey conditions evolve.
| linkedin_url: text(), | ||
| github_url: text(), | ||
| openrouter_upstream_safety_identifier: text(), | ||
| customer_source: text(), |
There was a problem hiding this comment.
WARNING: Update the GDPR soft-delete flow for this new field
customer_source stores user-provided survey text on kilocode_users, but softDeleteUser does not clear it today. Merging the schema change without updating src/lib/user.ts and its soft-delete coverage leaves this new account-linked value behind after deletion.
Code Review SummaryStatus: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Fix these issues in Kilo Cloud Files Reviewed (16 files)
Reviewed by gpt-5.4-20260305 · 972,398 tokens |
|
Adding auto-focus and gdpr soft delete. Also evaluating if there's a better way to structure the data so it can be categorized with future surveys in mind also. |
The auth setup skips the survey, so this entry just duplicates the get-started screenshot. The survey UI is covered by its own spec.
880ffb2 to
795324a
Compare
The server's Zod schema trims before enforcing max(1000), but the
Textarea's maxLength={1000} caps raw input. Trimming client-side
ensures the submitted value matches the server's contract.
| @@ -0,0 +1 @@ | |||
| ALTER TABLE "kilocode_users" ADD COLUMN "customer_source" text; No newline at end of file | |||
There was a problem hiding this comment.
WARNING: This migration takes an exclusive lock on kilocode_users
ALTER TABLE ... ADD COLUMN still acquires an ACCESS EXCLUSIVE lock, even without a default. On a populated auth table this can briefly block sign-ins and writes, so this needs a quiet rollout window or a safer expand plan before it lands.
There was a problem hiding this comment.
reviewer — what's the usual process for this?
SurveyType, SurveyStatus, and SurveyPlatform were added but never used — the implementation uses a simple text column instead.
Summary
Adds a one-time "Where did you hear about Kilo Code?" survey to the sign-in flow. Users see it once, right before they land on their destination.
This applies to every user that hasn't skipped or answered the survey before.
How it works
A new
customer_sourcecolumn onkilocode_userstracks whether the user has answered:NULL→ show the surveyThe survey page (
/customer-source-survey) is a simple textarea with Submit and Skip. It slots into the existing sign-in redirect chain.A
maybeInterceptWithSurvey(user, destinationPath)helper centralizes the intercept logic. It's called from two places in the existing auth flow:account-verificationcatches new users after Stytch verificationafter-sign-incatches returning users who haven't answered yetUser flows
Verification
pnpm run formatandpnpm lintcleanVisual Changes
Reviewer Notes
''(empty string) with aWHERE customer_source IS NULLguard to prevent a race where Skip could overwrite a real answer.startsWith('/customer-source-survey')guard to prevent double-wrapping redirects.sourceparam) also see the survey once before/sign-in-to-editor.