Dashboard › cli › Distillation
5dbee201-78eb-4bfe-bf0f-bcadfda3d50a["lore_tm_v1_NUrg_nQ-pov6SDPu0G7eiLNJtULGvTGSIFQtIUx5ZxQ","lore_tm_v1_vbDaf1SAvlw-NesnqLRntvPEN3LQbWmXvxVoY2e7FTk","lore_tm_v1_sUJOJvhiHNIi5C22AduZ0av5Jbo2CN0oeIfzI6eFwWA","lore_tm_v1_xK_mCor_ZCk1yebisUmbaESZVxUpBg0xnyRaUbqg7v8"]
extractSha256(): it accepts case-insensitive sha256: digests and returns lowercase hex (for example, sha256:ABCDEF01 → abcdef01), while missing digests and non-SHA-256 values such as md5:deadbeef return null.getStableTargetSha256() locating the exact binary asset by name === binaryName, extracting its SHA-256 digest, and returning null when that binary asset is absent.extractStableChain() building an oldest-first upgrade sequence from newest-first GitHub releases. For 1.0.0 → 1.1.0 → 1.2.0, it returns target digest aaaa, steps [{ fromVersion: "1.0.0", toVersion: "1.1.0" }, { fromVersion: "1.1.0", toVersion: "1.2.0" }], and patch URLs in application order: 1.1.0/tool-linux-x64.patch followed by 1.2.0/tool-linux-x64.patch.{ failure: "malformed_chain" }; cumulative patch size exceeding fullGzSize * SIZE_THRESHOLD_RATIO → { failure: "over_budget" }; current/target absent, misordered, or a downgrade such as 1.2.0 → 1.0.0 → { failure: "no_patches" }; chain depth above MAX_STABLE_CHAIN_DEPTH → { failure: "too_long" }; missing target binary SHA-256 → { failure: "malformed_chain" }.filterAndSortChainTags() retaining only patch tags in (currentVersion, targetVersion], sorting them ascending in application order, and using PATCH_TAG_PREFIX to derive versions. Example: tags from patch-0.9.0 through patch-2.0.0 with bounds 1.0.0 and 1.3.0 yield exactly ["patch-1.1.0", "patch-1.2.0", "patch-1.3.0"].filterAndSortChainTags(): safeCmp() catches exceptions from an injected compareVersions() and returns 0, preventing a malformed tag such as patch-not-a-version from crashing chain resolution; well-formed tags continue through. A malformed currentVersion comparison returning 0 causes the tested result to be [].validateChainStep() requiring an exact from-version back-pointer and a layer titled exactly ${binaryName}.patch; success returns { ok: true, digest, size }, a back-pointer mismatch or missing named platform layer returns { ok: false, reason: "malformed" }, and a layer larger than sizeLimit returns { ok: false, reason: "over_budget" }.getPatchFromVersion() reads annotations["from-version"], and getPatchTargetSha256() reads annotations[\sha256-${binaryName}`]; both return null` when the annotation is absent.SourceStrategy network-failure contract requires resolution failures to return null so callers fall back to a full download reported as unavailable, rather than throwing a system error.ghcrSource.resolveChain() reporting "network" exactly once and resolving to null when the registry is unreachable.from-version but lacks the exact platform ${binaryName}.patch layer—such as containing @dep__thing@1.2.3.patch instead—it resolves to null and reports "malformed_chain".503, connection reset, or timeout must report "network", never a false malformed_chain poison alert; genuine poison is an HTTP 200 manifest rejected by validateNightlyChain().ghcrSource() fetching all chain manifests in parallel, tracking fetch failures separately, and reporting fetchFailed ? "network" : "malformed_chain" if any expected manifest is unavailable.validateNightlyChain() enforcing ordered back-pointers from the current version through every patch-* tag, a cumulative fullGzSize * SIZE_THRESHOLD_RATIO budget, final arrival at targetVersion, and a final sha256-${binaryName} annotation. It returns "malformed_chain" for broken linkage, missing entries, wrong final target, or missing final SHA-256, and "over_budget" for excess patch size.ghcrSource() reporting "no_patches" for zero in-range tags, "too_long" above MAX_NIGHTLY_CHAIN_DEPTH, and "malformed_chain" when the target manifest lacks its ${binaryName}.gz layer.ghcrSource() swallowing only BinpatchError as a network-resolution failure—reporting "network" and returning null—while rethrowing programming errors.githubReleaseSource() computing perPage = MAX_STABLE_CHAIN_DEPTH + 2, requesting ${releasesUrl}?per_page=${perPage}, and injecting Accept: "application/vnd.github.v3+json" plus the configured "User-Agent".githubReleaseSource() classifying a failed/non-OK release listing as "network", an absent target release as "no_patches", a target release missing ${binaryName}.gz as "malformed_chain", and a listed patch asset that fails to download as transient "network".githubReleaseSource() and ghcrSource() accepting an optional InstrumentHook that transparently wraps each HTTP operation and returns the inner call’s original value."ghcr-token", "fetch-target-manifest", "list-patch-tags", "fetch-chain-manifest", and "download-patch"."fetch-releases" and "download-patch".OciClient.downloadBlob() redirect downloads always carry a timeout signal. Even when called with signal=undefined, the manually followed redirect must receive a live, non-aborted AbortSignal, so a stalled Azure Blob Storage download can never hang the CLI forever.OciClient request must use its injected fetch, never the global fetch, because bypassing injection would silently break custom-CA and corporate-proxy TLS interception./token, /manifests/, and /blobs/—with exactly 3 injected fetch calls and zero global fetch calls.307 blob redirect to https://blob.example.com/obj must also use the injected fetch; the initial registry blob request and external redirect target must never leak to global fetch.OciClient defaulting to global fetch only when no custom fetch is injected.REQUEST_TIMEOUT = 10_000, MAX_RETRIES = 1, BLOB_TIMEOUT = 30_000, TAGS_PAGE_SIZE = 100, and OCI_MANIFEST_TYPE = "application/vnd.oci.image.manifest.v1+json".buildSignal(timeout, externalSignal) always creating AbortSignal.timeout(timeout) and combining it with an external signal via AbortSignal.any([timeoutSignal, externalSignal]) when supplied.fetchWithRetry() retrying timeout/abort errors and messages containing timeout, econnreset, econnrefused, network, or fetch failed; with MAX_RETRIES = 1, it permits at most 2 attempts. An externally initiated abort stops retries, and exhaustion throws BinpatchError("network_error", \${context}: ${message}`)`.OciClient.getAnonymousToken() requesting ${registry}/token?scope=repository:${repo}:pull, rejecting non-OK responses as Registry token exchange failed: HTTP ${status}, and rejecting missing tokens as Registry token exchange returned no token.OciClient.fetchManifest() requesting ${registry}/v2/${repo}/manifests/${tag} with bearer authorization, Accept: application/vnd.oci.image.manifest.v1+json, and the configured user agent; non-OK responses become BinpatchError("network_error", \Failed to fetch manifest for tag "${tag}": HTTP ${status}`)`.${registry}/v2/${repo}/tags/list?n=100, appending &last=${encodeURIComponent(lastTag)} after full pages, filtering by optional prefix, stopping on an empty page or a page shorter than 100 tags, and advancing with tags.at(-1).OciClient.downloadBlob() manually following HTTP 301, 302, 307, and 308 redirects to avoid forwarding the registry Authorization header to Azure Blob Storage. The redirected request carries only "User-Agent" plus buildSignal(BLOB_TIMEOUT, signal).Location → Registry blob redirect (${status}) had no Location header; redirect fetch failure → Failed to download from blob storage: ${message}; non-OK redirected response → Blob storage download failed: HTTP ${status}; unexpected initial status → Unexpected registry blob response: HTTP ${status}; all use BinpatchError("network_error", ...).