From b77d6696047da1a3ba96cb490361765fc04d04da Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Wed, 27 May 2026 17:32:23 -0400 Subject: [PATCH] remove debug api and route --- app/api/debug/profile-cache/route.ts | 51 ------- app/debug/profile-cache/page.tsx | 199 --------------------------- src/identity/profileCache.ts | 47 ------- 3 files changed, 297 deletions(-) delete mode 100644 app/api/debug/profile-cache/route.ts delete mode 100644 app/debug/profile-cache/page.tsx diff --git a/app/api/debug/profile-cache/route.ts b/app/api/debug/profile-cache/route.ts deleted file mode 100644 index 084d30e6..00000000 --- a/app/api/debug/profile-cache/route.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { NextRequest } from "next/server"; -import { - debugFetchProfiles, - debugReadCache, - type DebugCacheEntry, - type Profile, -} from "src/identity/profileCache"; - -export const runtime = "nodejs"; -export const dynamic = "force-dynamic"; - -// GET /api/debug/profile-cache?dids=did:plc:foo,did:plc:bar -// Reports what's currently in Redis for each DID and what the upstream -// Bluesky getProfiles call returns right now. Does not write to the cache. -export async function GET(req: NextRequest) { - const param = req.nextUrl.searchParams.get("dids"); - if (!param) { - return Response.json( - { error: "`dids` query param required (comma-separated)" }, - { status: 400 }, - ); - } - - const dids = Array.from( - new Set( - param - .split(",") - .map((s) => s.trim()) - .filter(Boolean), - ), - ); - if (dids.length === 0) { - return Response.json({ error: "no DIDs provided" }, { status: 400 }); - } - - const [cacheEntries, fetched] = await Promise.all([ - debugReadCache(dids), - debugFetchProfiles(dids), - ]); - - const result = dids.map((did) => { - const cache: DebugCacheEntry = cacheEntries.get(did) ?? { status: "miss" }; - const live: Profile | null = fetched.get(did) ?? null; - return { did, cache, live }; - }); - - return Response.json( - { dids, result }, - { headers: { "Cache-Control": "no-store" } }, - ); -} diff --git a/app/debug/profile-cache/page.tsx b/app/debug/profile-cache/page.tsx deleted file mode 100644 index c3911837..00000000 --- a/app/debug/profile-cache/page.tsx +++ /dev/null @@ -1,199 +0,0 @@ -import { - debugFetchProfiles, - debugReadCache, - type DebugCacheEntry, - type Profile, -} from "src/identity/profileCache"; - -export const dynamic = "force-dynamic"; -export const runtime = "nodejs"; - -type SearchParams = Promise<{ dids?: string }>; - -export default async function ProfileCacheDebugPage({ - searchParams, -}: { - searchParams: SearchParams; -}) { - const { dids: didsParam } = await searchParams; - const dids = parseDids(didsParam); - - let rows: { - did: string; - cache: DebugCacheEntry; - live: Profile | null; - }[] = []; - - if (dids.length > 0) { - const [cacheEntries, fetched] = await Promise.all([ - debugReadCache(dids), - debugFetchProfiles(dids), - ]); - rows = dids.map((did) => ({ - did, - cache: cacheEntries.get(did) ?? { status: "miss" }, - live: fetched.get(did) ?? null, - })); - } - - return ( -
-

Profile Cache Debug

-

- Shows what's in the Redis cache and what bsky's - getProfiles returns right now. The cache is not updated. -

- -
- -