Dashboard › cli › Distillation
ac774bca-6d4d-4230-9f49-b3a5758bac6e["lore_tm_v1_6gAcsvfT2-7TTvyJCcTxxgrpWuX72oVitRbjb8fMfJE","lore_tm_v1_t9YKfnT7XXhnDppeoKw39R018BDOUVlrgTSoxjSq-jE","lore_tm_v1_zeJ2gHIPexlhl8NWNO3Zv2vtiJz1nGr-FM1m3CqZOi8","lore_tm_v1_o5bMkqPJX6cDwuRxuh-rXQ-vwxIsiJUrAeUv7IDR3NA","lore_tm_v1_hJmP6geonWXXJZAD9uaevc_e1qton9VI13k8ORZCvsk","lore_tm_v1_DrR5mUmjrJVsJ4QO6Ss34PIiDo0S5IUhYBNfOOr7U60"]
packages/cli/src/lib/delta-upgrade.ts uses binpatch for delta discovery/application, including applyPatchChainInMemory, extractStableChain, filterAndSortChainTags, validateChainStep, resolveAndApply, makeCache, OciClient, githubReleaseSource, and ghcrSource.DeltaResult in packages/cli/src/lib/delta-upgrade.ts contains exact fields { sha256: string; patchBytes: number; chainLength: number }.makeCache(join(getConfigDir(), "patch-cache")); keys use patch-chain:${fromVersion}-${toVersion}.cache.get and cache.put, sets cache.key as [key], records cache.hit, and records cache.item_size from result.totalSize on reads or summed patch sizes on writes.githubReleaseSource with releasesUrl: GITHUB_RELEASES_URL, binaryName: getPlatformBinaryName(), userAgent: \sentry-cli/${CLI_VERSION}`, fetch: customFetch, and tracing via instrument`.ghcrSource with registry: "https://ghcr.io", repo: GHCR_REPO, binaryName: getPlatformBinaryName(), targetTag: (version) => \nightly-${version}`, compareVersions, userAgent: `sentry-cli/${CLI_VERSION}`, fetch: customFetch, and tracing via instrument`.GHCR_REPO is imported by name into packages/cli/src/lib/delta-upgrade.ts as the single source of truth; the code comment says a prior string literal introduced a silent HTTP 404.canAttemptDelta(targetVersion) rejects delta upgrades when CLI_VERSION === "0.0.0-dev", when current and target differ between stable/nightly channels, or when the target is a downgrade.fetchRecentReleases(signal) requests ${GITHUB_RELEASES_URL}?per_page=12 using GitHub API accept headers and sentry-cli/${CLI_VERSION} as user agent; non-OK responses, non-array JSON, and caught errors all degrade to [].downloadStablePatch(url, signal) returns a Uint8Array only for an OK response and otherwise returns null; caught failures are debug-logged as "Failed to download stable patch".validateChainStep() preserves three detailed failure classes: "version-mismatch" with expected and actual, "missing-layer" with layerName, and "size-exceeded" with layerSize and budget. This local adapter is retained because binpatch exposes only the coarser "malformed" and "over_budget" reasons.resolveNightlyChain() lists tags using PATCH_TAG_PREFIX unless preloadedTags are supplied, filters/sorts tags between current and target versions, and rejects an empty chain or one longer than MAX_NIGHTLY_CHAIN_DEPTH.resolveNightlyChain() fetches all chain manifests concurrently; any manifest-fetch failure returns null.${getPlatformBinaryName()}.patch; each stepβs remaining size budget is opts.fullGzSize * SIZE_THRESHOLD_RATIO - totalSize.opts.targetVersion, and the final manifest to supply getPatchTargetSha256(manifest, binaryName); failures set telemetry_reason where applicable and return null.applyPatchChain() runs under span "apply-patches" with operation "upgrade.delta.apply", records patches.count and patches.total_bytes, applies patches in memory, and throws SHA-256 mismatch after patching: got ${sha256}, expected ${chain.expectedSha256} if output verification fails."Applying patch(es)" when event.phase === "apply" and "Processing patch(es)" otherwise; progress updates use the delta between current and previously written bytes._source.current, sets delta.source on resolution, uses "offline_miss" for an offline cache miss, and sets telemetry_reason for DeltaUnavailableReason.delta.source when patch application failed after successful chain resolution. The fix captures the source in telemetry().onResolved and, in attemptDeltaUpgrade()βs catch path, stamps it onto the active error span.attemptDeltaUpgrade() chooses "nightly" or "stable" from isNightlyVersion(targetVersion), traces span "upgrade.delta"/operation "upgrade.delta", and records delta.from_version, delta.to_version, delta.patch_bytes, delta.chain_length, delta.result, and delta.error as applicable.upgrade.delta.patch_bytes and upgrade.delta.chain_length with { channel }; unavailable results set delta.result: "unavailable" and span status code 1.delta.from_version, delta.to_version, and delta.channel; the code logs Delta upgrade failed (${message}), falling back to full download, sets span status code 2, sets delta.result: "error" plus delta.error, and returns null so the full download can proceed.CLI_VERSION to the target, requires chain.steps, rechecks cancellation, and saves the chain and steps to the patch cache. prefetchNightlyPatches() uses nightlySource() and prefetchStablePatches() uses stableSource().packages/cli/test/lib/version-check.test.ts, packages/cli/test/lib/upgrade.test.ts, packages/cli/test/lib/scan/binary.test.ts, packages/cli/test/lib/scan/binary.property.test.ts, packages/cli/test/lib/release-notes.test.ts, packages/cli/test/lib/release-notes.property.test.ts, packages/cli/test/lib/ghcr.test.ts, packages/cli/test/lib/delta-upgrade.test.ts, packages/cli/test/lib/delta-upgrade.mocked.test.ts, packages/cli/test/lib/binary.test.ts, packages/cli/test/lib/binary.mocked.test.ts, packages/cli/test/commands/cli/upgrade.test.ts, and packages/cli/test/e2e/delta-upgrade.test.ts.packages/cli/src/lib/version-check.ts, packages/cli/src/lib/upgrade.ts, packages/cli/src/lib/scan/binary.ts, packages/cli/src/lib/release-notes.ts, packages/cli/src/lib/ghcr.ts, packages/cli/src/lib/delta-upgrade.ts, packages/cli/src/lib/binary.ts, packages/cli/src/lib/db/version-check.ts, and packages/cli/src/commands/cli/upgrade.ts.packages/cli/src/lib/upgrade.ts defines OfflineMode = false | "explicit" | "network-fallback", NIGHTLY_TAG = "nightly", NPM_REGISTRY_URL = "https://registry.npmjs.org/sentry", and VERSION_PREFIX_REGEX = /^v/.packages/cli/src/lib/upgrade.ts uses VERIFY_MAX_ATTEMPTS = 6 and VERIFY_BASE_DELAY_MS = 100.