Dashboard › cli › Distillation
34c01e7b-5c02-428a-b61d-185bec01e2ab["lore_tm_v1_KALCATs-uVww9x-7POsAgmwWRwm0shc6zONmC5XNgvw"]
packages/cli/src/lib/delta-upgrade.ts implements delta-upgrade discovery/application using binpatch, including applyPatchChainInMemory, resolveAndApply, OciClient, stable GitHub and nightly GHCR source strategies, patch caching, chain validation/filtering, and telemetry types.packages/cli/src/lib/delta-upgrade.ts re-exports ExtractStableChainOpts, GitHubAsset, GitHubRelease, PatchChain, and StableChainInfo types plus extractSha256, getPatchFromVersion, getPatchTargetSha256, getStableTargetSha256, and PATCH_TAG_PREFIX from binpatch; the barrel-file lint rule is suppressed to preserve the existing public API.DeltaResult in packages/cli/src/lib/delta-upgrade.ts contains sha256: string, patchBytes: number, and chainLength: number.logger.withTag("delta-upgrade"); the InstrumentHook implementation wraps operations with withTracing(name, "http.client", fn).patchCacheKey(fromVersion, toVersion) returns patch-chain:${fromVersion}-${toVersion}.instrumentCache(base) wraps PatchCache: load() emits a cache.get span with cache.key, cache.hit, and, on a hit, cache.item_size = result.totalSize; save() emits a cache.put span keyed from the first stepβs fromVersion through the last stepβs toVersion, with cache.item_size equal to the sum of chain.patches[].size; empty-step saves bypass instrumentation; cleanup() and clear() delegate directly.getPatchCache() creates an instrumented cache at join(getConfigDir(), "patch-cache") using makeCache().stableSource() uses githubReleaseSource() with releasesUrl: GITHUB_RELEASES_URL, binaryName: getPlatformBinaryName(), userAgent: \sentry-cli/${CLI_VERSION}`, fetch: customFetch, and the HTTP tracing instrument` hook.nightlySource() uses ghcrSource() with registry: "https://ghcr.io", repo: GHCR_REPO, binaryName: getPlatformBinaryName(), targetTag: (version) => \nightly-${version}`, compareVersions, userAgent: `sentry-cli/${CLI_VERSION}`, fetch: customFetch, and the HTTP tracing instrument` hook.packages/cli/src/lib/delta-upgrade.ts explains that importing GHCR_REPO from ./ghcr.js maintains a single source of truth and prevents a silent 404 previously caused by using a string literal.canAttemptDelta(targetVersion) returns false when CLI_VERSION === "0.0.0-dev", when current and target versions differ in nightly/stable classification, or when the target is a downgrade; otherwise it returns true.fetchRecentReleases(signal?) requests ${GITHUB_RELEASES_URL}?per_page=12 via customFetch with Accept: "application/vnd.github.v3+json", User-Agent: \sentry-cli/${CLI_VERSION}`, and the optional abort signal. It returns []` for non-OK responses, non-array JSON, or exceptions, logging debug details for malformed data and fetch failures.downloadStablePatch(url, signal?) fetches with customFetch, User-Agent: \sentry-cli/${CLI_VERSION}`, and the optional abort signal; an OK response becomes new Uint8Array(await response.arrayBuffer()), while non-OK responses or exceptions return null`, with exceptions logged at debug level.extractStableChain(opts) compatibility wrapper calls binpatchExtractStableChain(opts) and converts a result containing "failure" to null; otherwise it returns the StableChainInfo.filterAndSortChainTags(allTags, currentVersion, targetVersion) delegates to binpatchFilterAndSortChainTags(allTags, currentVersion, targetVersion, compareVersions).