mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +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>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { fireEvent, screen } from '@testing-library/react'
|
|
import { FeatureFlagContext } from 'common'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
import { SecurityDefinerViewPopover } from './SecurityDefinerViewPopover'
|
|
import type { Lint } from '@/data/lint/lint-query'
|
|
import { customRender } from '@/tests/lib/custom-render'
|
|
|
|
const lint: Lint = {
|
|
name: 'security_definer_view',
|
|
title: 'Security Definer View',
|
|
level: 'ERROR',
|
|
facing: 'EXTERNAL',
|
|
categories: ['SECURITY'],
|
|
description: 'View uses its creator permissions',
|
|
detail: 'View public.accounts uses SECURITY DEFINER',
|
|
remediation:
|
|
'https://supabase.com/docs/guides/database/database-linter?lint=0010_security_definer_view',
|
|
metadata: { type: 'view', schema: 'public', name: 'accounts' },
|
|
cache_key: 'security_definer_view_public_accounts',
|
|
}
|
|
|
|
describe('Security Definer view guidance', () => {
|
|
it.each([false, true])(
|
|
'links to the selected finding in the active variant: %s',
|
|
(issuesInbox) => {
|
|
const onAutofix = vi.fn()
|
|
customRender(
|
|
<FeatureFlagContext.Provider value={{ configcat: { issuesInbox }, posthog: {} }}>
|
|
<SecurityDefinerViewPopover lint={lint} onAutofix={onAutofix} />
|
|
</FeatureFlagContext.Provider>
|
|
)
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: 'Security Definer view' }))
|
|
|
|
expect(screen.getByText('Secure your view')).toBeInTheDocument()
|
|
if (issuesInbox) {
|
|
expect(screen.getByRole('link', { name: 'Learn more' })).toHaveAttribute(
|
|
'href',
|
|
'/project/default/issues/security_definer_view'
|
|
)
|
|
} else {
|
|
expect(screen.getByRole('link', { name: 'Learn more' })).toHaveAttribute(
|
|
'href',
|
|
'/project/default/advisors/security?preset=ERROR&id=security_definer_view_public_accounts'
|
|
)
|
|
}
|
|
fireEvent.click(screen.getByRole('button', { name: 'Autofix' }))
|
|
expect(onAutofix).toHaveBeenCalledOnce()
|
|
}
|
|
)
|
|
})
|