Dashboard › cli › Distillation
a91fef7d-c971-48bf-b761-4b8e0fef2b9b["lore_tm_v1_s31XRqw4qPp1bVVTeSb2hNeCrLTylN7yzilvleSdgW0","lore_tm_v1_LtSY-wQ-L_WFm2X0BDnQeayfd0PU02P-0e98nTjBB4A","lore_tm_v1_I_n9CxZBzXVi9r85vatEAaSzE5a08hryKsGoBNho2S8","lore_tm_v1_4p-p38FLQEY8X4bJayRYouSNoYv9onAYJtoHO-yqlqg"]
Date: Sep 10, 2026
packages/cli/src/lib/sentry-client.ts always returns "done" or "throw"; therefore throw new Error("Exhausted all retry attempts") at lines 551–552 is unreachable.packages/cli/src/lib/dsn/code-scanner.ts::getExpectedHost() obtains getConfiguredSentryUrl(); when configured, parses it with new URL(sentryUrl) and returns url.host. An invalid configured SENTRY_HOST/SENTRY_URL throws ConfigError with message SENTRY_HOST/SENTRY_URL "${sentryUrl}" is not a valid URL and guidance to set a valid URL such as https://sentry.example.com or unset it for sentry.io; without configuration it returns DEFAULT_SENTRY_HOST.packages/cli/src/lib/dsn/code-scanner.ts::isValidDsnHost(dsn) parses via parseDsn(dsn), returns false for unparseable DSNs, then accepts only parsed.host === expectedHost or parsed.host.endsWith(\.${expectedHost}`)`; this permits exact expected-host and subdomain DSNs while preventing SaaS/self-hosted cross-detection.packages/cli/src/lib/dsn/code-scanner.ts::scanDirectory(cwd) runs inside withTracingSpan("scanCodeForDsns", "dsn.detect.code", ...), initializes sourceMtimes, dirMtimes, and seen: Map<string, DetectedDsn>, and uses filesSeenForMtime: Set<string> to avoid redundant mtime writes because grepFiles emits one match per line.packages/cli/src/lib/dsn/code-scanner.ts records dsn.files_scanned, sets dsn.dsns_found to 0, and returns null when no DSN is found. It rethrows ConfigError; for other scan errors it sets span status code 2 with message "Directory scan failed", logs scanCodeForFirstDsn failed: ${String(error)}, and returns null. Its tracing attributes include "dsn.scan_dir": cwd, "dsn.stop_on_first": true, and "dsn.max_depth": DSN_MAX_DEPTH.packages/cli/src/lib/sentry-client.ts::createAuthenticatedFetch() returns a fetch-compatible authenticatedFetch(input, init?) wrapper. At the start of every request it calls clearLastCacheHitAge() and maybeWarnEnvTokenIgnored().createAuthenticatedFetch(), request method is init?.method ?? (input instanceof Request ? input.method : "GET"); URL path comes from extractUrlPath(input). The request runs in withTracingSpan(\${method} ${urlPath}`, "http.client", ..., { "http.request.method": method, "url.path": urlPath })`.createAuthenticatedFetch() derives fullUrl with extractFullUrl(input) and starts timing with performance.now(). For GET requests it calls tryCacheHit(method, fullUrl, authHeaders(getAuthToken())) before retry/auth network flow; a hit sets http.response.status_code, logs ${method} ${urlPath} → ${cached.status} (cache hit, ...ms), and returns the cached response.createAuthenticatedFetch() calls fetchWithRetry(input, init, method, fullUrl), sets http.response.status_code, marks the span failed with { code: 2, message: \${response.status}` }when!response.ok, logs ${method} ${urlPath} → ${response.status} (...ms)`, and returns the response.createAuthenticatedFetch() is documented to provide GET response caching; Bearer-token injection; AbortController timeout; retries for transient 408, 429, and 5xx responses; one forced token refresh/retry for 401; exponential backoff; User-Agent; and HTTP span tracing. Cache hits skip auth refresh, timeout, and retry logic, while successful GET network responses are cached afterward.packages/cli/src/lib/sentry-client.ts defines ExecuteAttemptArgs with exact fields input: Request | string | URL, init: RequestInit | undefined, headers: Headers, isLastAttempt: boolean, and timeoutMs: number. executeAttempt() calls fetchWithTimeout({ input, init, headers, externalSignal: init?.signal, timeoutMs }).packages/cli/src/lib/sentry-client.ts::createAuthenticatedFetch() at line 574 and its cached assignment cachedFetch = createAuthenticatedFetch() as unknown as typeof fetch at line 675; regional API request functions are packages/cli/src/lib/api/infrastructure.ts::apiRequestToRegion<T>() at line 458 and apiRequestToRegionNoContent() at line 608.packages/cli/src/lib/sentry-client.ts::prepareHeaders() at line 113, fetchWithRetry() at line 506, and a fetchWithRetry() call to prepareHeaders(input, init, token) at line 513.