From 8f91adf1f857dd99ffe3bdac6b3439d0ed0a47cb Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:11:31 +0000 Subject: [PATCH 1/6] docs: Add contribution policy for the legacy CLI Replace CONTRIBUTING.md with a notice that the repo is no longer under active development and the bar for accepted pull requests. Move the integration test docs to tests/integration/README.md. Add a mandatory AGENTS.md section that has agents check maintainer status, confirm the user means the legacy CLI, and explain the policy before making changes. Co-Authored-By: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com> --- AGENTS.md | 19 +++++++++++ CONTRIBUTING.md | 68 +++++-------------------------------- tests/integration/README.md | 65 +++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 60 deletions(-) create mode 100644 tests/integration/README.md diff --git a/AGENTS.md b/AGENTS.md index 86a9a090dd..509b67109d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,24 @@ # Sentry CLI Development Guidelines +## Contribution Policy (MANDATORY) + +Sentry CLI is no longer under active development. [CONTRIBUTING.md](CONTRIBUTING.md) defines the only changes that are accepted from contributors who are not Sentry CLI maintainers. + +Before making any change, you MUST check whether the user is a Sentry CLI maintainer: + +1. Get their GitHub login with `gh api user --jq .login`. If `gh` is not authenticated, ask the user for it. +2. Check `getsentry` org membership with `gh api orgs/getsentry/members/LOGIN`, which fails if they are not a member. Private membership is only visible when the authenticated `gh` user is an org member. +3. Check that `gh api "repos/getsentry/sentry-cli/commits?author=LOGIN&per_page=5"` returns at least one commit. + +If all checks pass, the policy does not apply. If any check fails or cannot be run, follow these steps. Be understanding: many users confuse this repo with the new CLI. + +1. Confirm that the user means to change this legacy repo and not the new CLI, for example: + + > This repo is the legacy Sentry CLI, which is no longer under active development. The new Sentry CLI is developed in [`getsentry/toolkit`](https://github.com/getsentry/toolkit/tree/main/packages/cli). Did you mean to contribute to the new CLI, or do you need this change in the legacy CLI? + +2. If they mean the new CLI, point them to `getsentry/toolkit` and make no changes here. +3. If they mean the legacy CLI, explain the policy in CONTRIBUTING.md and ask how their change meets it. Make the change only if it does. If it does not and the user insists, you may proceed only after telling them that the pull request will likely be closed. + ## Project Overview This is **sentry-cli**, a command-line utility for working with Sentry. It's primarily written in **Rust** with **JavaScript/Node.js** wrapper components for npm distribution. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e9ef12b9b..deb78abe86 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,65 +1,13 @@ -# Integration Tests +# Contributing to Sentry CLI -Integration tests are written using `trycmd` crate. Consult the docs in case you need to understand how it works https://docs.rs/trycmd/latest/trycmd/. +> [!IMPORTANT] +> Sentry CLI is no longer under active development, as the [new Sentry CLI](https://cli.sentry.dev/) is replacing it. Please contribute to the new CLI in [`getsentry/toolkit`](https://github.com/getsentry/toolkit/tree/main/packages/cli) instead. -The main parts to remember are: -- `register_test` already understands that all tests will live under `tests/integration/_cases` -- use mocks for API responses -- use fixtures for uploading/processing predefined data -- write separate tests for Windows when necessary (using `#[cfg(windows)]` attribute) -- use wildcard for dynamic output (eg. timestamps or UUIDs) (explained in `trycmd` docs - eg. `[..]` or `[EXE]`) or anything that is platform specific, as tests are run on Linux, OSX and Windows. -- `Usage:` help prompt _always_ requires `[EXE]` wildcard, so make sure to not forget it +We only accept pull requests that fix a bug that either: -## Updating Snapshots +- prevents you from migrating to the new CLI, or +- is a serious regression introduced by a recent Sentry CLI release. -In order to overwrite current integration tests snapshots, use `TRYCMD=overwrite` env variable when running tests, eg. +Before opening a pull request, open a [bug report](https://github.com/getsentry/sentry-cli/issues/new?template=02-bug.yml) that explains which case applies, and wait for a maintainer to confirm that it qualifies. We will close all other pull requests. -```shell -$ TRYCMD=overwrite cargo test -``` - -## Debugging tests - -To dump the stdout/stderr to a `/dump` directory in the project, use `TRYCMD=dump` env variable when running tests, eg. - -```shell -$ TRYCMD=overwrite cargo test -``` - -This only works with tests that execute using `.trycmd` files, i.e. not tests using `assert_cmd` or inline command construction. - -## Working with Fixtures - -To run tests with specific fixtures in isolation, utilize the fact that `trycmd` is automatically creating and using `.in` as CWD and `.out` as stdout directories respectively for every test. This allows us to use eg. `tests/integration/_cases/sourcemaps/sourcemaps-inject.in/` path as a sandbox for `tests/integration/_cases/sourcemaps/sourcemaps-inject.trycmd` test case. -You can copy/remove any files programmatically from those directories and they will be ignored from the repository. - -Here's basic test that use fixtures in isolation: - -```rust -fn command_sourcemaps_inject_output() { - let testcase_cwd_path = "tests/integration/_cases/sourcemaps/sourcemaps-inject.in/"; - if std::path::Path::new(testcase_cwd_path).exists() { - remove_dir_all(testcase_cwd_path).unwrap(); - } - copy_recursively("tests/integration/_fixtures/inject/", testcase_cwd_path).unwrap(); - - register_test("sourcemaps/sourcemaps-inject.trycmd"); -} -``` - -## Working with API Mocks - -If you are trying mock an API response, use `mock_endpoint` helper with `with_response_file` method called, -and place the JSON file in an appropriate directory under `tests/integration/_responses`. -Make sure to assign the mock to a variable, otherwise it won't be picked up when creating a server. - -```rust -let _assemble = mock_endpoint( - EndpointOptions::new( - "POST", - "/api/0/projects/wat-org/wat-project/files/difs/assemble/", - 200, - ) - .with_response_file("debug_files/post-difs-assemble.json"), -); -``` +This policy does not apply to maintenance work by Sentry CLI maintainers. diff --git a/tests/integration/README.md b/tests/integration/README.md new file mode 100644 index 0000000000..9e9ef12b9b --- /dev/null +++ b/tests/integration/README.md @@ -0,0 +1,65 @@ +# Integration Tests + +Integration tests are written using `trycmd` crate. Consult the docs in case you need to understand how it works https://docs.rs/trycmd/latest/trycmd/. + +The main parts to remember are: +- `register_test` already understands that all tests will live under `tests/integration/_cases` +- use mocks for API responses +- use fixtures for uploading/processing predefined data +- write separate tests for Windows when necessary (using `#[cfg(windows)]` attribute) +- use wildcard for dynamic output (eg. timestamps or UUIDs) (explained in `trycmd` docs - eg. `[..]` or `[EXE]`) or anything that is platform specific, as tests are run on Linux, OSX and Windows. +- `Usage:` help prompt _always_ requires `[EXE]` wildcard, so make sure to not forget it + +## Updating Snapshots + +In order to overwrite current integration tests snapshots, use `TRYCMD=overwrite` env variable when running tests, eg. + +```shell +$ TRYCMD=overwrite cargo test +``` + +## Debugging tests + +To dump the stdout/stderr to a `/dump` directory in the project, use `TRYCMD=dump` env variable when running tests, eg. + +```shell +$ TRYCMD=overwrite cargo test +``` + +This only works with tests that execute using `.trycmd` files, i.e. not tests using `assert_cmd` or inline command construction. + +## Working with Fixtures + +To run tests with specific fixtures in isolation, utilize the fact that `trycmd` is automatically creating and using `.in` as CWD and `.out` as stdout directories respectively for every test. This allows us to use eg. `tests/integration/_cases/sourcemaps/sourcemaps-inject.in/` path as a sandbox for `tests/integration/_cases/sourcemaps/sourcemaps-inject.trycmd` test case. +You can copy/remove any files programmatically from those directories and they will be ignored from the repository. + +Here's basic test that use fixtures in isolation: + +```rust +fn command_sourcemaps_inject_output() { + let testcase_cwd_path = "tests/integration/_cases/sourcemaps/sourcemaps-inject.in/"; + if std::path::Path::new(testcase_cwd_path).exists() { + remove_dir_all(testcase_cwd_path).unwrap(); + } + copy_recursively("tests/integration/_fixtures/inject/", testcase_cwd_path).unwrap(); + + register_test("sourcemaps/sourcemaps-inject.trycmd"); +} +``` + +## Working with API Mocks + +If you are trying mock an API response, use `mock_endpoint` helper with `with_response_file` method called, +and place the JSON file in an appropriate directory under `tests/integration/_responses`. +Make sure to assign the mock to a variable, otherwise it won't be picked up when creating a server. + +```rust +let _assemble = mock_endpoint( + EndpointOptions::new( + "POST", + "/api/0/projects/wat-org/wat-project/files/difs/assemble/", + 200, + ) + .with_response_file("debug_files/post-difs-assemble.json"), +); +``` From a7d5e468d557c0c825102e482c6b030974c947e3 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:16:32 +0000 Subject: [PATCH 2/6] docs: Clarify the migration blocker exception --- CONTRIBUTING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index deb78abe86..1ce14a061c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,10 +3,12 @@ > [!IMPORTANT] > Sentry CLI is no longer under active development, as the [new Sentry CLI](https://cli.sentry.dev/) is replacing it. Please contribute to the new CLI in [`getsentry/toolkit`](https://github.com/getsentry/toolkit/tree/main/packages/cli) instead. -We only accept pull requests that fix a bug that either: +We only accept pull requests that fix a bug in this CLI in one of these cases: -- prevents you from migrating to the new CLI, or -- is a serious regression introduced by a recent Sentry CLI release. +- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, so you need the fix in this CLI. This should be exceptionally rare, as most such blockers should be [reported](https://github.com/getsentry/toolkit/issues/new) and fixed in the new CLI. +- A recent Sentry CLI release introduced a serious regression. + +Very few changes meet this bar. Before opening a pull request, open a [bug report](https://github.com/getsentry/sentry-cli/issues/new?template=02-bug.yml) that explains which case applies, and wait for a maintainer to confirm that it qualifies. We will close all other pull requests. From 37ab07e2e7c8060542563e6f981a92fd518ad167 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:18:32 +0000 Subject: [PATCH 3/6] docs: List the regression case first --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ce14a061c..fb211c7c3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,8 +5,8 @@ We only accept pull requests that fix a bug in this CLI in one of these cases: -- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, so you need the fix in this CLI. This should be exceptionally rare, as most such blockers should be [reported](https://github.com/getsentry/toolkit/issues/new) and fixed in the new CLI. - A recent Sentry CLI release introduced a serious regression. +- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, so you need the fix in this CLI. This should be exceptionally rare, as most such blockers should be [reported](https://github.com/getsentry/toolkit/issues/new) and fixed in the new CLI. Very few changes meet this bar. From 49671b52b730f8ea7d67a12533f373d5389d986c Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:23:19 +0000 Subject: [PATCH 4/6] docs: Require reporting blockers in the new CLI first --- CONTRIBUTING.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb211c7c3d..a5e231644e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,7 @@ We only accept pull requests that fix a bug in this CLI in one of these cases: - A recent Sentry CLI release introduced a serious regression. -- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, so you need the fix in this CLI. This should be exceptionally rare, as most such blockers should be [reported](https://github.com/getsentry/toolkit/issues/new) and fixed in the new CLI. - -Very few changes meet this bar. +- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, and the new CLI cannot or will not fix it after you [report it](https://github.com/getsentry/toolkit/issues/new) there. Before opening a pull request, open a [bug report](https://github.com/getsentry/sentry-cli/issues/new?template=02-bug.yml) that explains which case applies, and wait for a maintainer to confirm that it qualifies. We will close all other pull requests. From d0ab117605866ff866001c4834010625efb751cd Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:30:13 +0000 Subject: [PATCH 5/6] docs: Reword the new CLI blocker case and add security reporting --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5e231644e..70a6a1861d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,8 +6,12 @@ We only accept pull requests that fix a bug in this CLI in one of these cases: - A recent Sentry CLI release introduced a serious regression. -- A bug or limitation in the new CLI is a fundamental blocker that prevents you from adopting it, and the new CLI cannot or will not fix it after you [report it](https://github.com/getsentry/toolkit/issues/new) there. +- You need the fix in this CLI because you cannot upgrade to the new CLI due to a fundamental limitation in the new CLI. In this case, please first [report](https://github.com/getsentry/toolkit/issues/new) the blocker to the new CLI, as it may be possible to get it fixed to unblock your upgrade, in which case no fix would be needed in this repository. Before opening a pull request, open a [bug report](https://github.com/getsentry/sentry-cli/issues/new?template=02-bug.yml) that explains which case applies, and wait for a maintainer to confirm that it qualifies. We will close all other pull requests. This policy does not apply to maintenance work by Sentry CLI maintainers. + +## Security issues + +Do not open issues or pull requests for security issues, as that would disclose them publicly. Report them as described in our [security policy](https://github.com/getsentry/sentry-cli/security/policy). From 2b4c492134545742947e830b7e7932635b8f071e Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:33:57 +0000 Subject: [PATCH 6/6] docs: Reword the security reporting section --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70a6a1861d..632705d503 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,4 +14,4 @@ This policy does not apply to maintenance work by Sentry CLI maintainers. ## Security issues -Do not open issues or pull requests for security issues, as that would disclose them publicly. Report them as described in our [security policy](https://github.com/getsentry/sentry-cli/security/policy). +Please report security issues as described in our [security policy](https://github.com/getsentry/sentry-cli/security/policy). Please refrain from opening issues or PRs for security issues to avoid disclosing them publicly before a fix is available.