Dashboard › cli › Distillation
1df430c0-b4df-40b1-a07b-cdfe4eb880b2["lore_tm_v1_7NaxbCL_msjh1TgNys3It2_g9hMy4iPdWOvkM47rpzo","lore_tm_v1__5obVH9St5HBoIHqEnCmmkqfwHhl0sVyJCzt8OhH29I","lore_tm_v1_27nKPWM6eobWSsxFgfGBa8BymmiNbnoBwSjy5egu49Y"]
MaxListenersExceededWarning.UpgradeError when the file βnever becomes visible or stays empty.β Polling uses exponential backoff with 6 probes and 5 sleeps to tolerate a transient visibility race.packages/cli/src/lib/delta-upgrade.ts adopts binpatch while preserving the existing public API through wrappers/re-exports including extractSha256, getPatchFromVersion, getPatchTargetSha256, getStableTargetSha256, PATCH_TAG_PREFIX, extractStableChain(), filterAndSortChainTags(), and validateChainStep().packages/cli/src/lib/delta-upgrade.ts defines DeltaResult as { sha256: string; patchBytes: number; chainLength: number }.packages/cli/src/lib/delta-upgrade.ts imports GHCR_REPO from ./ghcr.js as the single source of truth for ghcr.io/getsentry/cli; this avoids a prior silent 404 caused by a string literal.withTracing(name, "http.client", fn) via an InstrumentHook; cache traces use withTracingSpan() with operations cache.get and cache.put, attributes cache.key, cache.hit, and cache.item_size, and cache keys formatted as patch-chain:${fromVersion}-${toVersion}.getPatchCache() creates an instrumented binpatch cache at join(getConfigDir(), "patch-cache"); instrumentCache() delegates cleanup() and clear() and skips custom save instrumentation when the supplied steps have no first or last item.githubReleaseSource() with GITHUB_RELEASES_URL, getPlatformBinaryName(), customFetch, tracing instrumentation, and user agent sentry-cli/${CLI_VERSION}.ghcrSource() with registry https://ghcr.io, repository GHCR_REPO, getPlatformBinaryName(), customFetch, tracing instrumentation, user agent sentry-cli/${CLI_VERSION}, compareVersions, and target tags formatted as nightly-${version}.canAttemptDelta(targetVersion) rejects delta upgrades when CLI_VERSION === "0.0.0-dev", when current and target versions differ between stable/nightly channels, or when isDowngrade(CLI_VERSION, targetVersion) is true.fetchRecentReleases(signal?) requests ${GITHUB_RELEASES_URL}?per_page=12 with Accept: application/vnd.github.v3+json and user agent sentry-cli/${CLI_VERSION}; it returns [] for non-OK responses, non-array JSON, or caught errors and logs debug details for malformed data/fetch failures.downloadStablePatch(url, signal?) downloads with customFetch and user agent sentry-cli/${CLI_VERSION}, returning a Uint8Array only for an OK response and otherwise returning null; caught failures are debug-logged.validateChainStep() preserves richer telemetry classifications than binpatchValidateChainStep(): version-mismatch, missing-layer, and size-exceeded, rather than binpatchβs coarser malformed or over_budget. A size failure records exact layerSize and budget; a missing-layer failure records layerName.resolveStableChain(currentVersion, targetVersion, signal?) delegates to stableSource().resolveChain(...).resolveNightlyChain() creates OciClient with registry https://ghcr.io, GHCR_REPO, customFetch, and user agent sentry-cli/${CLI_VERSION}; it uses preloadedTags when supplied, otherwise calls client.listTags(token, PATCH_TAG_PREFIX, signal).resolveNightlyChain() filters/sorts chain tags between current and target versions and returns null when there are 0 tags or more than MAX_NIGHTLY_CHAIN_DEPTH; manifests are fetched concurrently with Promise.all(), and any manifest-fetch failure makes the chain unavailable.${getPlatformBinaryName()}.patch, checks each stepβs expectedFrom, and enforces a remaining size budget of fullGzSize * SIZE_THRESHOLD_RATIO - totalSize; failed validation stamps telemetry_reason with version-mismatch, missing-layer, or size-exceeded.resolveNightlyChain() derives each destination version with tag.slice(PATCH_TAG_PREFIX.length), gathers layer digests and { fromVersion, toVersion } steps, reads the final expected SHA-256 using getPatchTargetSha256(manifest, binaryName), and returns null with telemetry_reason="version-mismatch" if the final version is wrong or expected SHA-256 is absent.client.downloadBlobBuffer(token, digest, signal), converted to Uint8Array, and returned as a PatchChain whose totalSize is recomputed from actual downloaded data.byteLength values.applyPatchChain() traces operation upgrade.delta.apply under span name apply-patches, records patches.count and patches.total_bytes, applies all patches in memory with applyPatchChainInMemory(), and throws SHA-256 mismatch after patching: got ${sha256}, expected ${chain.expectedSha256} if output verification fails.makeProgressHandler() reports byte deltas rather than cumulative bytes, resets tracking when the event phase changes, labels apply progress Applying patch(es) and other phases Processing patch(es), and calls progress?.done() on a done event._source.current so attemptDeltaUpgrade() can retain delta.source even if patch application fails after resolution. onResolved records delta.source and logs patch count/total size; onOfflineMiss records offline_miss; onUnavailable records telemetry_reason.resolveDelta() delegates discovery/application to resolveAndApply() with CLI_VERSION, target version, old/destination paths, getPatchCache(), optional offline mode, progress handling, and telemetry; it returns both the DeltaResult | null and captured source.resolveStableDelta() and resolveNightlyDelta() preserve their existing public call shapes and select stableSource() and nightlySource() respectively.attemptDeltaUpgrade() chooses channel nightly or stable, traces upgrade.delta, records delta.from_version and delta.to_version, and on success records delta.patch_bytes and delta.chain_length plus matching Sentry distributions tagged with { channel }; unavailable deltas set delta.result="unavailable" and span status code 1.attemptDeltaUpgrade() captures a warning-level Sentry exception tagged with delta.from_version, delta.to_version, and delta.channel; preserves delta.source when known; logs Delta upgrade failed (${message}), falling back to full download; sets span status code 2, delta.result="error", and delta.error; then returns null to trigger full-download fallback.canAttemptDelta(targetVersion) is false or the signal is aborted; otherwise it resolves a chain from CLI_VERSION, requires chain.steps, rechecks cancellation, and saves the chain to getPatchCache(). Public entry points are prefetchNightlyPatches() and prefetchStablePatches().