Dashboard › cli › Distillation
498cfc1e-4338-48be-843c-fd69503a526b["lore_tm_v1_Q51vMDv-ubUc2eNLFJC7UZ__NE7mpuxyLNqqcFenZZc","lore_tm_v1_gcwy-9akL2Z-wbZvBdoGunxv7FuoYHp6vkvE5zdHQJc","lore_tm_v1_Qj79jhwb9HyMJ6XgGT_t4j437cEyHYKOgqPPEqm5jyk","lore_tm_v1_q42m4EDq3utiDelpZpFu2ZzcAk6gVL4KLd1xeLKZ_4w","lore_tm_v1_6Sv4PzHrIDjt604GeOz7vvj9OOw7Bl6f5PJE-nlkQXk"]
packages/cli/test/lib/upgrade.test.ts lines 591β710 test versionExists(): for "curl" version "1.0.0", it first requests https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%401.0.0 and returns true on HTTP 200.versionExists("curl", "1.0.0") falls back after a Toolkit HTTP 404 from https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%401.0.0 to the legacy URL https://api.github.com/repos/getsentry/cli/releases/tags/1.0.0, returning true when the latter responds HTTP 200.UPGRADE_SOURCES[0] to versionExists("curl", "1.0.0", UPGRADE_SOURCES[0]) disables source fallback: a Toolkit HTTP 404 produces false after only requesting https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%401.0.0.versionExists() tests map methods to registries as follows: "curl" and "brew" check GitHub; "npm", "pnpm", "bun", and "yarn" check npm. HTTP 200 means the version exists and HTTP 404 means it does not.TypeError("fetch failed") during versionExists("curl", "1.0.0") is expected to reject with UpgradeError containing "Failed to connect to GitHub".packages/cli/test/lib/delta-upgrade.test.ts lines 1869β1880 test the top-level attemptDeltaUpgrade() orchestrator: attemptDeltaUpgrade("0.14.0", "/tmp/fake-old", "/tmp/fake-out") returns null when canAttemptDelta is false because the current version is a development version.packages/cli/test/lib/delta-upgrade.test.ts lines 1882β1905 test background prefetch guards: with test CLI_VERSION equal to "0.0.0-dev", prefetchNightlyPatches("0.14.0-dev.123") and prefetchStablePatches("0.14.0") return without making fetch calls because canAttemptDelta is false.importDeltaUpgradeWithVersion(version) in packages/cli/test/lib/delta-upgrade.test.ts lines 1907β1915 calls vi.resetModules(), mocks ../../src/lib/constants.js with CLI_VERSION: version, and dynamically imports ../../src/lib/delta-upgrade.js.restoreDeltaUpgradeModule() in packages/cli/test/lib/delta-upgrade.test.ts lines 1917β1920 calls vi.doUnmock("../../src/lib/constants.js") and vi.resetModules(); it runs in afterEach for the "selected source affinity" suite, which uses useTestConfigDir("delta-source-affinity-")."0.13.0" and calls attemptDeltaUpgrade("0.14.0", "/tmp/fake-old", "/tmp/fake-out", false, undefined, LEGACY_UPGRADE_SOURCE). On HTTP 404 it returns null, requests only https://api.github.com/repos/getsentry/cli/releases?per_page=12, and never contacts getsentry/toolkit."0.14.0-dev.100" and calls attemptDeltaUpgrade("0.14.0-dev.101", "/tmp/fake-old", "/tmp/fake-out", false, undefined, LEGACY_UPGRADE_SOURCE). On HTTP 401 it returns null, requests only https://ghcr.io/token?scope=repository:getsentry/cli:pull, and never contacts getsentry/toolkit."0.13.0" and calls prefetchStablePatches("0.14.0", undefined, LEGACY_UPGRADE_SOURCE). It requests only https://api.github.com/repos/getsentry/cli/releases?per_page=12 and never contacts getsentry/toolkit."0.14.0-dev.100" and calls prefetchNightlyPatches("0.14.0-dev.101", undefined, LEGACY_UPGRADE_SOURCE). It requests only https://ghcr.io/token?scope=repository:getsentry/cli:pull and never contacts getsentry/toolkit.extractReleaseVersions() has one search match, at packages/cli/src/lib/upgrade.ts line 105.packages/cli/src/lib/upgrade.ts defines PackageManager = "npm" | "pnpm" | "bun" | "yarn" and exported OfflineMode = false | "explicit" | "network-fallback", where false means online, "explicit" means the user supplied --offline, and "network-fallback" means a network failure automatically fell back to cache.packages/cli/src/lib/upgrade.ts constants include exported NIGHTLY_TAG = "nightly" for the rolling nightly GitHub releaseβs stable fallback, private NPM_REGISTRY_URL = "https://registry.npmjs.org/sentry", and exported VERSION_PREFIX_REGEX = /^v/.ResolvedUpgradeVersion in packages/cli/src/lib/upgrade.ts contains readonly version: string, without a source-specific tag prefix, and readonly source: UpgradeSource, which must serve every later lookup and download in the operation.extractReleaseVersions(data, source) in packages/cli/src/lib/upgrade.ts accepts either one { tag_name?: string } object or an array of { tag_name?: string; draft?: boolean; prerelease?: boolean }. For a single object it returns its tag unchanged when present; for arrays it removes drafts and prereleases, retains string tags beginning with source.tagPrefix, and strips that prefix.buildKnownCurlPaths(homeDir, env) in packages/cli/src/lib/upgrade.ts builds known curl install directories from KNOWN_CURL_DIRS, appending sep to preserve directory-boundary matching; when env.XDG_BIN_HOME is absolute, it appends join(xdgBinHome, ".") + sep, avoiding a doubled trailing separator._knownCurlPaths memoizes curl install paths lazily through getKnownCurlPaths() = buildKnownCurlPaths(homedir(), process.env) to avoid temporal-dead-zone issues from circular imports before KNOWN_CURL_DIRS is initialized.getCurlInstallPaths() in packages/cli/src/lib/upgrade.ts returns installPath, tempPath, oldPath, and lockPath. Its path priority is: 1. a DB-stored path when stored.method === "curl" and existsSync(dirname(stored.path)); 2. process.execPath when it starts with a known curl directory; 3. join(determineInstallDir(homedir(), process.env), getBinaryFilename()).SENTRY_INSTALL_DIR installs whose directories were later purged; blindly trusting such paths caused ENOENT ... open '.../sentry.lock' in #discuss-cli. existsSync() failures including EACCES or transient unmounts intentionally cause fallback to process.execPath or the default install path rather than an error.fetchLatestFromGitHubWithSource, ResolvedUpgradeVersion, and prefetchedReleases: packages/cli/src/lib/version-check.ts lines 32 and 292; packages/cli/src/lib/upgrade.ts lines 98, 433, 436, 462, 512, 609, 612, and 618; and packages/cli/src/lib/release-notes.ts lines 630, 633, 737, 761, and 777.