Dashboard › cli › Session 1BJRKiSnptQl
1BJRKiSnptQlYsorAWork in /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade. Implement ONLY packages/cli/src/lib/delta-upgrade.ts and packages/cli/test/lib/delta-upgrade.test.ts (or its exact existing corresponding test file) for getsentry/cli#1244. Do write code. Thread an explicit UpgradeSource through stable and nightly delta source construction, attemptDeltaUpgrade, and stable/nightly prefetch so a selected upgrade operation never mixes getsentry/toolkit and getsentry/cli. Use source.githubRepo for GitHub release APIs and source.ghcrRepo for GHCR. Defaults may remain PRIMARY_UPGRADE_SOURCE for direct helper compatibility, but production callers must be able to pass explicit source. Preserve binpatch semantics, patch metadata (sha256-<binary>, from-version), chain limits, telemetry, in-memory patching, and fallback behavior. Add focused deterministic tests proving exact repository URLs/repo arguments and source affinity, including legacy source. Do not edit upgrade.ts, command files, binary.ts, ghcr.ts, version-check.ts, release-notes.ts, installer, or unrelated files. Run focused tests and report changed files and exact test results.
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade</path> <type>directory</type> <entries> .craft.yml .git .github/ .gitignore .lore.md .nojekyll .npmrc AGENTS.md apps/ CHANGELOG.md codemods/ LICENSE.md node_modules/ package.json packages/ pnpm-lock.yaml pnpm-workspace.yaml README.md (18 entries) </entries>
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/AGENTS.md</path> <type>file</type> <content> 1: # Jared (Outpost agent) 2: 3: Autonomous GitHub coding agent. Work in `/workspace/repo`. 4: 5: ## Model tiers 6: 7: The primary model is chosen per event (see `src/agents/models.ts`): heavy for 8: code-producing situations, cheaper for lightweight ones. 9: 10: | Role | Subagent | Model | 11: | --- | --- | --- | 12: | Triage / plan / review (heavy) | (primary Jared) | Claude Opus 4.8 | 13: | Triage / plan / review (light) | (primary Jared) | xAI Grok 4.3 | 14: | Explore | `explore` | OpenAI gpt-5-mini | 15: | Implement | `implement` | Moonshot kimi-k2.7-code | 16: | Ship (commit/push/PR) | `ship` | xAI Grok (`grok-build-0.1`) | 17: 18: Pipeline: triage → explore → plan → implement → review → ship. 19: (`worker` is a deprecated alias of `implement`.) 20: 21: Operators also talk to Jared directly from the Outpost dashboard. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
1: /** Delta upgrade discovery and application backed by binpatch. */
2:
3: import { join } from "node:path";
4: // biome-ignore lint/performance/noNamespaceImport: Sentry SDK recommends namespace import
5: import * as Sentry from "@sentry/node-core/light";
6: import {
7: applyPatchChainInMemory,
8: extractStableChain as binpatchExtractStableChain,
9: filterAndSortChainTags as binpatchFilterAndSortChainTags,
10: validateChainStep as binpatchValidateChainStep,
11: type DeltaTelemetry,
12: type DeltaUnavailableReason,
13: type ExtractStableChainOpts,
14: type GitHubRelease,
15: getPatchFromVersion,
16: getPatchTargetSha256,
17: ghcrSource,
18: githubReleaseSource,
19: type InstrumentHook,
20: MAX_NIGHTLY_CHAIN_DEPTH,
21: makeCache,
22: OciClient,
23: type OciManifest,
24: ...
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.mocked.test.ts /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/e2e/delta-upgrade.test.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts</path>
<type>file</type>
<content>
1: /**
2: * Unit Tests for Delta Upgrade Module
3: *
4: * Tests the exported pure-computation functions that drive chain resolution
5: * for both stable (GitHub Releases) and nightly (GHCR) channels, plus
6: * async orchestration functions tested via fetch mocking.
7: */
8:
9: import { createHash } from "node:crypto";
10: import { existsSync, unlinkSync } from "node:fs";
11: import { access, readFile } from "node:fs/promises";
12: import { tmpdir } from "node:os";
13: import { join } from "node:path";
14: import { afterEach, beforeEach, describe, expect, test } from "vitest";
15: import { getPlatformBinaryName } from "../../src/lib/binary.js";
16: import {
17: applyPatchChain,
18: attemptDeltaUpgrade,
19: canAttemptDelta,
20: downloadStablePatch,
21: type ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts</path>
<type>file</type>
<content>
1620:
1621: // resolveStableDelta (high-level orchestrator)
1622: // CLI_VERSION is "0.0.0-dev" in test mode, so chain resolution returns null.
1623: // This still exercises the function entry, chain check, and null-return path.
1624:
1625: describe("resolveStableDelta", () => {
1626: test("returns null when current version is dev", async () => {
1627: // Mock fetch to return releases (won't match "0.0.0-dev")
1628: mockFetch(
1629: async () =>
1630: new Response(
1631: JSON.stringify([
1632: makeRelease("0.14.0", [
1633: makeAsset({ name: "sentry-linux-x64.patch" }),
1634: ]),
1635: ]),
1636: { status: 200 }
1637: )
1638: );
1639:
1640: const result = await resolveStableDelta(
1641: ...
Found 40 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts:
Line 106: export type UpgradeSource = {
Line 108: readonly githubRepo: string;
Line 110: readonly ghcrRepo: string;
Line 116: export const UPGRADE_SOURCES: readonly UpgradeSource[] = [
Line 118: githubRepo: "getsentry/toolkit",
Line 119: ghcrRepo: "getsentry/toolkit",
Line 123: githubRepo: "getsentry/cli",
Line 124: ghcrRepo: "getsentry/cli",
Line 130: export const PRIMARY_UPGRADE_SOURCE = UPGRADE_SOURCES[0];
Line 236: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 239: return `https://github.com/${source.githubRepo}/releases/download/${tag}/${getPlatformBinaryName()}`;
Line 244: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 246: return `https://api.github.com/repos/${source.githubRepo}/releases`;
Line 252: source: UpgradeSource = ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts</path>
<type>file</type>
<content>
90: *
91: * Defined here (alongside other installation constants like
92: * {@link KNOWN_CURL_DIRS}) so that both `upgrade.ts` and
93: * `db/install-info.ts` can import it without creating a circular
94: * dependency.
95: */
96: export type InstallationMethod =
97: | "curl"
98: | "brew"
99: | "npm"
100: | "pnpm"
101: | "bun"
102: | "yarn"
103: | "unknown";
104:
105: /** A repository pair that hosts CLI stable releases and nightly OCI images. */
106: export type UpgradeSource = {
107: /** GitHub `owner/repository` containing CLI release assets. */
108: readonly githubRepo: string;
109: /** GHCR `owner/package` containing CLI nightly images and delta patches. */
110: readonly ghcrRepo: string;
111: /** Prefix attached to CLI release tags in this repository. ...
Found 46 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts:
Line 834: const result = await fetchRecentReleases();
Line 842: const result = await fetchRecentReleases();
Line 851: const result = await fetchRecentReleases();
Line 947: const chain = await resolveStableChain("0.13.0", "0.14.0");
Line 1000: const chain = await resolveStableChain("0.13.0", "0.15.0");
Line 1018: const chain = await resolveStableChain("0.12.0", "0.14.0");
Line 1025: const chain = await resolveStableChain("0.12.0", "0.13.0");
Line 1050: const chain = await resolveStableChain("0.13.0", "0.14.0");
Line 1073: const chain = await resolveStableChain("0.1.0", "0.15.0");
Line 1169: const chain = await resolveNightlyChain({
Line 1187: const chain = await resolveNightlyChain({
Line 1206: const chain = await resolveNightlyChain({
...
M packages/cli/src/lib/binary.ts M packages/cli/src/lib/ghcr.ts M packages/cli/test/lib/binary.test.ts M packages/cli/test/lib/ghcr.test.ts M packages/cli/test/lib/install-script.test.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "sentry",
3: "version": "0.45.0-dev.0",
4: "description": "Sentry CLI - A command-line interface for using Sentry built by robots and humans for robots and humans",
5: "repository": {
6: "type": "git",
7: "url": "git+https://github.com/getsentry/cli.git"
8: },
9: "main": "./dist/index.cjs",
10: "type": "module",
11: "types": "./dist/index.d.cts",
12: "exports": {
13: ".": {
14: "import": {
15: "types": "./dist/index.d.mts",
16: "default": "./dist/index.mjs"
17: },
18: "require": {
19: "types": "./dist/index.d.cts",
20: "default": "./dist/index.cjs"
21: }
22: }
23: },
24: "bin": {
25: "sentry": "./dist/bin.cjs"
26: },
27: "files": [
28: "dist/bin.cjs",
29: "dist/index.cjs",
30: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
940: );
941: } else {
942: log.debug("Downloading full binary");
943: await downloadFullBinary(version, downloadTag, tempPath, setMessage);
944: }
945:
946: // Verify the download produced a real, non-empty file before the caller
947: // spawns it. Seen on Windows + Bun 1.3.9 (CLI-1D3): streaming writes via
948: // `Bun.file(path).writer()` can return without surfacing the file by
949: // path, leaving `Bun.spawn` to fail with an opaque
950: // `Executable not found in $PATH: "...sentry.exe.download"`. Poll with
951: // exponential backoff so a transient filesystem-visibility race
952: // self-heals without asking the user to rerun.
953: const verifiedSize = await waitForBinaryVisible(tempPath);
954: log.debug(`Binary verified ...
Found 5 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/constants.ts:
Line 8: declare const SENTRY_CLI_VERSION: string | undefined;
Line 79: export const CLI_VERSION =
Line 80: typeof SENTRY_CLI_VERSION !== "undefined" ? SENTRY_CLI_VERSION : "0.0.0-dev";
Line 94: export function getCliEnvironment(version: string = CLI_VERSION): string {
Line 116: return `sentry-cli/${CLI_VERSION} (${process.platform}-${process.arch}) ${runtime}`;
Found 100 matches (more matches available)
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts:
Line 106: vi.mock("node:child_process", async (importOriginal) => {
Line 107: const orig = await importOriginal<typeof import("node:child_process")>();
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/timezone.mocked.test.ts:
Line 23: vi.mock("node:fs", async (importOriginal) => {
Line 24: const actual = await importOriginal<typeof import("node:fs")>();
Line 60: vi.mock("node:child_process", async (importOriginal) => {
Line 61: const actual = await importOriginal<typeof import("node:child_process")>();
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/commands/trial/start.test.ts:
Line 12: ...
No files found
No files found
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch</path> <type>directory</type> <entries> dist/ LICENSE package.json README.md (4 entries) </entries>
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.d.ts /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js.map /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js
Found 33 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js:
Line 492: function walkChainSteps(stepMap, currentVersion, targetVersion) {
Line 495: while (version !== targetVersion) {
Line 504: async function loadCachedChain(cacheDir, currentVersion, targetVersion) {
Line 508: const steps = walkChainSteps(stepMap, currentVersion, targetVersion);
Line 512: if (meta.toVersion === targetVersion && meta.expectedSha256) {
Line 613: load: (currentVersion, targetVersion) => loadCachedChain(cacheDir, currentVersion, targetVersion),
Line 658: targetVersion,
Line 672: targetVersion
Line 690: targetVersion,
Line 705: async function tryLoadCachedChain(cache, currentVersion, targetVersion) {
Line 707: return await cache.load(currentVersion, targetVersion);
Line 962: function filterAndSortChainTags(allTags, currentVersion, ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.d.ts</path>
<type>file</type>
<content>
330: * published yet" from a `malformed_chain` (a published-but-broken manifest in
331: * the range), so a poisoned publish can be alerted on immediately instead of
332: * silently degrading every spanning upgrade to a full download.
333: */
334: type SourceStrategy = {
335: resolveChain(currentVersion: string, targetVersion: string, signal?: AbortSignal, report?: UnavailableReporter): Promise<PatchChain | null>;
336: };
337: /** Where a resolved chain came from, for telemetry. */
338: type DeltaSource = "cache" | "network" | "offline_miss";
339: /**
340: * Why a source could not produce a usable chain (telemetry only).
341: *
342: * - `no_patches` — no patch tags/assets exist in the range (benign: the
343: * channel simply has no deltas published for this hop yet). ...
diff --git a/packages/cli/src/lib/binary.ts b/packages/cli/src/lib/binary.ts
index 75582612a..bebf1da0c 100644
--- a/packages/cli/src/lib/binary.ts
+++ b/packages/cli/src/lib/binary.ts
@@ -102,6 +102,33 @@ export type InstallationMethod =
| "yarn"
| "unknown";
+/** A repository pair that hosts CLI stable releases and nightly OCI images. */
+export type UpgradeSource = {
+ /** GitHub `owner/repository` containing CLI release assets. */
+ readonly githubRepo: string;
+ /** GHCR `owner/package` containing CLI nightly images and delta patches. */
+ readonly ghcrRepo: string;
+ /** Prefix attached to CLI release tags in this repository. */
+ readonly tagPrefix: string;
+};
+
+/** Ordered CLI release sources. The resolver falls through only on HTTP 404. ...
Found 13 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/binary.test.ts:
Line 38: UPGRADE_SOURCES,
Line 48: "https://github.com/getsentry/toolkit/releases/download/"
Line 67: describe("UPGRADE_SOURCES", () => {
Line 69: expect(UPGRADE_SOURCES).toEqual([
Line 71: githubRepo: "getsentry/toolkit",
Line 72: ghcrRepo: "getsentry/toolkit",
Line 99: source: UPGRADE_SOURCES[0],
Line 103: "https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%400.45.0",
Line 123: expect(resolved.source).toBe(UPGRADE_SOURCES[1]);
Line 125: "https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%400.45.0",
Line 146: "https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%400.45.0",
Line 165: "https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%400.45.0",
Line 183: ...
Found 1 matches /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/helpers.ts: Line 104: export function useTestConfigDir(
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/helpers.ts</path>
<type>file</type>
<content>
85: export function mockFetch(fn: FetchMockFn): typeof fetch {
86: return fn as unknown as typeof fetch;
87: }
88:
89: /**
90: * Sets up an isolated test config directory with proper env var lifecycle.
91: *
92: * Registers beforeEach/afterEach hooks that create a unique config directory,
93: * point SENTRY_CONFIG_DIR at it, and restore the original value on teardown.
94: * This eliminates the fragile pattern of manually managing process.env in
95: * each test file, which caused cross-file pollution when afterEach hooks
96: * deleted the env var while other files were still loading.
97: *
98: * Must be called at module scope or inside a describe() block.
99: *
100: * @param prefix - Directory name prefix for the temp directory
101: * @param options - Configuration options (e.g., ...
Found 1 matches /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/custom-ca.ts: Line 305: export function customFetch(
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/custom-ca.ts</path>
<type>file</type>
<content>
295: }
296:
297: /**
298: * Drop-in replacement for `fetch()` that injects custom CA certificates
299: * when configured. All non-authenticated fetch call sites should use this
300: * instead of bare `fetch()`.
301: *
302: * Authenticated API calls go through `fetchWithTimeout()` in sentry-client.ts
303: * which already applies TLS options directly alongside the SaaS warning.
304: */
305: export function customFetch(
306: input: string | URL | Request,
307: init?: RequestInit
308: ): Promise<Response> {
309: const tlsOpts = getCustomTlsOptions();
310: if (!tlsOpts) {
311: return fetch(input, init);
312: }
313: return fetch(input, { ...init, ...tlsOpts });
314: }
315:
316: /**
317: * Reset all cached state. Exported for test isolation only. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js</path>
<type>file</type>
<content>
770: userAgent;
771: fetch;
772: constructor(config) {
773: this.registry = config.registry;
774: this.repo = config.repo;
775: this.userAgent = config.userAgent;
776: this.fetch = config.fetch ?? fetch;
777: }
778: async fetchWithRetry(url, init, context, options) {
779: const timeout = options?.timeout ?? REQUEST_TIMEOUT;
780: const externalSignal = options?.signal;
781: let lastError;
782: for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
783: try {
784: return await this.fetch(url, {
785: ...init,
786: signal: buildSignal(timeout, externalSignal)
787: });
788: } catch (error) {
789: lastError = error instanceof Error ? ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js</path>
<type>file</type>
<content>
1220: steps.push({ fromVersion: prevVersion, toVersion: release.tag_name });
1221: prevVersion = release.tag_name;
1222: }
1223: return { patchUrls, expectedSha256, steps };
1224: }
1225: function githubReleaseSource(config) {
1226: const doFetch = config.fetch ?? fetch;
1227: const { releasesUrl, binaryName, userAgent } = config;
1228: const i = (name, fn) => config.instrument ? config.instrument(name, fn) : fn();
1229: async function fetchRecentReleases(signal) {
1230: const perPage = MAX_STABLE_CHAIN_DEPTH + 2;
1231: let response;
1232: try {
1233: response = await i(
1234: "fetch-releases",
1235: () => doFetch(`${releasesUrl}?per_page=${perPage}`, {
1236: headers: {
1237: Accept: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/node_modules/binpatch/dist/index.js</path>
<type>file</type>
<content>
1125: return {
1126: patches,
1127: totalSize: downloadedSize,
1128: expectedSha256: validation.expectedSha256,
1129: steps
1130: };
1131: }
1132: return {
1133: async resolveChain(currentVersion, targetVersion, signal, report) {
1134: try {
1135: const token = await i("ghcr-token", () => client.getAnonymousToken(signal));
1136: const [targetManifest, patchTags] = await Promise.all([
1137: i(
1138: "fetch-target-manifest",
1139: () => client.fetchManifest(token, targetTag(targetVersion), signal)
1140: ),
1141: i(
1142: "list-patch-tags",
1143: () => client.listTags(token, PATCH_TAG_PREFIX, signal)
1144: )
1145: ]);
1146: const ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
❯ test/lib/delta-upgrade.test.ts (85 tests | 3 failed) 143ms
× uses the selected legacy GitHub repository 12ms
× keeps stable resolution on the selected legacy source 2ms
× keeps nightly resolution on the selected legacy source 2ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/lib/delta-upgrade.test.ts > fetchRecentReleases > uses the selected legacy GitHub repository
AssertionError: expected [ Array(1) ] to deeply equal [ Array(1) ]
- Expected
+ Received
[
- "https://api.github.com/repos/getsentry/cli/releases?per_page=12",
+ "https://api.github.com/repos/getsentry/toolkit/releases?per_page=12",
]
❯ ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
Test Files 1 passed (1)
Tests 89 passed (89)
Start at 12:36:16
Duration 3.51s (transform 2.29s, setup 86ms, import 2.74s, tests 487ms, environment 0ms)
src/lib/delta-upgrade.ts:285:23 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━
× Excessive complexity of 16 detected (max: 15).
283 │ }
284 │
> 285 │ export async function resolveNightlyChain(opts: {
│ ^^^^^^^^^^^^^^^^^^^
286 │ token: string;
287 │ currentVersion: string;
i Please refactor this function to reduce its complexity score from 16 to the max allowed complexity 15.
src/lib/delta-upgrade.ts format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Formatter would have printed the following content:
553 553 │ try {
554 554 │ const resolved = await resolveDelta(
555 │ - ··········channel·===·"nightly"
556 │ - ············?·nightlySource(source)
557 │ - ············:·stableSource(source),
555 │ + ··········channel·===·"nightly"·?·nightlySource(source)·:·stableSource(source),
558 556 │ ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts M ../toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts
Checked 2 files in 1457ms. No fixes applied.
src/lib/binary.ts(236,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(244,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(252,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(260,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(269,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/delta-upgrade.ts(155,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type ...
Found 9 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts:
Line 39: PRIMARY_UPGRADE_SOURCE,
Line 155: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 276: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 294: const { source = PRIMARY_UPGRADE_SOURCE } = opts;
Line 502: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 521: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 540: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 630: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 638: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts M ../toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts
src/lib/binary.ts(236,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(244,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(252,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(260,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(269,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/ghcr.ts(138,26): error TS18048: 'PRIMARY_UPGRADE_SOURCE' is possibly ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts</path>
<type>file</type>
<content>
210: return true;
211: }
212: }
213: return false;
214: }
215:
216: /**
217: * Abort any pending version check to allow process exit.
218: * Call this when main CLI work is complete.
219: */
220: export function abortPendingVersionCheck(): void {
221: pendingAbortController?.abort();
222: pendingAbortController = null;
223: }
224:
225: /**
226: * Pre-fetch delta patches for a newly discovered version.
227: *
228: * Best-effort: errors are silently caught so the version check still succeeds.
229: * After pre-fetching, opportunistically cleans up stale cached patches. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
972: * therefore a different lock file, so it cannot reliably release this one).
973: *
974: * If the child resolves to the same install path, it takes over the lock via
975: * process.ppid recognition in acquireLock — the parent's subsequent release
976: * is then a harmless no-op.
977: *
978: * @param version - Target version to download (used for display and comparison)
979: * @param downloadTag - Git tag to use in the download URL. Defaults to `version`.
980: * Pass `NIGHTLY_TAG` ("nightly") when installing from the rolling nightly release
981: * so the URL points to the prerelease assets regardless of the version string. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
1003: }
1004:
1005: // Try delta upgrade first — downloads tiny patches instead of full binary.
1006: // Falls back to full download on any failure (missing patches, hash mismatch, etc.)
1007: const deltaResult = await tryDeltaUpgrade(
1008: version,
1009: tempPath,
1010: !!offline,
1011: setMessage,
1012: source
1013: );
1014: let patchBytes: number | undefined;
1015: if (deltaResult) {
1016: patchBytes = deltaResult.patchBytes;
1017: } else if (offline) {
1018: throw new UpgradeError(
1019: "offline_cache_miss",
1020: offline === "explicit"
1021: ? `Cannot upgrade to ${version} in offline mode — no pre-downloaded update is available. ...
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
Test Files 1 passed (1)
Tests 89 passed (89)
Start at 12:40:05
Duration 2.72s (transform 1.77s, setup 73ms, import 2.11s, tests 359ms, environment 0ms)
Checked 2 files in 1432ms. No fixes applied.
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
[warn] [delta-upgrade] Delta upgrade failed (Patch too small: 4 bytes (need at least 32)), falling back to full download
Test Files 2 passed (2)
Tests 97 passed (97)
Start at 12:40:30
Duration 2.91s (transform 3.38s, setup 189ms, import 4.41s, tests 521ms, environment 0ms)
M packages/cli/install
M packages/cli/src/lib/binary.ts
M packages/cli/src/lib/delta-upgrade.ts
M packages/cli/src/lib/ghcr.ts
M packages/cli/src/lib/release-notes.ts
M packages/cli/src/lib/upgrade.ts
M packages/cli/src/lib/version-check.ts
M packages/cli/test/lib/binary.test.ts
M packages/cli/test/lib/delta-upgrade.test.ts
M packages/cli/test/lib/ghcr.test.ts
M packages/cli/test/lib/install-script.test.ts
M packages/cli/test/lib/release-notes.test.ts
M packages/cli/test/lib/upgrade.test.ts
M packages/cli/test/lib/version-check.test.ts
packages/cli/src/lib/delta-upgrade.ts | 81 +++++++-----
packages/cli/test/lib/delta-upgrade.test.ts | 196 +++++++++++++++++++++++++++-
2 files changed, 244 insertions(+), 33 deletions(-)
diff --git a/packages/cli/src/lib/delta-upgrade.ts b/packages/cli/src/lib/delta-upgrade.ts
index ec709b8c8..d7f2e3bfa 100644
--- a/packages/cli/src/lib/delta-upgrade.ts
+++ b/packages/cli/src/lib/delta-upgrade.ts
@@ -32,16 +32,17 @@ import {
} ...
Found 2 matches /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts: Line 580: * Uses a higher `per_page` than `fetchRecentReleases()` in delta-upgrade /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts: Line 160: export async function fetchRecentReleases(
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/delta-upgrade.test.ts
Checked 2 files in 2s. No fixes applied.
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
[warn] [delta-upgrade] Delta upgrade failed (Patch too small: 4 bytes (need at least 32)), falling back to full download
Test Files 2 passed (2)
Tests 97 passed (97)
Start at 12:42:30
Duration 2.91s (transform 3.43s, setup 122ms, import 4.47s, tests 508ms, environment 0ms)
51 30 packages/cli/src/lib/delta-upgrade.ts 170 3 packages/cli/test/lib/delta-upgrade.test.ts
Implemented source-affine delta upgrades.
Changed only:
packages/cli/src/lib/delta-upgrade.tspackages/cli/test/lib/delta-upgrade.test.tsKey changes:
UpgradeSource through stable/nightly resolution, attemptDeltaUpgrade, and prefetch.source.githubRepo; GHCR requests use source.ghcrRepo.Validation:
git diff --check: passed* 🟡 (12:42) Updated `packages/cli/test/lib/delta-upgrade.test.ts`; subsequent checks on the 2 changed files completed in 2 seconds with no fixes applied. * 🟡 (12:42) Final focused Vitest 4.1.10 run passed 97 tests across 2 test files in 2.91 seconds. It emitted the expected warning `[delta-upgrade] Delta upgrade failed (Patch too small: 4 bytes (need at least 32)), falling back to full download…
* 🟡 (12:36) Fixed selected-source propagation in `packages/cli/src/lib/delta-upgrade.ts` and updated `packages/cli/test/lib/delta-upgrade.test.ts`; focused Vitest run under Vitest 4.1.10 passed all 89 tests in 1 test file. Vitest warned that `test.poolOptions` was removed in Vitest 4 and its former options are now top-level. * 🟡 (12:37) Static checks found `resolveNightlyChain()` at `packages/c…
Date: September 9, 2026 * 🔴 (12:31) User required `resolveUpgradeSource()` to return the successful probe `Response` to the caller so the caller “never repeats the request.” * 🔴 (12:31) User required ordered upgrade-source fallback to advance only on HTTP 404; every other HTTP error or network failure must abort immediately. * 🟡 (12:31) `packages/cli/src/lib/binary.ts` added `UpgradeSource` wi…
Date: September 9, 2026 * 🟡 (12:29) `packages/cli/src/lib/constants.ts` declares `SENTRY_CLI_VERSION: string | undefined`; `CLI_VERSION` resolves to `SENTRY_CLI_VERSION` when defined and otherwise `"0.0.0-dev"`. `getCliEnvironment(version: string = CLI_VERSION)` defaults to that value, and the user-agent string includes `sentry-cli/${CLI_VERSION} (${process.platform}-${process.arch}) ${runtime}`…
Date: September 9, 2026 * 🔴 (12:27) User required `resolveUpgradeSource()` to return the successful probe `Response` so the caller never repeats the request. * 🔴 (12:27) User specified ordered upgrade-source fallback behavior: `UPGRADE_SOURCES` tries `getsentry/toolkit` first and `getsentry/cli` second, advancing only on HTTP 404. * 🟡 (12:27) `packages/cli/src/lib/binary.ts` defines `UpgradeSo…
Date: September 9, 2026 * 🔴 (12:26) User required scratch files to never be written during delta patch-chain application. * 🔴 (12:26) User required the in-memory delta patch chain to never create scratch files on disk. * 🟡 (12:26) The provided `packages/cli/test/lib/delta-upgrade.test.ts` includes coverage for resolving stable and nightly deltas, validating patch-chain steps and limits, parall…
Date: September 9, 2026 * 🔴 (12:25) User directed work in `/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade` on `getsentry/cli#1244`. * 🔴 [enforced-scope] (12:25) User required implementation ONLY in `packages/cli/src/lib/delta-upgrade.ts` and `packages/cli/test/lib/delta-upgrade.test.ts` (or its exact existing corresponding test file). * …