Dashboard › cli › Distillation
2237cef0-2050-4567-a418-b438c8f8874d["lore_tm_v1_072ClWe9lIU9YrrA52Du1hOqu-qqvZrs-DWimxcVCEI","lore_tm_v1_SO_5pvRYPiiSqC8E2QxpEWpcZ6krTeru3qEY6YU98_M","lore_tm_v1_hu2gp7hDdS7ljmdgWLYTKrrFLjUiSHWLnO3bFFP9P1Y"]
878459c490576dbb7abb76d3a3dc1b5d9fc62c1f (fix(cli): fail closed on upgrade metadata), authored and committed by Burak Yigit Kaya <byk@sentry.io>, changes 8 files with 130 insertions and 25 deletions. (meaning Sep 10, 2026)e22f0eba6 changes 10 files with 87 insertions and 38 deletions; dcf671999 changes 1 file with 5 insertions and 3 deletions; f1c10a6cb changes 8 files with 257 insertions and 64 deletions; e565b1afb changes 5 files with 124 insertions and 39 deletions.resolveTargetWithFallback in packages/cli/src/commands/cli/upgrade.ts previously treated any UpgradeError with reason === "network_error" as eligible for cached-target fallback, conflating genuine transport failures with HTTP and malformed-metadata failures. Fix: fallback is now allowed only when method === "curl" and the error is an UpgradeTransportError; all other errors are rethrown.packages/cli/src/lib/errors.ts adds UpgradeTransportError extends UpgradeError; its constructor calls super("network_error", message) and sets this.name = "UpgradeTransportError". It specifically represents upgrade transport failures rather than HTTP or metadata errors.packages/cli/src/lib/binary.ts changes fetchUpgradeProbe and fetchWithUpgradeError to throw UpgradeTransportError for TLS certificate failures and other connection failures. Error details remain buildTlsErrorDetail(error), Failed to connect to GitHub: ${stringifyUnknown(error)}, and Failed to connect to ${serviceName}: ${msg} as applicable.packages/cli/src/lib/ghcr.ts changes exhausted GHCR retry failures from UpgradeError("network_error", ...) to UpgradeTransportError, using message ${context}: ${lastError?.message ?? "unknown error"}.rethrowExternalAbort in packages/cli/src/lib/ghcr.ts to throw externalSignal?.reason rather than the caught error, preserving the callerβs arbitrary cancellation reason.packages/cli/test/lib/ghcr.test.ts redirect regression test aborts with reason { kind: "cancelled" }, has the mocked fetch throw new DOMException("aborted", "AbortError"), and requires downloadNightlyBlob("token", "sha256:abc", controller.signal) to reject with the exact reason object. It also verifies 2 requests and that the redirected blob request omits the authorization header.packages/cli/src/lib/upgrade.ts introduces validateStableVersion(version, source): absent versions throw UpgradeError("network_error", "No version found in ${source}"); values for which semverValid(version) === null or semverPrerelease(version) !== null throw UpgradeError("network_error", "${source} returned an invalid stable version").fetchLatestFromNpm() now returns validateStableVersion(data.version, "npm registry"). Tests require rejection of exact npm versions not-semver, 1.2.3-dev.123, 1.2.3-beta.1, and 1.2.3-rc.1, with error text npm registry returned an invalid stable version.versionExists() now calls validateStableVersion(version, "Requested package version") before making network requests for package-manager methods. Tests require npm, pnpm, bun, and yarn to reject pinned version 1.2.3-beta.1 before network access with Requested package version returned an invalid stable version."uses the cached target only after a transport failure" stores target 88.88.88, makes fetch throw new TypeError("fetch failed"), runs cli upgrade --check --method curl, and expects output Using cached target: 88.88.88."never uses the cached target after %s" covers both HTTP 403 and malformed HTTP 200. With cached target 88.88.88, cli upgrade --check --method curl must not output Using cached target, must report errors, must make exactly 1 request, and that request must target getsentry/toolkit.new URL(String(url)) and identifies GitHub requests only when requestUrl.origin === "https://api.github.com", replacing the broader String(url).includes("api.github.com") check.