From e27184245b463307e6629c8b69cfc221e192cdeb Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 14 Aug 2026 17:55:58 +0200 Subject: [PATCH] refactor(agent scan route): remove debug logs and redundant sanity check Remove dev-time console logging and the unnecessary stock_purchases collection probe check to clean up the route handler. --- src/app/api/v1/agent/scan/route.ts | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/app/api/v1/agent/scan/route.ts b/src/app/api/v1/agent/scan/route.ts index 032174e..891b3d7 100644 --- a/src/app/api/v1/agent/scan/route.ts +++ b/src/app/api/v1/agent/scan/route.ts @@ -36,35 +36,8 @@ export async function GET(request: Request): Promise { ? Math.min(500, Math.max(1, Math.floor(maxRowsPerKindParam))) : 100; - // Log a single line at request time so we can confirm the route - // is being hit when debugging the dev-server output. - // eslint-disable-next-line no-console -- dev debug - console.log( - "[agent-scan] GET kind=", - kind, - "status=", - JSON.stringify(status), - "max=", - maxRowsPerKind, - ); - try { const pb = await getAdminPocketBase(); - // Sanity: confirm the PB client can hit the stock_purchases - // collection (the live schema has `additional_attachments`; the - // MCP route has been doing this same call since 2026-08-14). - const probe = await pb - .collection("stock_purchases") - .getFullList({ filter: 'status = "sent"', perPage: 1 }); - if (probe.length === 0) { - return NextResponse.json({ - total_needing_attention: 0, - by_kind: { stock: 0, customer: 0 }, - by_status: {}, - pos: [], - ran_at: new Date().toISOString(), - }); - } const result = await scanPurchaseOrders(pb, { kind, status, maxRowsPerKind }); return NextResponse.json(result); } catch (error) {