mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
Part 5 of 6: #52989 → #52990 → #52991 → #52992 → #52993 → #53138 Switches Studio navigation between Advisors and Issues with `issuesInbox`. With the flag off, the existing Advisors sidebar, pages, command menu entries, shortcuts, header panel, and contextual finding links remain available. With it on, these entry points show Issues and legacy Advisor URLs forward to the matching Issues category while preserving finding context. Direct Issues routes remain accessible in either state. The homepage section remains hidden when the flag is off. Telemetry event names are unchanged. ## How to test 1. Turn `issuesInbox` off: desktop and mobile navigation show Advisors, the header opens Advisor Center, and Security, Performance, and enabled Health Advisor pages remain usable. 2. Turn it on: navigation and the header show Issues. Legacy Advisor category URLs forward to matching Issues lists. 3. `G` then `V` opens the active variant. `V` then `S`, `P`, or `H` follows the active category links; shortcut reference labels match. 4. Table Editor finding links open the legacy finding when off and its issue when on. 5. Direct Issues routes remain usable with the flag off; the homepage section stays hidden. ## Validation - Broad navigation/layout/redirect/shortcut regression suite: 456 tests passed, retries disabled. - Focused suite: 181 tests passed with shuffle seed 52993, retries disabled. - Full Studio TypeScript, scoped ESLint, and changed-file Prettier pass. - Behavioral mutation probes detect broken flag guards, finding links, and redirect destinations; source restored afterward. [DEBUG-255](https://linear.app/supabase/issue/DEBUG-255/replace-advisor-terminology-with-issues-throughout-studio) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Jordi Enric <jordi.err@gmail.com>
71 lines
2.2 KiB
TypeScript
71 lines
2.2 KiB
TypeScript
import { screen } from '@testing-library/react'
|
|
import { AuthProvider, FeatureFlagContext } from 'common'
|
|
import { useCommands } from 'ui-patterns/CommandMenu'
|
|
import { beforeEach, describe, expect, it } from 'vitest'
|
|
|
|
import { useLayoutNavCommands } from './useLayoutNavCommands'
|
|
import { customRender } from '@/tests/lib/custom-render'
|
|
import { mockProjectGrantContext } from '@/tests/lib/project-grant-mocks'
|
|
|
|
const NavigationCommands = () => {
|
|
useLayoutNavCommands()
|
|
const sections = useCommands()
|
|
return (
|
|
<ul>
|
|
{sections.flatMap((section) =>
|
|
section.commands.map((command) => (
|
|
<li key={command.id}>
|
|
{'route' in command ? <a href={command.route}>{command.name}</a> : command.name}
|
|
</li>
|
|
))
|
|
)}
|
|
</ul>
|
|
)
|
|
}
|
|
|
|
describe('Issues command discovery', () => {
|
|
beforeEach(() => {
|
|
mockProjectGrantContext({ ref: 'default' })
|
|
})
|
|
it.each([false, undefined, true])(
|
|
'registers Issues commands only when enabled: %s',
|
|
async (issuesInbox) => {
|
|
customRender(
|
|
<AuthProvider alwaysLoggedIn>
|
|
<FeatureFlagContext.Provider
|
|
value={{
|
|
configcat: {
|
|
...(issuesInbox === undefined ? {} : { issuesInbox }),
|
|
compute: false,
|
|
healthAdvisor: true,
|
|
platformWebhooks: false,
|
|
ConfigDrift: false,
|
|
},
|
|
posthog: {},
|
|
}}
|
|
>
|
|
<NavigationCommands />
|
|
</FeatureFlagContext.Provider>
|
|
</AuthProvider>
|
|
)
|
|
|
|
expect(await screen.findByText('Table Editor')).toBeInTheDocument()
|
|
for (const name of ['Issues', 'Security issues', 'Performance issues', 'Health issues']) {
|
|
expect(screen.queryByText(name) !== null).toBe(!!issuesInbox)
|
|
}
|
|
for (const [name, category] of [
|
|
['Security Advisor', 'security'],
|
|
['Performance Advisor', 'performance'],
|
|
['Health Advisor', 'health'],
|
|
]) {
|
|
if (issuesInbox) expect(screen.queryByRole('link', { name })).not.toBeInTheDocument()
|
|
else
|
|
expect(screen.getByRole('link', { name })).toHaveAttribute(
|
|
'href',
|
|
`/project/default/advisors/${category}`
|
|
)
|
|
}
|
|
}
|
|
)
|
|
})
|