-
Notifications
You must be signed in to change notification settings - Fork 0
fix: gate demo-mode forms UI for ui test fixture compatibility #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
477e010
f99d4cf
6f20b80
e4d283a
2868f90
1eb6153
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,13 @@ import type { DocumentIndexUnitMatch, DocumentMemoryCard, SearchResult } from "@ | |
| // the floor, which is how the live schema drift (42702) went unnoticed. Log it structurally and, | ||
| // where telemetry is in scope, record the failing RPC + code so it shows up in rag_retrieval_logs. | ||
| export type SupabaseRpcError = { message?: string; code?: string; details?: string; hint?: string } | null; | ||
| type RpcResult<T> = Promise<{ data: T | null; error: SupabaseRpcError }>; | ||
| type AbortableRpc<T> = RpcResult<T> & { | ||
| abortSignal?: (signal: AbortSignal) => RpcResult<T>; | ||
| }; | ||
| type SupabaseRpcClient = { | ||
| rpc: (name: string, rpcArgs: Record<string, unknown>) => AbortableRpc<unknown[]> | PromiseLike<unknown>; | ||
| }; | ||
|
|
||
| function legacyRankFields(versionedName: string) { | ||
| if (versionedName === "match_document_chunks_v2") return ["similarity"]; | ||
|
|
@@ -81,15 +88,21 @@ export async function callVersionedRetrievalRpc<T extends unknown[] = unknown[]> | |
| versionedName: string, | ||
| legacyName: string, | ||
| args: Record<string, unknown>, | ||
| signal?: AbortSignal, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This new Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @codex fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Summary
Testing
|
||
| ): Promise<{ data: T | null; error: SupabaseRpcError }> { | ||
| const client = supabase as unknown as { | ||
| rpc: (name: string, rpcArgs: Record<string, unknown>) => Promise<{ data: T | null; error: SupabaseRpcError }>; | ||
| const client = supabase as unknown as SupabaseRpcClient; | ||
| const executeRpc = async (name: string, rpcArgs: Record<string, unknown>) => { | ||
| const pending = client.rpc(name, rpcArgs) as AbortableRpc<T>; | ||
| const pendingWithAbort = | ||
| signal && typeof pending.abortSignal === "function" ? pending.abortSignal(signal) : pending; | ||
| return await pendingWithAbort; | ||
| }; | ||
|
BigSimmo marked this conversation as resolved.
|
||
| const versioned = await client.rpc(versionedName, args); | ||
| const versioned = await executeRpc(versionedName, args); | ||
| if (versioned && !isMissingRetrievalRpcError(versioned.error)) return versioned; | ||
| if (signal?.aborted) return versioned; | ||
| const legacyArgs = { ...args }; | ||
| delete legacyArgs.include_public; | ||
| const ownerResult = await client.rpc(legacyName, legacyArgs); | ||
| const ownerResult = await executeRpc(legacyName, legacyArgs); | ||
| const ownerFilter = String(args.owner_filter ?? ""); | ||
| if ( | ||
| ownerResult.error || | ||
|
|
@@ -99,7 +112,8 @@ export async function callVersionedRetrievalRpc<T extends unknown[] = unknown[]> | |
| ) { | ||
| return ownerResult; | ||
| } | ||
| const publicResult = await client.rpc(legacyName, { | ||
| if (signal?.aborted) return ownerResult; | ||
| const publicResult = await executeRpc(legacyName, { | ||
| ...legacyArgs, | ||
| owner_filter: PUBLIC_OWNER_FILTER_SENTINEL, | ||
| }); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.