Dashboard › cli › Distillation
c65ccf87-f8dd-41eb-8b61-4e191702da91["lore_tm_v1_Zog9ifHvGB0I0-ZcBA-xBA-nswSvPlLqIW3p3_uJP2M","lore_tm_v1_iiqOcbe7-6dL6qYjZRKqHq0SZHLqtZySEyqPxRSB5AM","lore_tm_v1_NfQx3VAihRu0jtTRb2m1Q-PkobKoFwkBnLatv70tUYw","lore_tm_v1_YG0tf41t6qYEbDjCBMgHwX0r7ZmDkBD62ShF16lrXKI","lore_tm_v1_WZkGkmjqjdKGINyxQesrm4wvijjOP9GLP6u3beJzvj8","lore_tm_v1_zpEk8MQWrL0F8JJ8uYPrqYX9G6Uauo6-5e4OTl3FT60","lore_tm_v1_Px4zzBiSnp7tbuzmXKk-ijNiS_3yLLCqjousKbS8QYQ","lore_tm_v1_1HimfngAsZgixse_13l_VMTWT0YDksD4wwmLLia884g"]
Date: Sep 10, 2026
packages/cli/test/lib/oauth.test.ts tests resolveOAuthScopeString from packages/cli/src/lib/oauth.ts using Vitest and fast-check; imports SENTRY_SCOPES, ValidationError, OAUTH_SCOPES, and DEFAULT_NUM_RUNS.readOnly never includes write or admin scopes; resolveOAuthScopeString({ readOnly: true }) contains neither ":write" nor ":admin".resolveOAuthScopeString() or {}) returns OAUTH_SCOPES.join(" "); { readOnly: true } returns exactly the OAUTH_SCOPES entries ending in :read; and explicit scopes takes precedence over readOnly (e.g. { readOnly: true, scopes: ["project:write"] } resolves to "project:write").["ORG:READ", "project:read"] β "org:read project:read"; ["org:read", "project:read", "org:read"] β "org:read project:read"; [" ", "org:read", ""] β "org:read"."not:a:scope" throw ValidationError with field === "scope" and a message containing the invalid scope; empty explicit scope arrays and arrays containing only blank strings also throw ValidationError.DEFAULT_NUM_RUNS: every nonempty unique subset of SENTRY_SCOPES round-trips as its lowercased, space-joined form; every individual known scope is accepted.fetchCalls containing url, auth, and iap headers.AuthConfig and getAuthConfig() in packages/cli/src/lib/db/auth.ts at lines 84 and 158.getRawEnvToken() in packages/cli/src/lib/db/auth.ts:100-110 always returns the env token if set, independent of stored OAuth priority; it trims values and prioritizes SENTRY_AUTH_TOKEN over SENTRY_TOKEN.AuthSource is exactly "env:SENTRY_AUTH_TOKEN" | "env:SENTRY_TOKEN" | "oauth"; AuthConfig has optional token, refreshToken, expiresAt, and issuedAt, plus required source.getEnvToken() is pure/no-DB and prioritizes trimmed SENTRY_AUTH_TOKEN over SENTRY_TOKEN; isEnvTokenActive() returns whether getEnvToken() is defined; getActiveEnvVarName() follows getRawEnvToken() priority and defaults to "SENTRY_AUTH_TOKEN".getAuthConfig() behavior: if SENTRY_FORCE_ENV_TOKEN is set, it returns the environment token first; otherwise stored OAuth takes priority over env tokens to fix issue #646, preventing wizard-generated build tokens from silently overriding interactive login. If no usable stored OAuth exists, it falls back to env credentials.getAuthConfig() ignores expired stored OAuth tokens without refresh_token, but retains expired tokens with a refresh token so OAuth refresh can proceed. Stored credentials return source: "oauth".getStoredAuthHost() lazy-migrates NULL credential hosts from pre-schema-v16 rows to the currently configured host on first access; it returns undefined if no stored token or a DB error, allowing fallback to env-token host scoping/default behavior.clearAuth(): Promise<void> in packages/cli/src/lib/db/auth.ts at line 439.node:http test usage found packages/cli/test/lib/telemetry/zstd-transport.test.ts:16 importing ClientRequest and IncomingHttpHeaders, plus packages/cli/test/lib/telemetry/zstd-transport.e2e.test.ts, which imports/uses createServer, IncomingMessage, and Server.packages/cli/test/lib/telemetry/zstd-transport.e2e.test.ts provides E2E tests for makeCompressedTransport() using a real http.createServer on 127.0.0.1:0; startMockIngest() returns http://127.0.0.1:${addr.port}/api/0/envelope/ and captures each requestβs headers and body."sends zstd-encoded envelope; server decompresses back to original" skips if hasZstdSupport() is false; sends a 4096-character "x" message (above the 1 KiB zstd threshold), expects HTTP 200, exactly 1 capture, content-encoding: "zstd", and uses zstdDecompress to verify the decompressed envelope contains the message and "type":"event".retry-after: "60" and x-sentry-rate-limits: "60:error:organization"; verifies makeCompressedTransport() returns those exact headers and makes exactly 1 request.startedServers: Server[] and closes every server in parallel via startedServers.splice(0) after each test, avoiding the prior risk of a shared let server being overwritten before closure and silently leaking sockets.