fix(upgrade): signal scope refresh via env var, not a version-skewed flag - #1453
Closed
betegon wants to merge 1 commit into
Closed
fix(upgrade): signal scope refresh via env var, not a version-skewed flag#1453betegon wants to merge 1 commit into
betegon wants to merge 1 commit into
Conversation
…flag `cli upgrade` spawns the *target* binary's `cli setup` and appended `--ensure-auth-scopes` to its args. That flag is brand new (#1373, merged to main but unreleased), so any target that predates it — a downgrade, or a nightly upgrading to the current stable (0.42.2) — hits a strict argument parser that aborts on the unknown flag, failing the whole upgrade with "No flag registered for --ensure-auth-scopes" / exit 252. This already breaks every nightly user trying to move to stable, and will break any downgrade once 0.43.0 ships. Route the intent through the `SENTRY_ENSURE_AUTH_SCOPES` env var instead (same channel already used for `SENTRY_INSTALL_DIR`). An unknown env var is silently ignored by older binaries, whereas an unknown flag is fatal, so the upgrade path is now robust across arbitrary version skew in both directions. `cli setup` honors the env var and still accepts the legacy `--ensure-auth-scopes` flag, so already-deployed pre-fix binaries that pass the flag don't fail their parse when upgrading to a fixed binary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cli upgradespawns the target binary'scli setupand appended--ensure-auth-scopesto its args (added in #1373, first shipped in 0.43.0). When the target binary predates that flag, its strict argument parser aborts on the unknown flag and the whole upgrade fails:Blast radius (with 0.43.0 now on stable)
≤0.42.2runs anupgradethat never passes the flag, so0.42.x → 0.43.0works. This is the mass path.0.43.0runningsentry cli upgrade 0.42.x(rollback, pinned old version, CI clamped to an old release) passes the flag to a≤0.42.2setup, which rejects it → exit 252. The binary is not corrupted (parse fails before placement), but the upgrade aborts.Reproduced:
Fix
Route the intent through the
SENTRY_ENSURE_AUTH_SCOPESenv var instead of a CLI flag (same channel already used forSENTRY_INSTALL_DIR). An unknown env var is silently ignored by older binaries; an unknown flag is fatal. This makes the upgrade path robust across arbitrary version skew in both directions — not just this one flag. A comment documents that any future setup signal not guaranteed to exist in every upgradeable-from/-to version must travel the same way.cli setuphonors the env var and still accepts the legacy--ensure-auth-scopesflag (hidden), so already-deployed pre-fix binaries that pass the flag don't fail their parse when upgrading to a fixed binary.Test plan
pnpm exec tsc --noEmit— cleanpnpm exec vitest run test/commands/cli/upgrade.test.ts test/commands/cli/setup.test.ts— 66/66 pass (assertions now check the env var; added coverage for the env-var trigger and the legacy-flag path)pnpm exec biome checkon changed files — clean🤖 Generated with Claude Code