feat: assign daily limit survey users to random experiment buckets (#350)

Instead of a hardcoded experimentId=daily_limit, randomly assign users
to one of four survey direction buckets (competitor, switching, workflow,
activation) matching the round 2 survey pattern.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Felarof
2026-02-22 16:41:54 -08:00
committed by GitHub
parent 38471f6b6a
commit 0b38310ae0

View File

@@ -1,7 +1,19 @@
import { AlertCircle, RefreshCw } from 'lucide-react'
import type { FC } from 'react'
import { useMemo } from 'react'
import { Button } from '@/components/ui/button'
const SURVEY_DIRECTIONS = [
'competitor',
'switching',
'workflow',
'activation',
] as const
function pickRandomDirection(): string {
return SURVEY_DIRECTIONS[Math.floor(Math.random() * SURVEY_DIRECTIONS.length)]
}
interface ChatErrorProps {
error: Error
onRetry?: () => void
@@ -55,6 +67,12 @@ export const ChatError: FC<ChatErrorProps> = ({ error, onRetry }) => {
error.message,
)
const surveyUrl = useMemo(
() =>
`/app.html?page=survey&maxTurns=20&experimentId=daily_limit_${pickRandomDirection()}#/settings/survey`,
[],
)
const getTitle = () => {
if (isRateLimit) return 'Daily limit reached'
if (isConnectionError) return 'Connection failed'
@@ -90,7 +108,7 @@ export const ChatError: FC<ChatErrorProps> = ({ error, onRetry }) => {
</a>
{' or '}
<a
href="/app.html?page=survey&maxTurns=20&experimentId=daily_limit#/settings/survey"
href={surveyUrl}
target="_blank"
rel="noopener noreferrer"
className="underline hover:text-foreground"