🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
refactor(web): Remove undesired in-source vitest test (#14588)
Ben Bachema97e28032997
diff --git a/.agents/AGENTS.md b/.agents/AGENTS.mdindex 8dc911dc0e..1a10b1f94a 100644--- a/.agents/AGENTS.md+++ b/.agents/AGENTS.md@@ -26,6 +26,8 @@ evaluating, and debugging AI applications.cross-view extension playbook — the bar is intended to become the primaryfilter interface for every filterable view, so new filtering work extends itthrough that contract rather than forking it.+- Do not add or widen ESLint disable comments or config overrides+ without explicit user approval for the exact rule and scope.- Never commit secrets or credentials. Keep `.env*.example` files insync with required env vars.diff --git a/web/src/utils/api.clienttest.ts b/web/src/utils/api.clienttest.tsnew file mode 100644index 0000000000..141001a503--- /dev/null+++ b/web/src/utils/api.clienttest.ts@@ -0,0 +1,56 @@+import { TRPCClientError } from "@trpc/client";+import { isNetworkConnectivityError } from "@/src/utils/api";++describe("isNetworkConnectivityError", () => {+ it("detects the reported failed fetch error without a response", () => {+ const error = TRPCClientError.from(new TypeError("Failed to fetch"));++ expect(isNetworkConnectivityError(error)).toBe(true);+ });++ it("detects the reported failed fetch error with a hostname suffix", () => {+ const error = TRPCClientError.from(+ new TypeError("Failed to fetch (cloud.langfuse.com)"),+ );++ expect(isNetworkConnectivityError(error)).toBe(true);+ });++ it("does not treat other network failures as connectivity errors", () => {+ const error = TRPCClientError.from(new TypeError("Load failed"));++ expect(isNetworkConnectivityError(error)).toBe(false);+ });++ it("does not treat tRPC server errors as connectivity errors", () => {+ const error = TRPCClientError.from({+ error: {+ code: -32603,+ message: "Internal server error",+ data: {+ code: "INTERNAL_SERVER_ERROR",+ httpStatus: 500,+ path: "events.all",+ },+ },+ });++ expect(isNetworkConnectivityError(error)).toBe(false);+ });++ it("does not treat response parsing errors as connectivity errors", () => {+ const error = TRPCClientError.from(new SyntaxError("Unexpected token <"), {+ meta: {+ response: new Response("<html></html>", { status: 502 }),+ },+ });++ expect(isNetworkConnectivityError(error)).toBe(false);+ });++ it("does not treat non-tRPC errors as connectivity errors", () => {+ expect(isNetworkConnectivityError(new TypeError("Failed to fetch"))).toBe(+ false,+ );+ });+});diff --git a/web/src/utils/api.ts b/web/src/utils/api.tsindex cdb26edbcc..ead64f16af 100644--- a/web/src/utils/api.ts+++ b/web/src/utils/api.ts@@ -75,7 +75,7 @@ const hasReportedFailedFetchMessage = (error: unknown): boolean => {return REPORTED_FAILED_FETCH_MESSAGE.test(error.message);};-const isNetworkConnectivityError = (error: unknown): boolean => {+export const isNetworkConnectivityError = (error: unknown): boolean => {if (!(error instanceof TRPCClientError)) return false;// tRPC server errors and infrastructure responses have response metadata.@@ -89,71 +89,6 @@ const isNetworkConnectivityError = (error: unknown): boolean => {);};-/* eslint-disable @repo/no-in-source-vitest */-const vitest = import.meta.vitest;--if (vitest && typeof vitest === "object") {- const { describe, expect, it } = vitest;-- describe("isNetworkConnectivityError", () => {- it("detects the reported failed fetch error without a response", () => {- const error = TRPCClientError.from(new TypeError("Failed to fetch"));-- expect(isNetworkConnectivityError(error)).toBe(true);- });-- it("detects the reported failed fetch error with a hostname suffix", () => {- const error = TRPCClientError.from(- new TypeError("Failed to fetch (cloud.langfuse.com)"),- );-- expect(isNetworkConnectivityError(error)).toBe(true);- });-- it("does not treat other network failures as connectivity errors", () => {- const error = TRPCClientError.from(new TypeError("Load failed"));-- expect(isNetworkConnectivityError(error)).toBe(false);- });-- it("does not treat tRPC server errors as connectivity errors", () => {- const error = TRPCClientError.from({- error: {- code: -32603,- message: "Internal server error",- data: {- code: "INTERNAL_SERVER_ERROR",- httpStatus: 500,- path: "events.all",- },- },- });-- expect(isNetworkConnectivityError(error)).toBe(false);- });-- it("does not treat response parsing errors as connectivity errors", () => {- const error = TRPCClientError.from(- new SyntaxError("Unexpected token <"),- {- meta: {- response: new Response("<html></html>", { status: 502 }),- },- },- );-- expect(isNetworkConnectivityError(error)).toBe(false);- });-- it("does not treat non-tRPC errors as connectivity errors", () => {- expect(isNetworkConnectivityError(new TypeError("Failed to fetch"))).toBe(- false,- );- });- });-}-/* eslint-enable @repo/no-in-source-vitest */-/*** tRPC serializes query input into the GET URL. For reads whose input scales with* the number of rows (the `*.batchIO` I/O fetches), that URL grows large (~6KB at