Dashboard › cli › Distillation
9d699994-2a23-43cd-b018-b08a07759d8b["lore_tm_v1_V8s5PATygk6b-TLJC-al57VGZ7RAQvvWs2WGIop84_Q","lore_tm_v1_RB0liwpijHkpv2f0KXvQ1K0UYl1tJHy7EW-sYwjZMYY","lore_tm_v1_mROtOCB9gzzixYSb2uzCw0wfvy12GqlHm5BbCVRMhKQ","lore_tm_v1_VgGBUSEwEflopj0fp2Kwltzsa8km76qAwMwGP3y6D9A","lore_tm_v1_N-O95qani4ApmZ0LY54C7UH7l08q2c9JgdoYBHVlPa0","lore_tm_v1_FK28vkwnYCNpiltFwZ_J87AJV7SqIhM5ZAwPrPSH3Oc","lore_tm_v1_4HVfh5x4Z2hToli-9qg8BOKGBNnc5aZr1QF14cP4HdU","lore_tm_v1_w5DDSr9qXjufj1bmwnCiC20KPOwtpsnenNz03IdmOcY","lore_tm_v1_rXYSV2C3Tg9q7tEOEa9lfb19ClcS0J8PRDhdAlqRyfE","lore_tm_v1_4edSObM_fRkjGakI5LyT00CmH40BA0XdqWhnWkbsY-c","lore_tm_v1_EdOptwNL1Wii0n45i0o2TGOEXH5NDmIcK9q1f6nyygY","lore_tm_v1_qag1eu6wubTKuqhR5MAYQj4ZEwLdy9h8e_0OLfS_Zik"]
githubReleaseSource stable-channel strategy models each GitHub release with three platform assets: <binaryName> for the expected SHA-256 digest, <binaryName>.gz for the full-download size ratio gate, and <binaryName>.patch for the delta from the previous release.extractSha256(asset) accepts case-insensitive sha256:([0-9a-f]+) digests and returns lowercase hex or null; getStableTargetSha256(release, binaryName) finds the exact binary asset and delegates to extractSha256.extractStableChain(opts) is pure computation over releases, currentVersion, targetVersion, binaryName, and fullGzSize; it returns either StableChainInfo with patchUrls, expectedSha256, and ordered { fromVersion, toVersion }[] steps, or StableChainFailure classified exactly as "no_patches" | "malformed_chain" | "too_long" | "over_budget"."no_patches" when current/target tags are absent, misordered, or yield no target release; "too_long" when the release slice exceeds MAX_STABLE_CHAIN_DEPTH; "malformed_chain" when the target binary digest or any required ${binaryName}.patch asset is missing; and "over_budget" when cumulative published patch sizes exceed fullGzSize * SIZE_THRESHOLD_RATIO.releases.slice(targetIdx, currentIdx) selects hops, then patch URLs and releases are reversed so patches apply oldest-first; step construction begins at currentVersion and advances through each reversed release tag.githubReleaseSource(config) accepts releasesUrl, binaryName, userAgent, optional injectable fetch, and optional InstrumentHook; instrumentation wraps HTTP operations as "fetch-releases" and "download-patch".${releasesUrl}?per_page=${MAX_STABLE_CHAIN_DEPTH + 2} with Accept: application/vnd.github.v3+json, the configured User-Agent, and optional AbortSignal; network exceptions and non-OK responses return null.githubReleaseSource.resolveChain() reports "network" for release-fetch failure or any listed patch that cannot be downloaded, "no_patches" when the target release is absent, "malformed_chain" when the target ${binaryName}.gz asset is absent, and otherwise forwards the exact extractStableChain() failure reason.Promise.all; successful downloads become PatchLink values { data, size: data.byteLength }, and the resulting PatchChain includes actual downloaded totalSize, expectedSha256, and steps.packages/cli/src/lib/version-check.ts, maybePrefetchPatches(channel, latestVersion, signal, source) only runs for a strictly newer version, forwards the discovered UpgradeSource to prefetchNightlyPatches() or prefetchStablePatches(), logs prefetch failures as best-effort, and then independently attempts cleanupPatchCache() with best-effort debug logging.checkForUpdateInBackgroundImpl() never throws: errors are caught and reported to Sentry.checkForUpdateInBackgroundImpl() catches shouldCheckForUpdate()/DB failures with Sentry.captureException; otherwise it creates an AbortController, starts detached transaction span "version-check" / "version.check", discovers nightly via fetchLatestNightlyVersionWithSource(signal) or stable via fetchLatestFromGitHubWithSource(signal), stores the version, and prefetches patches using the same selected source.version_check.error and version_check.error_type rather than creating Sentry Issues, mark status code 2, clear pendingAbortController, and end the span. Success marks status code 1.packages/cli/src/lib/upgrade.ts, detectInstallationMethod() always checks Homebrew first because stored install information may be stale; the cheap realpath check is authoritative.node_modules path, 4. best-effort persistence of detected method with path: process.execPath and version: CLI_VERSION.fetchLatestFromGitHubWithSource(signal?, sources = UPGRADE_SOURCES) uses resolveUpgradeSource({ getProbeUrl: getGitHubLatestReleaseUrl, signal, sources }), parses either one release object or a release array through extractReleaseVersions(data, source), strips VERSION_PREFIX_REGEX, and returns { version, source }; missing versions throw UpgradeError("network_error", "No version found in GitHub release").fetchLatestFromGitHub(signal?, source?) preserves source affinity by restricting lookup to [source] when supplied; otherwise it uses ordered UPGRADE_SOURCES.fetchLatestNightlyVersionWithSource() resolves the rolling "nightly" manifest and returns the manifest annotation version plus its selected source. resolveNightlyManifest() probes each ordered source’s GitHub repository first, skips sources missing with HTTP 404, then performs anonymous-token and GHCR manifest requests; it also skips a source when the requested GHCR tag returns HTTP 404 and otherwise propagates errors."curl" and "brew" but npm for package-manager installs; nightly discovery always uses fetchLatestNightlyVersion().resolveLatestUpgradeVersion(channel, signal?) always returns a source-aware standalone resolution: nightly uses fetchLatestNightlyVersionWithSource(signal) and stable uses fetchLatestFromGitHubWithSource(signal).resolveExistingUpgradeVersion(version) validates nightly versions through resolveNightlyManifest(\nightly-${version}`, undefined, UPGRADE_SOURCES)and stable versions throughresolveUpgradeSource()withgetGitHubReleaseByTagUrl(version, source); all-source HTTP-404 exhaustion returns null`, while other errors propagate.versionExists(method, version, source?) uses standalone lookup for nightly, curl, and brew; with an explicit source, nightly calls nightlyVersionExists(version, source) and stable makes a source-specific GitHub release-by-tag request. Other package-manager versions use HEAD ${NPM_REGISTRY_URL}/${version}.writeChunkSync(fd, chunk) loops until the full Uint8Array is written, handling short writes; a writeSync() result <= 0 throws with the exact remaining-byte count to prevent an infinite loop.downloadBinaryToTemp(version, downloadTag?, offline?, setMessage?, source = PRIMARY_UPGRADE_SOURCE) acquires the curl-install lock, removes a stale temp file best-effort, tries delta first with the selected source, and falls back to a full source-affine download unless offline mode requires an UpgradeError("offline_cache_miss", ...).downloadBinaryToTemp() calls waitForBinaryVisible(tempPath) to address the Windows + Bun 1.3.9 filesystem-visibility race that otherwise causes Bun.spawn to report Executable not found in $PATH: "...sentry.exe.download"; it then clears consumed patch cache best-effort, applies Unix mode 0o755, and returns { tempBinaryPath, lockPath, patchBytes }.process.ppid recognition, making the parent’s later release a no-op. Errors inside downloadBinaryToTemp() release the lock before rethrowing.tryDeltaUpgrade() forwards version, process.execPath, destination, offline status, progress callback, and selected UpgradeSource to attemptDeltaUpgrade(). downloadFullBinary() preserves that source for both downloadNightlyToPath() and downloadStableToPath().brew upgrade getsentry/tools/sentry; the requested version is intentionally ignored because Homebrew formula versioning does not support arbitrary pinned releases.yarn global add sentry@${version}; npm, pnpm, and Bun ${pm} install -g sentry@${version}. On Windows, spawning uses shell: true because these commands are .cmd files.executeUpgrade(method, version, downloadTag?, offline?, setMessage?, source = PRIMARY_UPGRADE_SOURCE) forwards source affinity for curl downloads, runs Homebrew or npm/pnpm/bun/yarn installation for those methods, and throws UpgradeError("unknown_method") otherwise.packages/cli/src/commands/cli/upgrade.ts, pinned nightly versions always use curl/GitHub-style standalone lookup regardless of the current installation method: lookupMethod = channel === "nightly" ? "curl" : method.resolvePinnedVersion("curl", target) uses resolveExistingUpgradeVersion(target) and returns its selected UpgradeSource; non-curl methods call versionExists(lookupMethod, target) and return no source. Missing versions throw UpgradeError("version_not_found", \Version ${target} not found`)`.resolveTargetVersion() considers nightly, curl, and brew upgrades standalone; it resolves latest standalone versions with source metadata, uses npm-style fetchLatestVersion() otherwise, strips VERSION_PREFIX_REGEX from pinned targets, and carries the selected source into both check-only and executable target results.CHANNEL_VERSIONS; when validation does run, the pinned version’s resolved source replaces the latest-version source if available.SPAWN_MAX_ATTEMPTS = 5 and SPAWN_RETRY_BASE_MS = 500; the rationale is transient EBUSY from Defender/SmartScreen locking a newly written executable during scanning.setReleaseChannel clears the version cache.UpgradeError values whose reason is "network_error"; package-manager installs do not qualify because they need network for installation, not merely version discovery.executeStandardUpgrade() carries optional UpgradeSource through executeUpgrade(). Latest nightly uses rolling tag NIGHTLY_TAG; a specifically requested nightly version uses its own version tag.setup --install on the downloaded temporary binary, pins SENTRY_INSTALL_DIR to avoid relocation outside PATH, and releases downloadResult.lockPath in finally. Package-manager upgrades resolve the new CLI path after installation so setup does not run Node’s process.execPath or a removed Homebrew keg path.migrateToStandaloneForNightly() handles users switching from brew/npm/pnpm/bun/yarn to nightly in this exact sequence: 1. download a standalone nightly binary, 2. install it into determineInstallDir(), 3. run setup to update completions, PATH, and metadata, 4. return warnings about the old package-manager installation potentially shadowing the new binary.executeUpgrade("curl", target, downloadTag, undefined, setMessage, source), uses rolling NIGHTLY_TAG only when no pinned version was requested, requires a non-null DownloadResult, installs with method "curl" and channel "nightly", and releases the lock in finally.npm uninstall -g sentry, pnpm pnpm remove -g sentry, and Bun bun remove -g sentry.