From 226d05fb83415be92021008b4ecc81f212be9288 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:06:47 +0800 Subject: [PATCH] fix: warning message on upgrade guards (#36646) * fix: warning message on upgrade guards When users are blocked from an upgrade because they have objects that need to be dropped, the message in the warning is incorrect. It asks users to "drop these extensions". But they're not extensions, they're user-defined tables, foreign keys, etc. This will cause confusion. Here we use a different messaging when users need to drop their objects. * chore: prettier --- .../Infrastructure/InfrastructureInfo.tsx | 89 ++++++++++++++++++- packages/ai-commands/src/docs.ts | 8 +- .../src/CommandMenu/prepackaged/ai/utils.ts | 7 +- 3 files changed, 98 insertions(+), 6 deletions(-) diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx index 8f76722423573..6cb810871b55e 100644 --- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx +++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureInfo.tsx @@ -193,6 +193,7 @@ const InfrastructureInfo = () => { )} + {/* TODO(bobbie): once extension_dependent_objects is removed on the backend, remove this block and the ts-ignores below */} {!data?.eligible && (data?.extension_dependent_objects || []).length > 0 && ( { ? 'These extensions are not supported in newer versions of Supabase Postgres. If you are not using them, it is safe to remove them.' : 'Check the docs for which ones might need to be removed.'}

-
+
+ +
+ )} + {!data?.eligible && + // @ts-ignore + (data?.unsupported_extensions || []).length > 0 && ( + + + A new version of Postgres is available + + +
+

+ You'll need to remove the following extensions before upgrading: +

+ +
    + { + // @ts-ignore + (data?.unsupported_extensions || []).map((obj: string) => ( +
  • + {obj} +
  • + )) + } +
+
+

+ These extensions are not supported in newer versions of Supabase + Postgres. If you are not using them, it is safe to remove them. +

+
+ +
+
+
+ )} )} diff --git a/packages/ai-commands/src/docs.ts b/packages/ai-commands/src/docs.ts index 5152655e018d3..07111da4cb0f5 100644 --- a/packages/ai-commands/src/docs.ts +++ b/packages/ai-commands/src/docs.ts @@ -63,7 +63,7 @@ export async function clippy( const [{ embedding }] = embeddingResponse.data - const { error: matchError, data: pageSections } = await supabaseClient + const { error: matchError, data: pageSections } = (await supabaseClient .rpc('match_page_sections_v2', { embedding, match_threshold: 0.78, @@ -71,7 +71,7 @@ export async function clippy( }) .neq('rag_ignore', true) .select('content,page!inner(path),rag_ignore') - .limit(10) as { error: any; data: PageSection[] | null } + .limit(10)) as { error: any; data: PageSection[] | null } if (matchError || !pageSections) { throw new ApplicationError('Failed to match page sections', matchError) @@ -93,10 +93,10 @@ export async function clippy( } const pagePath = pageSection.page.path - + // Include source reference with each section contextText += `[Source ${sourceIndex}: ${pagePath}]\n${content.trim()}\n---\n` - + // Track sources for later reference if (!sourcesMap.has(pagePath)) { sourcesMap.set(pagePath, content) diff --git a/packages/ui-patterns/src/CommandMenu/prepackaged/ai/utils.ts b/packages/ui-patterns/src/CommandMenu/prepackaged/ai/utils.ts index dc88db896bea6..96f64044e599f 100644 --- a/packages/ui-patterns/src/CommandMenu/prepackaged/ai/utils.ts +++ b/packages/ui-patterns/src/CommandMenu/prepackaged/ai/utils.ts @@ -49,7 +49,12 @@ interface FinalizeWithSourcesAction { index: number } -type MessageAction = NewMessageAction | UpdateMessageAction | AppendContentAction | ResetAction | FinalizeWithSourcesAction +type MessageAction = + | NewMessageAction + | UpdateMessageAction + | AppendContentAction + | ResetAction + | FinalizeWithSourcesAction export { MessageRole, MessageStatus } export type { Message, MessageAction, SourceLink }