Skip to content

test(cli): run sentry wizard e2e tests in toolkit - #2547

Merged
BYK merged 18 commits into
mainfrom
feat/cli-wizard-e2e
Nov 27, 2026
Merged

BYK merged 18 commits into
mainfrom
feat/cli-wizard-e2e

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Ports sentry-wizard's end-to-end suite for help output and Next.js to sentry wizard, because sentry wizard replaces @sentry/wizard. Part of #2511.

Stacked on #2520.

The upstream fixture apps are vendored. A local mock API replaces Sentry, so no secrets are needed. The new wizard-e2e.yml workflow is path-filtered and not required. A macOS job is tracked in #2572.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 14 commits November 26, 2026 11:48
Start moving getsentry/sentry-wizard into the CLI as `sentry wizard`.
This adds the command with the `@sentry/wizard` integrations and flags
(`-i`, `--url`, `--org`, `--project`, `--saas`, `--spotlight`, and the
rest), the shared wizard helpers, and the Next.js flow. The other
integrations report that they are not available in this version yet.

The wizard logs in with the CLI's own login: a stored `sentry auth
login` session, an agent handoff, or the device flow, instead of the
`account/settings/wizard/<hash>` browser flow. It then picks or creates
the project, reads its DSN, and creates an org auth token for source map
uploads. Telemetry goes through the CLI's client.

`sentry init` stays the agent setup guide; its help now points to
`sentry wizard` for the interactive setup.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Port `ast-utils` and `url` from getsentry/sentry-wizard into
`src/lib/wizard/utils/`. The SvelteKit, Remix, React Router, Angular,
Nuxt, source maps, Cloudflare, React Native and Android wizards all use
them, so they land once here and the platform PRs that follow build on
them in parallel.

`ast-utils` edits recast ASTs, so recast and ast-types become direct
dev dependencies; both already came in through magicast.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard` logs in with the CLI's login, which has no sign-up or
partner step, so `--signup`, `--promo-code` and `--coming-from` no longer
do anything. Passing one now fails with a message that points to
https://sentry.io/signup/ instead of being accepted silently.

`promoCode` and `comingFrom` leave `WizardOptions`, the welcome banner and
`setupCI`, which loses its Vercel partner branch. The help text and the
docs say which `@sentry/wizard` flags were removed.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…st-helpers

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
- Skip the `.sentryclirc` URL check, like `sentry init`: the wizard picks
  its instance (`--url`, `--saas` or a prompt) before it logs in.
- Use the stored login's instance for `sentryUrl` when none was chosen,
  and log in again when the stored login is for another instance.
- Link self-hosted users to `/settings/<org>/auth-tokens/`.
- Leave an unparseable MCP config alone (show the copy-paste fallback),
  and let a cancel inside the MCP setup stop the wizard.
- Resolve `catalog:` and `catalog:default` against both pnpm default
  catalog forms.
- Find an existing `SENTRY_AUTH_TOKEN` after the comment header of
  `.env.sentry-build-plugin`, so re-runs don't add a second one.
- Run Windows formatters with Node in the standalone binary, where
  `process.execPath` is `sentry`.
- Ask before updating an `@sentry/nextjs` listed in devDependencies, and
  treat an unknown SDK version as the `^11` the wizard installs.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…st-helpers

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Address review feedback on the shared wizard helpers:

- Enable unicorn/no-array-for-each repo-wide and convert every
  .forEach call site to for...of, including getLastRequireIndex.
- Add buildProjectIssuesUrl to lib/sentry-urls.ts, built on
  getOrgBaseUrl like buildEventSearchUrl, and delete the
  wizard-specific wizard/utils/url.ts.
- Move findFile into lib/dsn/fs-utils.ts and build it on
  isRegularFile, so a directory or FIFO with a matching name is
  skipped. It is async now.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard [<org>/<project>] [<integration>]` replaces the
`@sentry/wizard` flags, with the target first like other commands.

- The integration is a positional, one at a time. A bare integration id
  is never read as a target, and a single bare word is always read as an
  integration, so a project or org spelled like one is written
  `my-org/nextjs`, `nextjs/` or `/nextjs`.
- The target parses with the CLI's org/project grammar and resolves after
  login with `resolveOrgOptionalTarget`, like other commands. Without one
  the org and project pickers run, with no detection.
- `-f/--force` is the only flag. It sets both `forceInstall` and
  `ignoreGitChanges`.
- The instance comes from `SENTRY_URL` or the stored login, so the
  SaaS/self-hosted prompt, `--url`, `--saas` and `skipRcUrlCheck` go.
- Spotlight mode follows `SENTRY_SPOTLIGHT`, telemetry follows
  `isTelemetryEnabled()`, and debug output goes through the CLI logger
  (`--verbose`, `--log-level`).
- Every other `@sentry/wizard` flag and `SENTRY_WIZARD_*` variable is
  gone, hidden ones included, with `disableTelemetryForRun` and
  `rejectRemovedFlags`.

A test pins the wizard's own flags to `force`, and `check:env-coverage`
(part of `ci:policy`) fails when any file under `src/` names
`SENTRY_WIZARD_`.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Re-export buildProjectIssuesUrl from lib/sentry-web-urls.ts through
withSentryBaseUrl(getApiBaseUrl()), like the other user-facing link
builders, so self-hosted and regional logins get links on the host they
are authenticated against.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Move the e2e harness, the help-message test, and the Next.js 14/15/16
tests and their test apps from getsentry/sentry-wizard's e2e-tests/ into
packages/cli/test/wizard-e2e/, and run them against `sentry wizard`.

The harness spawns the npm bundle (or SENTRY_CLI_BINARY) and answers
clack prompts over stdin with a small builder shaped like the clifty API
the upstream tests used, so the remaining platform tests port with few
changes. Runs that need a project log in to a local mock Sentry API
(the existing test/mocks routes plus org auth token creation) with
--url, --org and --project, so no Sentry account or secret is needed.
The help test snapshots the new help and checks that the removed
sign-up flags fail.

`pnpm run test:wizard-e2e` runs them. They install packages and build
real apps, so they stay out of test:unit and test:e2e, and
wizard-e2e.yml runs one job per test file on pull requests that touch
the wizard or these tests, and on manual dispatch.

Refs #2511
…eat/cli-wizard-e2e

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
`sentry wizard` now takes `[<org>/<project>] [<integration>]` and only
`-f/--force`, reads the instance from `SENTRY_URL`, and turns on
Spotlight with `SENTRY_SPOTLIGHT`. The tests used the old flags.

- Runs that need a project use `sentry wizard test-org/test-project
  nextjs`, with the mock API in `SENTRY_URL` and its token in
  `SENTRY_AUTH_TOKEN`.
- The Spotlight run sets `SENTRY_SPOTLIGHT=1` through a new `env` option
  of `withEnv()`.
- The help test snapshots the new help and checks that the sign-up
  flags and the other dropped `@sentry/wizard` flags fail. `--org` and
  `--project` still work as the CLI-wide hidden flags.
- The tsconfig policy test lists the test apps as unchecked: they build
  with their own dependencies.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…eat/cli-wizard-shared-ast-helpers

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Nov 27, 2026 10:40pm UTC
sentry-local Ready Ready Preview Nov 27, 2026 10:40pm UTC

Request Review

@socket-security

socket-security Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Warning

Socket is a tool Sentry Security team deployed to defend against supply chain attack. Please provide any feedback you have in #discuss-security slack channel ❤️

Priority Alert  (click "▶" to expand/collapse) Action
Critical priority
Critical CVE: Next.js: Unauthenticated Remote Code Execution in Image Optimization API when AVIF files are used

CVE: GHSA-2xp9-vwfh-vxw4 Next.js: Unauthenticated Remote Code Execution in Image Optimization API when AVIF files are used (CRITICAL)

Affected versions: >= 10.0.0 < 15.5.24; >= 16.0.0 < 16.3.3

Patched version: 15.5.24

From: packages/cli/test/wizard-e2e/test-applications/nextjs-14-test-app/package.json → npm/next@14.2.35

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/next@14.2.35. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Critical priority
Critical CVE: Next.js: Unauthenticated Remote Code Execution on windows-hosted servers

CVE: GHSA-p293-qw3h-jr36 Next.js: Unauthenticated Remote Code Execution on windows-hosted servers (CRITICAL)

Affected versions: >= 13.4.0 < 15.5.24; >= 16.0.0 < 16.3.3

Patched version: 15.5.24

From: packages/cli/test/wizard-e2e/test-applications/nextjs-14-test-app/package.json → npm/next@14.2.35

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/next@14.2.35. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Critical priority
Critical CVE: Next.js: Unauthenticated Remote Code Execution in Image Optimization API when SVG files are used

CVE: GHSA-2464-fhr4-w9xw Next.js: Unauthenticated Remote Code Execution in Image Optimization API when SVG files are used (CRITICAL)

Affected versions: >= 10.0.0 < 15.5.28; >= 16.0.0 < 16.4.1

Patched version: 15.5.28

From: packages/cli/test/wizard-e2e/test-applications/nextjs-14-test-app/package.json → npm/next@14.2.35

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/next@14.2.35. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn

View full report

…-wizard-e2e

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 27, 2026 00:06 Inactive
Base automatically changed from feat/cli-wizard-shared-ast-helpers to main November 27, 2026 14:04
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>

# Conflicts:
#	packages/cli/src/lib/wizard/utils/project-data.ts
#	packages/cli/test/lib/wizard/utils/project-data.test.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b1008cd. Configure here.

A wizard run happens in one `beforeAll`, and its step timeouts add up:
the Next.js 16 run allows 5 minutes for the SDK install, 1 minute for the
formatters and 1 minute to exit after the last output. The 6-minute hook
timeout could cut a slow run short before any step timed out. Raise the
hook and test timeouts to 15 minutes, inside the 20-minute CI job.
@vercel
vercel Bot temporarily deployed to Preview – sentry-local November 27, 2026 16:58 Inactive
# Conflicts:
#	packages/cli/test/tsconfig.json

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A local mock API replaces Sentry, so no secrets are needed.

I wonder if we can just use sentry local for this?

Comment thread .github/workflows/wizard-e2e.yml Resolved
@BYK
BYK added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit b0a0109 Nov 27, 2026
46 of 47 checks passed
@BYK
BYK deleted the feat/cli-wizard-e2e branch November 27, 2026 23:06
@sentry-junior

sentry-junior Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

sentry local only ingests envelopes (/api/:projectId/envelope/), but the wizard needs the management API (/api/0/organizations/…, /projects/…/keys/). The mock is the existing test/mocks server the CLI tests already use, so nothing new is added. Pointing the built test apps at sentry local to check that events really arrive would be a good follow-up.

This branch was successfully deployed

2 active deployments
Preview – sentry-local — d3ccf652 Deployed Nov 27, 2026 by vercel[bot]
Preview – cli — d3ccf652 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant