From fc51f84abba47e13d003788af81eced048143f65 Mon Sep 17 00:00:00 2001 From: Will Gordon Date: Sat, 1 Aug 2026 22:12:41 -0400 Subject: [PATCH] fix(cursor): imports from db/ modules, not the localDb barrel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both files violated Hard Rule #2 (never barrel-import from localDb.ts) — a genuine lint error that had gone uncaught locally. refresh-cursor/route.ts imported getCachedProviderConnectionById from @/lib/localDb instead of its owning module, @/lib/db/readCache. tokenHealthCheckCursor.ts copied the same pattern from its sibling tokenHealthCheckCopilot.ts (an existing, already-suppressed violation) for updateProviderConnection; imports it from @/lib/db/providers instead, with no circular-import fallout (verified via the existing token-health-check-cursor and refresh-cursor-route test suites). --- src/app/api/providers/[id]/refresh-cursor/route.ts | 2 +- src/lib/tokenHealthCheckCursor.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/api/providers/[id]/refresh-cursor/route.ts b/src/app/api/providers/[id]/refresh-cursor/route.ts index a1c0b098d9..4859d3e9a8 100644 --- a/src/app/api/providers/[id]/refresh-cursor/route.ts +++ b/src/app/api/providers/[id]/refresh-cursor/route.ts @@ -1,5 +1,5 @@ import { NextResponse } from "next/server"; -import { getCachedProviderConnectionById } from "@/lib/localDb"; +import { getCachedProviderConnectionById } from "@/lib/db/readCache"; import { updateProviderConnection } from "@/lib/db/providers"; import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error"; import { tryIdeAuth } from "@/lib/cursor/tokenExtractor"; diff --git a/src/lib/tokenHealthCheckCursor.ts b/src/lib/tokenHealthCheckCursor.ts index ba9d799f72..beee152554 100644 --- a/src/lib/tokenHealthCheckCursor.ts +++ b/src/lib/tokenHealthCheckCursor.ts @@ -6,11 +6,12 @@ * * Sibling to tokenHealthCheckCopilot.ts (same injection-to-avoid-circular- * import technique — tokenHealthCheck.ts-private helpers passed as params - * rather than imported, and updateProviderConnection imported directly from - * @/lib/localDb) but greenfield: type-checked normally, no @ts-nocheck. + * rather than imported) but greenfield: type-checked normally, no + * @ts-nocheck, and imports updateProviderConnection directly from its + * owning module rather than the localDb barrel (Hard Rule #2). */ -import { updateProviderConnection } from "@/lib/localDb"; +import { updateProviderConnection } from "@/lib/db/providers"; import { renewCursorConnection, buildCursorRenewedUpdate,