Skip to content

Commit 709cd50

Browse files
committed
fix: address review comments — case normalization, nightly versionExists, install script, cleanup
- resolveChannelAndVersion: normalize positional to lowercase so 'Nightly' and 'STABLE' are treated as channel selectors (Seer MEDIUM) - resolveTargetVersion: use GitHub (curl) for versionExists lookup when channel is nightly, since nightly builds are not published to npm (Seer HIGH) - migrateToStandaloneForNightly: remove redundant setInstallInfo call — the child 'setup --install' process already records install info (BugBot LOW) - install script: print 'Downloading sentry nightly...' instead of 'Downloading sentry vnightly...' when version is 'nightly' (BugBot LOW) - install script: update stale comment about nightly version string
1 parent 01bccc6 commit 709cd50

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

install

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ fi
8484
# Resolve version and download tag.
8585
#
8686
# "nightly" is a special value that installs from the rolling nightly prerelease
87-
# built from the main branch. In this case:
88-
# - `version` holds the human-readable version string (e.g. "0.12.0-dev.1740393600")
89-
# - `download_tag` holds the GitHub release tag to download from ("nightly")
87+
# built from the main branch. In this case both `version` and `download_tag`
88+
# are set to the literal string "nightly".
9089
#
9190
# For stable releases both are the same version string (e.g. "0.5.0").
9291
channel="stable"
@@ -122,7 +121,13 @@ tmp_binary="${tmpdir}/sentry-install-$$${suffix}"
122121
# Clean up temp binary on failure (setup handles cleanup on success)
123122
trap 'rm -f "$tmp_binary"' EXIT
124123

125-
echo -e "${MUTED}Downloading sentry v${version}...${NC}"
124+
# For nightly the version string is literally "nightly", not a semver, so
125+
# skip the "v" prefix that's only meaningful for numbered releases.
126+
if [[ "$version" == "nightly" ]]; then
127+
echo -e "${MUTED}Downloading sentry nightly...${NC}"
128+
else
129+
echo -e "${MUTED}Downloading sentry v${version}...${NC}"
130+
fi
126131

127132
# Try gzip-compressed download first (~60% smaller, ~37 MB vs ~99 MB).
128133
# gunzip is POSIX and available on all Unix systems.

src/commands/cli/upgrade.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type { SentryContext } from "../../context.js";
2020
import { determineInstallDir, releaseLock } from "../../lib/binary.js";
2121
import { buildCommand } from "../../lib/command.js";
2222
import { CLI_VERSION } from "../../lib/constants.js";
23-
import { setInstallInfo } from "../../lib/db/install-info.js";
2423
import {
2524
getReleaseChannel,
2625
type ReleaseChannel,
@@ -61,10 +60,11 @@ function resolveChannelAndVersion(positional: string | undefined): {
6160
versionArg: string | undefined;
6261
} {
6362
// "nightly" and "stable" as positional args select the channel rather than
64-
// installing a specific version.
65-
if (positional === "nightly" || positional === "stable") {
63+
// installing a specific version. Match case-insensitively for convenience.
64+
const lower = positional?.toLowerCase();
65+
if (lower === "nightly" || lower === "stable") {
6666
return {
67-
channel: positional,
67+
channel: lower,
6868
versionArg: undefined,
6969
};
7070
}
@@ -113,9 +113,12 @@ async function resolveTargetVersion(
113113
return null;
114114
}
115115

116-
// Validate that a specific pinned version actually exists on GitHub/npm
116+
// Validate that a specific pinned version actually exists.
117+
// Nightly builds are GitHub-only, so always use curl (GitHub) lookup for
118+
// nightly channel regardless of the current install method.
117119
if (versionArg && !CHANNEL_VERSIONS.has(versionArg)) {
118-
const exists = await versionExists(method, target);
120+
const lookupMethod = channel === "nightly" ? "curl" : method;
121+
const exists = await versionExists(lookupMethod, target);
119122
if (!exists) {
120123
throw new UpgradeError(
121124
"version_not_found",
@@ -255,15 +258,9 @@ async function migrateToStandaloneForNightly(
255258
releaseLock(downloadResult.lockPath);
256259
}
257260

258-
// Update install info to reflect the new standalone method
259-
const binaryFilename = process.platform === "win32" ? "sentry.exe" : "sentry";
260-
setInstallInfo({
261-
method: "curl",
262-
path: `${installDir}/${binaryFilename}`,
263-
version: target,
264-
});
265-
266261
// Warn about the potentially shadowing old installation
262+
// Note: install info is already recorded by the child `setup --install`
263+
// process, so no redundant setInstallInfo call is needed here.
267264
const uninstallHints: Record<string, string> = {
268265
npm: "npm uninstall -g sentry",
269266
pnpm: "pnpm remove -g sentry",

0 commit comments

Comments
 (0)