Repository navigation
feat(cli): Authenticate headless installs with setup codes - #1873
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
077228e to
fa0808c
Compare
fa0808c to
99eafe3
Compare
| import { runInteractiveLogin } from "../../lib/interactive-login.js"; | ||
| import { interactivePromptsAllowed } from "../../lib/interactive-prompts.js"; | ||
| import { logger } from "../../lib/logger.js"; | ||
| import { bootstrapAuthentication } from "../../lib/setup-code.js"; |
There was a problem hiding this comment.
A retained setup code makes later upgrades fail
If SENTRY_SETUP_CODE remains in the environment after installation, later cli setup or upgrade runs inherit it and try to redeem it again; because credentials are already stored, setup throws and the upgrade reports failure. Skip redemption when already authenticated or limit it to fresh installs.
Evidence
setup.tscallsbootstrapAuthentication()wheneverSENTRY_SETUP_CODEis set, before running configuration steps; setup exposes no--forceflag.bootstrapAuthentication()throws when stored credentials exist andforceis false, before attempting code redemption.- The upgrade path spawns
cli setupwith the inherited environment (process.envis copied when an install directory is set); a nonzero setup exit becomes anUpgradeError. - The setup test covers first-time redemption, but not a subsequent setup or upgrade with the same environment value.
Identified by Warden · code-review · Y2M-JUX
| import { runInteractiveLogin } from "../../lib/interactive-login.js"; | ||
| import { interactivePromptsAllowed } from "../../lib/interactive-prompts.js"; | ||
| import { logger } from "../../lib/logger.js"; | ||
| import { bootstrapAuthentication } from "../../lib/setup-code.js"; |
There was a problem hiding this comment.
Setup-code login never warms org/completion caches
Redeeming SENTRY_SETUP_CODE stores credentials but never calls warmCachesAfterLogin, and the later warmAttributeCompletions no-ops with an empty org-region cache, unlike the interactive fresh-install login path.
Evidence
- After setup-code auth succeeds, setup only
emits success; it does not callwarmCachesAfterLogin(). Boolean(getEnv().SENTRY_SETUP_CODE)then returns before the interactive login branch that would callwarmCachesAfterLogin().- The later
warmAttributeCompletions()usespickWarmupOrgs()→getAllOrgRegions(), which is empty untillistOrganizationsUncached()runs; with no orgs it returns immediately. completion-warmup.tsdocuments that fresh-install login is supposed to warm orgs then attribute keys viawarmCachesAfterLogin.
Identified by Warden · code-review · V4K-GBQ
Depends on #1872. Let headless installs authenticate immediately when
SENTRY_SETUP_CODEis supplied. The installer hands authentication to the same bootstrap implementation used by an existing CLI and propagates failures.https://linear.app/getsentry/issue/VDY-338
Validation on the complete stack: typing, lint, and focused authentication/setup tests pass. The full test run has 21 unrelated failures reproduced on unchanged upstream main in the installer musl-detection, time-range, and zip-writer suites.
Native GitHub Stack: #1874, ordered #1870 → #1871 → #1872 → #1873.
Native bootstrap and shell installation passed against local OAuth redemption using internally generated codes. The shell test used a local artifact mirror for the unreleased binary.