Dashboard › cli › Distillation
ca662f55-285b-4895-91d5-39da7a7bfc0e["lore_tm_v1_wTnr-8Rq_ZHo1lkhJUuAKbejyYI5JcXcpjV-NjUksMQ"]
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts, lines 402–416 define describe("abortPendingVersionCheck", ...) with tests confirming abortPendingVersionCheck() does not throw when no check is pending and when called 3 times.test/lib/version-check.test.ts, lines 418–447 define describe("maybeCheckForUpdateInBackground", ...), use useTestConfigDir("test-version-bg-"), save/delete/restore process.env.SENTRY_CLI_NO_UPDATE_CHECK, replace globalThis.fetch with mockFetch(...) returning { tag_name: "v0.0.0-dev" } and HTTP 200, abort pending checks during cleanup, and call vi.restoreAllMocks().test/lib/version-check.test.ts, lines 449–454 test that maybeCheckForUpdateInBackground() does not throw even though its background network call may fail."checks for update when never checked before"; it verifies getVersionCheckInfo().lastChecked is initially null, invokes maybeCheckForUpdateInBackground(), waits 100 ms with sleep(100), and calls abortPendingVersionCheck().test/lib/version-check.test.ts, lines 471–489 test probabilistic checking after a recent check: setVersionCheckInfo("1.0.0") sets a non-null lastChecked and latestVersion to "1.0.0"; the test invokes maybeCheckForUpdateInBackground() 5 times, waits 50 ms, then aborts.test/lib/version-check.test.ts, lines 491–504 test clean abort behavior: start a background check, immediately call abortPendingVersionCheck(), wait 50 ms, verify another maybeCheckForUpdateInBackground() call does not throw, and abort again.test/lib/version-check.test.ts, lines 506–536 test "passes the Toolkit source from stable discovery to patch prefetch without legacy access": toolkitSource = UPGRADE_SOURCES[0]!; any URL containing getsentry/cli throws Unexpected legacy access; Toolkit discovery returns [{ tag_name: "cli@99.0.0", draft: false }]; deltaUpgrade.prefetchStablePatches must receive "99.0.0", expect.any(AbortSignal), and toolkitSource; the only requested URL must be https://api.github.com/repos/getsentry/toolkit/releases?per_page=100.test/lib/version-check.test.ts, lines 538–573 test "keeps stable patch prefetch on the legacy source selected after a Toolkit 404": legacySource = UPGRADE_SOURCES[1]!; https://api.github.com/repos/getsentry/toolkit/releases?per_page=100 returns HTTP 404; https://api.github.com/repos/getsentry/cli/releases/latest returns { tag_name: "v99.0.0" } with HTTP 200; deltaUpgrade.prefetchStablePatches must receive "99.0.0", expect.any(AbortSignal), and legacySource; requests must occur in that exact Toolkit-then-legacy order.test/lib/version-check.test.ts, lines 575–623 test "passes the Toolkit source from nightly discovery to patch prefetch without legacy access": it calls setReleaseChannel("nightly"), uses toolkitSource = UPGRADE_SOURCES[0]!, and throws Unexpected legacy access for URLs containing getsentry/cli.https://api.github.com/repos/getsentry/toolkit as HTTP 200 with {}, /token?scope=repository:getsentry/toolkit:pull as HTTP 200 with { token: "toolkit-token" }, and /v2/getsentry/toolkit/manifests/nightly as HTTP 200 with OCI manifest data { schemaVersion: 2, layers: [], annotations: { version: "99.0.0-dev.200" } }.deltaUpgrade.prefetchNightlyPatches to be called with "99.0.0-dev.200", expect.any(AbortSignal), and toolkitSource; the exact request sequence is https://api.github.com/repos/getsentry/toolkit, https://ghcr.io/token?scope=repository:getsentry/toolkit:pull, then https://ghcr.io/v2/getsentry/toolkit/manifests/nightly.test/lib/version-check.test.ts, lines 626–649 begin describe("opt-out behavior", ...) with test "functions are no-ops when SENTRY_CLI_NO_UPDATE_CHECK=1"; it uses spawnSync from node:child_process and join from node:path because the environment variable is checked at module-load time.getUpdateNotification and maybeCheckForUpdateInBackground from ./src/lib/version-check.js, invokes the background checker, and prints PASS only when getUpdateNotification() returns null.cwd = join(import.meta.dirname, "../.."), tries Bun first via spawnSync("which", ["bun"], ...), and is designed to fall back to node --input-type=module; module-load failures in Bun versions lacking node:sqlite are identified by a nonzero exit code with empty stdout.