Dashboard › cli › Distillation
8878370a-4b87-432b-bc7e-497cbd9e795f["lore_tm_v1_piKoyJzRZPUmKui7ysmYLZ4f4PuY5MAcFvr32kf1Gx4","lore_tm_v1_jGOSs95cldyGezSUEARPkWqCvCHldbkNeu5772aVtjI","lore_tm_v1__q5SLbRh00BLn2Oi4ai8ffqP8aOl2hewO3q_MH4NI2Y"]
Date: Sep 9, 2026
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts defines mockFetch(fn) by assigning globalThis.fetch, saves the original fetch in beforeEach, and restores it in afterEach.parseInstallationMethod tests in /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts cover: valid values "curl", "brew", "npm", "pnpm", "bun", and "yarn"; case-insensitive normalization of "NPM" → "npm", "Curl" → "curl", and "YARN" → "yarn"; and rejection of "pip", "apt", and "" with exact Invalid method: ... messages.fetchLatestFromGitHub tests verify Toolkit release discovery queries https://api.github.com/repos/getsentry/toolkit/releases?per_page=100, ignores unrelated mcp@9.0.0 and invalid cli@not-a-version tags, and selects the latest valid CLI-prefixed version, 1.3.0, from cli@1.2.3 and cli@1.3.0.fetchLatestFromGitHub tests verify Toolkit-to-legacy fallback occurs only after Toolkit HTTP 404, then queries https://api.github.com/repos/getsentry/cli/releases/latest and normalizes legacy { tag_name: "v1.2.3" } to "1.2.3".fetchLatestFromGitHub tests verify: an MCP-only Toolkit response throws "No version found in GitHub release" without querying legacy; cli@v1.2.3 becomes "1.2.3"; cli@v0.5.0 becomes "0.5.0"; cli@1.0.0 remains "1.0.0"; every source returning HTTP 404 throws UpgradeError with "No CLI upgrade source was found: every source returned HTTP 404"; a TypeError("fetch failed") throws UpgradeError with "Failed to connect to GitHub: fetch failed"; and an empty release array throws "No version found in GitHub release"./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts identify resolveExistingUpgradeVersion coverage for: prefixed Toolkit tags retaining the selected source; fallback to an unprefixed legacy tag only on Toolkit HTTP 404; and no fallback from an explicitly selected source.versionExists tests verify stable versions: "brew" with "1.0.0" returns true on GitHub HTTP 200; "brew" with "99.99.99" returns false on HTTP 404; "yarn" with "1.0.0" checks npm and returns true on HTTP 200; "curl" network failure throws UpgradeError with "Failed to connect to GitHub"; and "npm" network failure throws UpgradeError with "Failed to connect to npm registry".versionExists nightly tests use versions such as "0.14.0-dev.1772661724" and "0.14.0-dev.9999999999" and verify GHCR manifest lookup regardless of installation method, including "npm": token retrieval from URLs containing ghcr.io/token, manifest retrieval from URLs containing /manifests/nightly-, HTTP 200 meaning the version exists, and HTTP 404 meaning it does not.versionExists failure tests verify: network failures throw UpgradeError; a thrown transport error whose text is Error("HTTP 404") is propagated rather than classified as a missing version; GHCR HTTP 500 throws UpgradeError; and explicit-source GHCR HTTP 403 throws "HTTP 403" after exactly 2 requests with no request URL containing getsentry/cli./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts: fallback to legacy when the Toolkit nightly manifest returns 404; no fallback after a non-404 Toolkit nightly failure; and no fallback merely because nightly transport-error text says HTTP 404.executeUpgrade("unknown", "1.0.0") tests verify it throws UpgradeError with message "Could not detect installation method" and reason === "unknown_method".detectInstallationMethod stored-info tests set process.execPath to "/usr/bin/sentry" so detection bypasses Homebrew and known curl paths; persisted install info { method: "npm", path: "/usr/bin/sentry", version: "1.0.0" } returns "npm", while the equivalent record with method: "curl" returns "curl". Tests restore process.execPath and call clearInstallInfo() afterward./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts verify process.execPath="/opt/homebrew/Cellar/sentry/1.2.3/bin/sentry" is detected as "brew" and include coverage for the Intel Homebrew /usr/local/Cellar/ path.