The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Remove debug logging and seed script is gated
Rafi5fe28ef0f3a8
diff --git a/apps/web/.env.example b/apps/web/.env.exampleindex 0ba7e2c1e7..89ade29ae9 100644--- a/apps/web/.env.example+++ b/apps/web/.env.example@@ -27,7 +27,6 @@ UPSTASH_REDIS_REST_TOKEN=# Supported values: upstash-redis, turbopufferPARTNER_SEARCH_PROVIDER=PARTNER_SEARCH_INDEX_NAME=partner-search-v1-PARTNER_SEARCH_DEBUG=false# Required when PARTNER_SEARCH_PROVIDER=turbopufferTURBOPUFFER_API_KEY=diff --git a/apps/web/lib/api/partners/search/providers/shared.ts b/apps/web/lib/api/partners/search/providers/shared.tsindex 451b566c05..1bf3ed866f 100644--- a/apps/web/lib/api/partners/search/providers/shared.ts+++ b/apps/web/lib/api/partners/search/providers/shared.ts@@ -45,17 +45,6 @@ export function getQueryNgrams(query: string): string[] {return toNgrams(query);}-export function logPartnerSearchDebug(- provider: string,- details: Record<string, unknown>,-) {- if (process.env.PARTNER_SEARCH_DEBUG !== "true") {- return;- }-- console.log(`[Partner Search Debug] ${provider}`, details);-}-/*** First non-blank wins. `||` rather than `??` because a blank value has to fall* through to the default, otherwise an empty env var silently targets an indexdiff --git a/apps/web/lib/api/partners/search/providers/turbopuffer.ts b/apps/web/lib/api/partners/search/providers/turbopuffer.tsindex 6655cfa609..0d54f51529 100644--- a/apps/web/lib/api/partners/search/providers/turbopuffer.ts+++ b/apps/web/lib/api/partners/search/providers/turbopuffer.ts@@ -7,12 +7,7 @@ import {import type { PartnerSearchDocument, PartnerSearchProvider } from "../types";import { validatePartnerSearchCandidateLimit } from "../types";import { withQueryDeadline, withTransientRetry } from "./resilience";-import {- getEmailNgrams,- getQueryNgrams,- logPartnerSearchDebug,- resolveIndexName,-} from "./shared";+import { getEmailNgrams, getQueryNgrams, resolveIndexName } from "./shared";const DEFAULT_NAMESPACE = "partner-search-v1";const DEFAULT_REGION = "aws-us-east-1";@@ -207,15 +202,6 @@ export function createTurbopufferPartnerSearchProvider({const hits = mergeBranchRows(results ?? [], limit);- logPartnerSearchDebug("Turbopuffer", {- namespace: resolvedNamespaceName,- operation: "searchCandidates",- query: { programId, query, limit },- branches: branches.length,- resultCount: hits.length,- hits,- });-return { hits };},diff --git a/apps/web/lib/api/partners/search/providers/upstash-redis.ts b/apps/web/lib/api/partners/search/providers/upstash-redis.tsindex 53f398e4d2..ee0c85259e 100644--- a/apps/web/lib/api/partners/search/providers/upstash-redis.ts+++ b/apps/web/lib/api/partners/search/providers/upstash-redis.ts@@ -20,12 +20,7 @@ import {withQueryDeadline,withTransientRetry,} from "./resilience";-import {- getEmailNgrams,- getQueryNgrams,- logPartnerSearchDebug,- resolveIndexName,-} from "./shared";+import { getEmailNgrams, getQueryNgrams, resolveIndexName } from "./shared";const DEFAULT_INDEX_NAME = "partner-search-v1";// Keep the full query operation within the one-second latency target while@@ -295,15 +290,6 @@ export function createUpstashRedisPartnerSearchProvider({score,}));- logPartnerSearchDebug("Upstash Redis Search", {- indexName: resolvedIndexName,- operation: "searchCandidates",- query: { programId, query, limit },- filter,- resultCount: hits.length,- hits,- });-return { hits };}diff --git a/apps/web/scripts/dev/seed-100k-partners.ts b/apps/web/scripts/dev/seed-100k-partners.tsindex af9a0f9d04..59d8c40cf4 100644--- a/apps/web/scripts/dev/seed-100k-partners.ts+++ b/apps/web/scripts/dev/seed-100k-partners.ts@@ -12,7 +12,8 @@* dying on a constraint error halfway through.** This inserts login-capable users with a known password, so it refuses a non-local- * DATABASE_URL unless `--allowRemoteDatabase` is passed.+ * DATABASE_URL unless `--allowRemoteDatabase` is passed, and refuses a production+ * environment (NODE_ENV/VERCEL_ENV) outright.** cd apps/web* pnpm run script dev/seed-100k-partners [--count=100000] [--programId=prog_123] [--seed=custom-seed]@@ -275,6 +276,18 @@ const assertSeedableDatabase = (allowRemoteDatabase: boolean) => {throw new Error("DATABASE_URL is not set.");}+ // The host allowlist cannot tell a truly local database from a production+ // one reached through a local tunnel, so a production environment refuses+ // outright — --allowRemoteDatabase does not override this.+ if (+ process.env.NODE_ENV === "production" ||+ process.env.VERCEL_ENV === "production"+ ) {+ throw new Error(+ "Refusing to seed in a production environment. This script inserts users with a known password.",+ );+ }+let host: string;try {// `URL` keeps IPv6 hosts bracketed; strip them so "::1" matches.