Files
supabase/apps/studio/components/ui/AIAssistantPanel/SupportRequestMessage.test.tsx
barcofourie 7e56800992 fix(assistant): update support assistant messaging for clarity and consistency (#54112)
## Problem

The AI Assistant follow-up on support requests (behind the
`supportAssistantFollowUp` flag) told users with service restrictions to
ask Support for an exception. In almost every restriction ticket we
reviewed during the production test, the Assistant suggested this, and
Support then declined.

## Solution

Rather than a rule for each ticket type, this adds one general rule to
the server-side support-mode context and removes the "a human will
reply" framing.

`escalate_to_human` is unchanged, so users who ask for a person can
still be escalated.

## Review instructions

Read the diff to `assistant-context.ts` and `SupportAssistant.utils.ts`,
and check that the rule is general and doesn't name a particular ticket
type.


## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-12-03 06:23:54 +02:00

48 lines
1.7 KiB
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
import { parseSupportRequestMessage, SupportRequestMessage } from './SupportRequestMessage'
describe('SupportRequestMessage', () => {
it('parses support-tagged messages', () => {
expect(
parseSupportRequestMessage(`
<support>
<subject>Database unavailable</subject>
<message>Connections are timing out</message>
</support>
`)
).toMatchObject({
subject: 'Database unavailable',
message: 'Connections are timing out',
})
})
it('renders a structured support request summary', () => {
render(
<SupportRequestMessage
request={{
assistant_context: 'A support request has already been submitted.',
subject: 'Database unavailable',
message: 'Connections are timing out',
organization_slug: 'org-1',
project_ref: 'project-1',
category: 'Problem',
severity: 'High',
support_access: 'Granted',
library: 'Not provided',
}}
/>
)
expect(screen.getByText('Support request submitted')).toBeInTheDocument()
expect(screen.getByText('Database unavailable')).toBeInTheDocument()
expect(screen.getByText('Connections are timing out')).toBeInTheDocument()
expect(screen.queryByText('org-1')).not.toBeInTheDocument()
expect(screen.queryByText('project-1')).not.toBeInTheDocument()
expect(screen.queryByText('Granted')).not.toBeInTheDocument()
expect(screen.queryByText('Client library')).not.toBeInTheDocument()
expect(screen.queryByText(/human member of the supabase support team/i)).not.toBeInTheDocument()
})
})