Dashboard › cli › Distillation
12282745-c75c-44c2-9294-6cc660571734["lore_tm_v1_BWZ51gJ4tZLklSc59yyN5nFELRojSz4yi63Jz7ysvBE","lore_tm_v1_5khGeY7qVP4wGgLqXTIH223hHAqKaWNSZ2O_LHYAmWE","lore_tm_v1_ezBxSLTyhwfZtpE_LKuAOcE4MgeBWjymJ4GXy_LRekU","lore_tm_v1_xEoqGLYnlqDFJTmGy_27RXR5NXwhnZ3FH4QfsD6bhVg","lore_tm_v1_v-Sj2UCXNXEPGrZVLlt4kP-Ci7LZVvqgRsGuuXBE6fQ"]
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/packages/cli/src/lib/delta-upgrade.ts lines 1–614 of 615.src/lib/delta-upgrade.ts integrates binpatch using applyPatchChainInMemory, extractStableChain, filterAndSortChainTags, validateChainStep, resolveAndApply, githubReleaseSource, ghcrSource, OciClient, makeCache, MAX_NIGHTLY_CHAIN_DEPTH, PATCH_TAG_PREFIX, and SIZE_THRESHOLD_RATIO.DeltaResult contains sha256: string, patchBytes: number, and chainLength: number.patch-chain:${fromVersion}-${toVersion}; getPatchCache() creates an instrumented cache at join(getConfigDir(), "patch-cache").instrumentCache() traces loads as cache.get and saves as cache.put; it records cache.key, cache.hit, and cache.item_size, while delegating cleanup() and clear() to the underlying PatchCache.stableSource() uses githubReleaseSource() with releasesUrl: GITHUB_RELEASES_URL, binaryName: getPlatformBinaryName(), userAgent: sentry-cli/${CLI_VERSION}, fetch: customFetch, and the tracing instrument hook.nightlySource() uses ghcrSource() with registry https://ghcr.io, repo GHCR_REPO, binaryName: getPlatformBinaryName(), target tags nightly-${version}, compareVersions, customFetch, and the same Sentry tracing hook.canAttemptDelta(targetVersion) rejects development builds where CLI_VERSION === "0.0.0-dev", rejects stable↔nightly channel crossings, and otherwise permits only non-downgrades.fetchRecentReleases(signal?) requests ${GITHUB_RELEASES_URL}?per_page=12 with GitHub API accept and User-Agent headers; it returns [] on non-OK responses, non-array JSON, or exceptions and logs debug details for malformed data or fetch failures.downloadStablePatch(url, signal?) fully buffers a successful response into Uint8Array; it returns null on a non-OK response or exception and logs download failures at debug level.extractStableChain(opts) adapts binpatchExtractStableChain(opts) by returning null when the binpatch result contains "failure".filterAndSortChainTags(allTags, currentVersion, targetVersion) delegates to binpatchFilterAndSortChainTags() with the local compareVersions.validateChainStep() preserves three detailed failure reasons: version-mismatch with expected/actual versions, missing-layer with layerName, and size-exceeded with layerSize and budget; this intentionally retains richer telemetry than binpatch’s coarser "malformed" | "over_budget" classification.resolveStableChain(currentVersion, targetVersion, signal?) delegates to stableSource().resolveChain(...).resolveNightlyChain() lists tags with PATCH_TAG_PREFIX unless preloadedTags are provided, filters/sorts the chain, and returns null if the chain is empty or exceeds MAX_NIGHTLY_CHAIN_DEPTH.resolveNightlyChain() fetches all manifests concurrently with Promise.all; any manifest-fetch failure returns null.${getPlatformBinaryName()}.patch; each step’s remaining size budget is opts.fullGzSize * SIZE_THRESHOLD_RATIO - totalSize.resolveNightlyChain() records telemetry_reason on the active Sentry span and returns null.resolveNightlyChain() derives each destination version by stripping PATCH_TAG_PREFIX, requires the final version to equal opts.targetVersion, and obtains expectedSha256 from the final manifest via getPatchTargetSha256(manifest, binaryName); missing/mismatched final data is classified as version-mismatch.client.downloadBlobBuffer(opts.token, digest, opts.signal) and converted to Uint8Array; the resulting PatchChain recomputes totalSize from downloaded byte lengths.applyPatchChain() traces an apply-patches / upgrade.delta.apply span, records patches.count and patches.total_bytes, applies all patches in memory, and throws an exact SHA-256 mismatch error if the generated hash differs from chain.expectedSha256.makeProgressHandler() labels apply events as Applying patch(es) and other byte phases as Processing patch(es); it converts cumulative event.written values into deltas and calls progress.done() on a "done" event._source.current capture and Sentry attribute delta.source; "offline_miss" is explicitly recorded as a source, and unavailable reasons are stored as telemetry_reason.resolveDelta() calls binpatch resolveAndApply() with CLI_VERSION, target/current paths, the instrumented patch cache, offline mode, progress reporting, and telemetry; it returns both the delta result and captured source.resolveStableDelta() and resolveNightlyDelta() preserve their existing public APIs while selecting stableSource() and nightlySource() respectively.attemptDeltaUpgrade() never attempts an ineligible delta; eligible attempts use channel "nightly" when the target contains a nightly version marker and "stable" otherwise.attemptDeltaUpgrade() traces upgrade.delta, records delta.from_version, delta.to_version, delta.patch_bytes, and delta.chain_length, and emits Sentry distributions upgrade.delta.patch_bytes and upgrade.delta.chain_length with a channel attribute on success.delta.result = "unavailable" and a successful/unavailable resolution sets span status code 1.delta.from_version, delta.to_version, and delta.channel; the code logs Delta upgrade failed (...), falling back to full download, sets span status code 2, records delta.result = "error" and delta.error, and returns null.attemptDeltaUpgrade() intends to preserve delta.source on the error span through telemetry’s captured source; however, chainSource is assigned only after await resolveDelta(...) completes, so a rejection during resolveAndApply() may prevent that assignment despite the comment’s stated intent.chain.steps, rechecks abortion, and saves the chain to the patch cache; prefetchNightlyPatches() and prefetchStablePatches() select their respective sources./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/packages/cli/src/lib/version-check.ts lines 1–390 of 393.CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000, NOTIFICATION_INTERVAL_MS = 24 * 60 * 60 * 1000, and JITTER_FACTOR = 0.2.shouldCheckForUpdate() checks immediately when lastChecked === null; otherwise it applies ±20% jitter and probability 1 - Math.exp(-elapsed / effectiveInterval), documented as approximately 0% at 0 intervals, 63% at 1 interval, and 86% at 2 intervals."upgrade", "--version", "-V", "--json", "token", and "init"; management subcommands "setup" and "fix" are suppressed only when args[0] === "cli".abortPendingVersionCheck() aborts pendingAbortController if present and then sets it to null.maybePrefetchPatches(channel, latestVersion, signal) only prefetches when semverCompare(latestVersion, CLI_VERSION) === 1; it uses nightly or stable prefetch according to channel, silently catches prefetch errors, and then best-effort calls cleanupPatchCache().checkForUpdateInBackgroundImpl() catches database failures from shouldCheckForUpdate(), reports them with Sentry.captureException(), and returns without crashing the CLI.AbortController, selects fetchLatestNightlyVersion(signal) for nightly or fetchLatestFromGitHub(signal) for stable, persists the result with setVersionCheckInfo(latestVersion), and awaits patch prefetch/cleanup."version-check" with op "version.check" and forceTransaction: true; success uses status code 1, failure uses status code 2, and finally clears pendingAbortController and ends the span.AbortError failures during background checking are not reported; other failures are recorded as span attributes version_check.error and version_check.error_type rather than captureException, to keep transient GitHub rate-limit/CDN issues out of the Sentry Issues feed.process.stderr.isTTY; non-TTY contexts including scripts, CI logs, pipes, and editor-captured output return no notification.getUpdateNotificationWithCopy() gates notifications in order: 1. stderr must be a TTY, 2. notifiedThisProcess must be false, 3. cached latestVersion must exist and be newer than CLI_VERSION, and 4. at least 24 hours must have elapsed since lastNotified, except that null permits a first-ever notification.markUpdateNotified() persists last_notified = now; persistence errors are captured to Sentry but do not suppress the banner, and notifiedThisProcess is then set to true.Sentry.captureException() and cause getUpdateNotificationWithCopy() to return null.version-check.ts still comments that semver comparison uses “Bun's native semver comparison (polyfilled for Node.js),” while the implementation imports compare as semverCompare from semver, indicating stale Bun-era documentation."New nightly available:" for nightly or "Update available:" for stable, shows ${CLI_VERSION} -> ${latestVersion}, and instructs the user to run "sentry cli upgrade"."A new version of sentry-cli is available", "Upgrading may resolve this — we fix a lot of bugs in every release.", and instructs the user to run "sentry cli upgrade".resetUpdateNotificationState() sets notifiedThisProcess = false; it is an internal test helper and is not intended for production code.SENTRY_CLI_NO_UPDATE_CHECK === "1"; both background checking and notification retrieval honor this gate.getErrorUpdateNotification(error, args) suppresses configured commands first; user errors receive the standard neutral banner, while non-user errors receive the contextual upgrade suggestion, subject to the same TTY, rate-limit, disabled, and once-per-process gates./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/packages/cli/src/lib/release-notes.ts lines 540–739.CHANGELOG_MAX_RELEASES = 30, compared with delta upgrade’s 12-release cap; comments state 30 covers approximately 6+ months of weekly releases and remains below GitHub’s per_page=100 maximum.fetchReleasesForChangelog() requests ${GITHUB_RELEASES_URL}?per_page=${CHANGELOG_MAX_RELEASES}, returning [] on fetch failure, non-OK status, JSON parse failure, or non-array JSON, with debug logging for relevant failures.fetchStableChangelog() accepts optional prefetchedReleases to avoid a duplicate GitHub request; otherwise it fetches up to 30 releases and returns null when none are available.X.Y.Z-dev.<unix-seconds> and query the GitHub Commits API against sha=main.since is inclusive and until is exclusive: the current version’s commit is excluded and the target version’s commit is included.https://api.github.com/repos/getsentry/cli/commits?sha=main&since=${sinceDate}&until=${untilDate}&per_page=100.fetchNightlyChangelog() returns null for invalid nightly timestamps, fetch failure, non-OK status, JSON parse failure, a non-array response, or an empty commit array; successful data is passed to buildNightlyChangelogSummary().FetchChangelogOptions contains channel: "stable" | "nightly", fromVersion, toVersion, optional maxItems, and optional stable-only prefetchedReleases.fetchChangelog() dispatches by channel, is designed to run in parallel with binary download for zero added latency, and catches all failures to log "Changelog fetch failed:" and return null./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/packages/cli/src/commands/cli/upgrade.ts lines 130–349 of 945.resolveOfflineTarget(versionArg) strips VERSION_PREFIX_REGEX from an explicit version; without one, it reads cached latestVersion and throws UpgradeError("network_error", "No cached version available. Run any command to trigger a background version check, then retry.") if absent.resolveTargetWithFallback() returns either { kind: "target", target, offline } or { kind: "done", result }, where offline mode is false, "explicit", or "network-fallback".sentry cli upgrade with network access.persistChannelFn() because persisting a channel change clears the version cache.UpgradeError with reason "network_error"; if a cached target also cannot be resolved, the original network error is rethrown.validateMethod() rejects "unknown" installation methods, rejects pinned stable versions for Homebrew with guidance to run brew upgrade getsentry/tools/sentry, and rejects --offline for every method except "curl".resolveTargetVersion() always calls fetchLatestVersion(method, channel), even when versionArg is present, then selects the stripped pinned version or the fetched latest version.buildCheckResult(...); an already-targeted version returns structured action "up-to-date" unless flags.force is true or the release channel changed.CHANNEL_VERSIONS, resolveTargetVersion() uses lookup method "curl" on nightly and the actual installation method on stable; a failed lookup throws UpgradeError("version_not_found", \Version ${target} not found`)`.