feat(init): resolve projects and improve existing setups - #1374
Conversation
41c51ff to
3263729
Compare
3263729 to
2458762
Compare
2458762 to
504e0cb
Compare
504e0cb to
a794d55
Compare
…ct-create-resolver
…ct-create-resolver # Conflicts: # packages/cli/src/lib/init/tools/apply-patchset.ts # packages/cli/src/lib/init/tools/registry.ts # packages/cli/src/lib/init/ui/ink-app.tsx # packages/cli/src/lib/init/ui/wizard-store.ts # packages/cli/src/lib/init/wizard-runner.ts # packages/cli/src/lib/init/workflow-inputs.ts # packages/cli/test/lib/init/wizard-runner.test.ts
…ct-create-resolver
…esolver' into refactor/shared-project-create-resolver
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| opts.existingProject.projectSlug === slug | ||
| ? opts.existingProject | ||
| : await tryGetExistingProjectData(opts.org, slug).catch(() => null); | ||
| const existingProject = await tryGetExistingProjectData(opts.org, slug); |
There was a problem hiding this comment.
Bug: The resolveExistingProjectChoice and findAvailableProjectSlug functions don't handle API errors from tryGetExistingProjectData, causing the wizard to crash on transient network or server issues.
Severity: HIGH
Suggested Fix
Wrap the calls to tryGetExistingProjectData within resolveExistingProjectChoice and findAvailableProjectSlug in try...catch blocks. The catch block should handle the ApiError gracefully, perhaps by logging the error and returning a failure state or re-throwing a more specific WizardError that the top-level runner can interpret, rather than letting the wizard crash.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/cli/src/lib/init/preflight.ts#L356
Potential issue: The functions `resolveExistingProjectChoice` and
`findAvailableProjectSlug` both call `tryGetExistingProjectData` without handling
potential non-404 API errors. `tryGetExistingProjectData` is designed to throw an
`ApiError` for issues like network failures, timeouts, or 5xx server errors. Because
these calls are not wrapped in a `try...catch` block, any such transient API error will
propagate up the call stack. This causes the `sentry init` wizard to crash with an
unhandled exception instead of gracefully handling the failure, for example, by retrying
or informing the user. This can happen during explicit project selection or when the
wizard is automatically searching for an available project slug.
Also affects:
packages/cli/src/lib/init/preflight.ts:569~575
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f39ffa1. Configure here.
| ); | ||
| } | ||
| assertImprovementSupported(setup, options); | ||
| return markExistingSetupForImprovement(detected, setup); |
There was a problem hiding this comment.
Unattended improve gate too strict
High Severity
--yes and --dry-run call assertImprovementSupported whenever a local Sentry setup is detected, so a setup service that does not advertise improve-existing-setup aborts the run. Interactive mode already recovers by offering another project, and a failed or capability-less health check sets the same flag to false, so unattended init on repos with existing Sentry can fail even when the wizard would otherwise continue.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit f39ffa1. Configure here.


Summary
sentry initto creating a new project unless repository signals resolve one existing project unambiguouslysentry initandsentry project create, including Team Admin handling and safe non-interactive behaviorOAuth companion
#1373 adds
team:adminto the standard OAuth scope set for new grants and refreshes eligible existing interactive grants once after a scope-specific 403. Unattended, JSON/non-interactive, dry-run, and effective environment-token execution do not start OAuth.Test plan
pnpm typecheckCloses #1375.
The terminal-height overflow remains separate in #1376.