Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/cell-architecture/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Project.objects.filter(teams__organizationmember__user_id=user_id)

```bash
devservices up --mode cell-routing # brings up synapse + deps
SENTRY_CELL_ROUTING=1 sentry devserver --client-hostname=dev.getsentry.net # or devservices serve
SENTRY_CELL_ROUTING=1 sentry-server devserver --client-hostname=dev.getsentry.net # or devservices serve
```

Only cell-scoped API XHRs (`/api/0/organizations/{slug}/*`) cross to Synapse on `:13000`; UI HTML and control API stay on the sentry devserver at `:8000`. The env var gates a block in `src/sentry/conf/server.py` that sets `system.region-api-url-template` to the Synapse port and flips `system:multi-region`. The frontend reads `regionUrl` from the bootstrap blob and routes cell XHRs there per `static/app/api.tsx:715`.
Expand Down
10 changes: 5 additions & 5 deletions .agents/skills/generate-migration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ description: Generate or review Django database migrations for Sentry. Use when
Generate migrations automatically based on model changes:

```bash
sentry django makemigrations
sentry-server django makemigrations
```

For a specific app:

```bash
sentry django makemigrations <app_name>
sentry-server django makemigrations <app_name>
```

Generate an empty migration (for data migrations or custom work):

```bash
sentry django makemigrations <app_name> --empty
sentry-server django makemigrations <app_name> --empty
```

## After Generating

1. If you added a new model, ensure it's imported in the app's `__init__.py`
2. Review the generated migration for correctness
3. Run `sentry django sqlmigrate <app_name> <migration_name>` to verify the SQL
4. Apply the migration locally with `sentry django migrate <app_name>` — Sentry's migration framework runs its safety checks on apply, so this catches unsafe ops (missing `is_post_deployment`, unsafe column changes, etc.) before CI does.
3. Run `sentry-server django sqlmigrate <app_name> <migration_name>` to verify the SQL
4. Apply the migration locally with `sentry-server django migrate <app_name>` — Sentry's migration framework runs its safety checks on apply, so this catches unsafe ops (missing `is_post_deployment`, unsafe column changes, etc.) before CI does.

When editing a generated migration (e.g. swapping `DeleteModel` for `SafeDeleteModel`), **leave the auto-generated `is_post_deployment` comment block in place**. It documents a non-obvious flag with concrete guidance for future migration authors — useful context, not fluff. Only remove a comment if it's stale or contradicts the code.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This two-step process allows deploying code first, then enabling the backfill se

### Self-Hosted (Synchronous)

On self-hosted instances, backfills run synchronously during `sentry upgrade` via the `run_outbox_replications_for_self_hosted` function (connected to the `post_upgrade` signal). This function:
On self-hosted instances, backfills run synchronously during `sentry-server upgrade` via the `run_outbox_replications_for_self_hosted` function (connected to the `post_upgrade` signal). This function:

1. Calls `backfill_outboxes_for(force_synchronous=True)` — bypasses options, uses `model.replication_version` directly
2. Drains all pending outbox shards
Expand Down
14 changes: 7 additions & 7 deletions .agents/skills/setup-dev/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ which colima 2>/dev/null && colima status 2>/dev/null
which direnv 2>/dev/null

# Check if repo is already set up
ls .venv/bin/sentry 2>/dev/null && ls node_modules/.bin 2>/dev/null
ls .venv/bin/sentry-server 2>/dev/null && ls node_modules/.bin 2>/dev/null
```

Based on results, skip to the appropriate step. If everything is installed, jump to Step 6.
Expand Down Expand Up @@ -235,17 +235,17 @@ If only Colima is checked, patch it to support all runtimes. Read `references/or
If this is a first-time setup, the database needs seeding:

```bash
.venv/bin/sentry upgrade --noinput
.venv/bin/sentry-server upgrade --noinput
```

This runs all Django migrations AND creates default data (organizations, roles, projects). Without this, the dev server will 500 on every page.

**Do NOT just run `sentry django migrate`** — that only runs migrations without seeding the required default data.
**Do NOT just run `sentry-server django migrate`** — that only runs migrations without seeding the required default data.

### Create Superuser

```bash
.venv/bin/sentry createuser --superuser --email admin@sentry.io --password admin --no-input
.venv/bin/sentry-server createuser --superuser --email admin@sentry.io --password admin --no-input
```

## Step 7: Start the Dev Server
Expand All @@ -257,7 +257,7 @@ devservices serve
Or directly:

```bash
.venv/bin/sentry devserver
.venv/bin/sentry-server devserver
```

### What to Expect on Startup
Expand Down Expand Up @@ -317,8 +317,8 @@ Each worktree has its own `.venv`. When you create a worktree with `git worktree
| direnv hangs | Docker runtime not running | Start OrbStack / Colima |
| `devenv sync` fails with version error | Outdated devenv | `devenv update` or reinstall |
| `devservices up` says "colima not running" | Using OrbStack, script only checks Colima | Patch `devservices.py` — see Step 6 |
| Server 500s on every page | DB not seeded | `.venv/bin/sentry upgrade --noinput` |
| `relation "sentry_organization" does not exist` | Migrations not run | `.venv/bin/sentry upgrade --noinput` |
| Server 500s on every page | DB not seeded | `.venv/bin/sentry-server upgrade --noinput` |
| `relation "sentry_organization" does not exist` | Migrations not run | `.venv/bin/sentry-server upgrade --noinput` |
| White/blank screen in browser | Cookie Sync extension missing | Install the Chrome extension |
| Kafka topic warnings on startup | Normal first-boot behavior | Wait 30-60 seconds |
| Port already in use | Stale containers | `docker rm -f $(docker ps -aq)` then retry |
Expand Down
4 changes: 2 additions & 2 deletions .agents/skills/setup-dev/references/orbstack-fix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OrbStack Docker Socket Fix

When `devservices serve` or `sentry devserver` fails with "Make sure colima is running" for OrbStack users, the issue is in `src/sentry/runner/commands/devservices.py`.
When `devservices serve` or `sentry-server devserver` fails with "Make sure colima is running" for OrbStack users, the issue is in `src/sentry/runner/commands/devservices.py`.

## The Problem

Expand Down Expand Up @@ -49,4 +49,4 @@ After patching:

1. Remove any symlinks: `rm -f ~/.colima/default/docker.sock` (if it was a symlink to OrbStack)
2. Ensure OrbStack is running: `orbctl status`
3. Run: `.venv/bin/sentry devserver` — should detect OrbStack's socket automatically
3. Run: `.venv/bin/sentry-server devserver` — should detect OrbStack's socket automatically
31 changes: 3 additions & 28 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ PATH_rm "/opt/homebrew/bin"
# homebrew must not be searched first, we need venv and devenv to take precedence
PATH_add "/opt/homebrew/bin"

# PATH_add prepends, so entries listed earlier rank lower. npm ships a binary
# named `sentry`, which must not shadow the venv's.
# PATH_add prepends, so entries listed earlier rank lower.
PATH_add node_modules/.bin

### Python ###
Expand All @@ -150,8 +149,8 @@ https://github.com/getsentry/devenv#install
'
fi

if ! [ -x "${VIRTUAL_ENV}/bin/sentry" ]; then
warn "Your virtualenv is activated, but sentry doesn't seem to be installed."
if ! [ -x "${VIRTUAL_ENV}/bin/sentry-server" ]; then
warn "Your virtualenv is activated, but sentry-server doesn't seem to be installed."
commands_to_run+=("devenv sync")
fi

Expand All @@ -161,30 +160,6 @@ PATH_add "${PWD}/.devenv/bin"
# gcloud and friends
PATH_add "/opt/homebrew/share/google-cloud-sdk/bin"

# pnpm prepends node_modules/.bin to PATH, even when the venv comes first here.
rm -f node_modules/.bin/sentry
hash -r

# Only remove shadowing executables once the expected command is installed.
if [ -x "${VIRTUAL_ENV}/bin/sentry" ]; then
while [ "$(command -v sentry)" != "${VIRTUAL_ENV}/bin/sentry" ]; do
sentry_path="$(command -v sentry || true)"
if [ "$(type -t sentry)" != "file" ] || [ ! -f "$sentry_path" ] || [ "$sentry_path" -ef "${VIRTUAL_ENV}/bin/sentry" ]; then
die "Expected sentry to resolve to ${VIRTUAL_ENV}/bin/sentry, got: ${sentry_path:-not found}"
fi
# Resolve parent directories, not the executable: unlinking a local shim
# is safe, but following a directory symlink could delete a global tool.
sentry_dir="$(cd -- "$(dirname -- "$sentry_path")" && pwd -P)"
case "$sentry_dir/" in
"$(pwd -P)/"*) ;;
*) die "Refusing to remove $sentry_path outside this checkout. Adjust PATH so ${VIRTUAL_ENV}/bin/sentry takes precedence." ;;
esac
info "Removing $sentry_path: it shadows ${VIRTUAL_ENV}/bin/sentry"
rm -f -- "$sentry_path"
hash -r
done
fi

### prek ###

debug "Checking prek..."
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-sentry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ runs:
DEVSERVICES_MODE: ${{ inputs.mode }}
GITHUB_TOKEN: ${{ github.token }}
run: |
sentry init
sentry-server init

if [ "$EARLY_DEVSERVICES" = true ]; then
python3 "$ACTION_PATH/devservices-bg.py" wait
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ jobs:
- name: setup sentry (lite)
run: |
python3 -m tools.fast_editable --path .
sentry init
sentry-server init

- run: PYTHONWARNINGS=error::RuntimeWarning mypy
id: run
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Apply migrations
run: |
sentry upgrade --noinput
sentry-server upgrade --noinput

# Checkout the current ref
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openapi-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
if: steps.changes.outputs.api_docs == 'true'
run: |
mkdir schemas
sentry rpcschema --loglevel=WARNING > rpc_method_schema.json
sentry-server rpcschema --loglevel=WARNING > rpc_method_schema.json

# Runs oasdiff directly from the getsentry/image-mirror copy instead of
# oasdiff/oasdiff-action, which builds FROM tufin/oasdiff:main on Docker Hub.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Build RPC method schema
if: steps.changes.outputs.api_docs == 'true'
run: |
sentry rpcschema --loglevel=WARNING > rpc_method_schema.json
sentry-server rpcschema --loglevel=WARNING > rpc_method_schema.json

- name: Copy artifacts into getsentry/sentry-api-schema
if: steps.changes.outputs.api_docs == 'true'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/migration-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
set -eu
# This will fail if a migration or the lockfile are missing in the PR
exit_code=0
sentry django makemigrations --check --dry-run --no-input || exit_code=$?
sentry-server django makemigrations --check --dry-run --no-input || exit_code=$?
if [ "$exit_code" == 1 ]; then
echo -e "::error::Error: Migration required -- to generate a migration, run:\n" \
"sentry django makemigrations -n <some_name> && git add migrations_lockfile.txt" >&2
"sentry-server django makemigrations -n <some_name> && git add migrations_lockfile.txt" >&2
elif [ "$exit_code" == 2 ]; then
echo -e "::error::Error: Migration lockfile mismatch -- run:\n" \
"sentry django makemigrations -n <some_name> && git add migrations_lockfile.txt" >&2
"sentry-server django makemigrations -n <some_name> && git add migrations_lockfile.txt" >&2
fi
exit $exit_code
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${workspaceRoot}/.venv/bin/sentry",
"program": "${workspaceRoot}/.venv/bin/sentry-server",
"args": ["devserver"],
"cwd": "${workspaceRoot}",
"debugOptions": [
Expand All @@ -29,7 +29,7 @@
"name": "sentry backend debug",
"type": "python",
"request": "launch",
"program": "${workspaceRoot}/.venv/bin/sentry",
"program": "${workspaceRoot}/.venv/bin/sentry-server",
"args": ["devserver", "--debug-server", "--no-pretty"],
"cwd": "${workspaceRoot}"
},
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ build-js-po:

build-spectacular-docs:
@echo "--> Building drf-spectacular openapi spec (combines with deprecated docs)"
@OPENAPIGENERATE=1 sentry django spectacular --file tests/apidocs/openapi-spectacular.json --format openapi-json --validate --fail-on-warn
@OPENAPIGENERATE=1 sentry-server django spectacular --file tests/apidocs/openapi-spectacular.json --format openapi-json --validate --fail-on-warn

build-deprecated-docs:
@echo "--> Building deprecated openapi spec from json files"
Expand All @@ -51,7 +51,7 @@ build-api-docs: build-deprecated-docs build-spectacular-docs
# Opt-in private schema for local review; never included in the public docs build.
build-investigation-api-docs: build-deprecated-docs
@mkdir -p .artifacts/investigation-api-docs
@OPENAPIGENERATE=1 sentry django spectacular --custom-settings sentry.investigations.apidocs.PRIVATE_SCHEMA_SETTINGS --file .artifacts/investigation-api-docs/openapi.json --format openapi-json --validate --fail-on-warn
@OPENAPIGENERATE=1 sentry-server django spectacular --custom-settings sentry.investigations.apidocs.PRIVATE_SCHEMA_SETTINGS --file .artifacts/investigation-api-docs/openapi.json --format openapi-json --validate --fail-on-warn
pnpm exec node api-docs/index.ts .artifacts/investigation-api-docs/openapi.json .artifacts/investigation-api-docs/openapi-derefed.json
pnpm --filter @sentry-internal/api-docs exec openapi-examples-validator ../.artifacts/investigation-api-docs/openapi-derefed.json --no-additional-properties

Expand All @@ -71,13 +71,13 @@ build: locale

merge-locale-catalogs: build-js-po
uv pip install Babel
cd src/sentry && sentry django makemessages -i static -l en
cd src/sentry && sentry-server django makemessages -i static -l en
./bin/merge-catalogs en

compile-locale:
uv pip install Babel
./bin/find-good-catalogs src/sentry/locale/catalogs.json
cd src/sentry && sentry django compilemessages
cd src/sentry && sentry-server django compilemessages

install-transifex:
uv pip install transifex-client
Expand Down Expand Up @@ -107,10 +107,10 @@ test-cli: create-db
@echo "--> Testing CLI"
rm -rf test_cli
mkdir test_cli
cd test_cli && sentry init test_conf
cd test_cli && sentry --config=test_conf help
cd test_cli && sentry --config=test_conf upgrade --traceback --noinput
cd test_cli && sentry --config=test_conf export --help
cd test_cli && sentry-server init test_conf
cd test_cli && sentry-server --config=test_conf help
cd test_cli && sentry-server --config=test_conf upgrade --traceback --noinput
cd test_cli && sentry-server --config=test_conf export --help
rm -r test_cli
@echo ""

Expand Down
2 changes: 1 addition & 1 deletion bin/dump-command-help
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def dump_command(out, cmd, path):
@click.command()
@click.option("--output-path", "out", type=click.Path(), default="build/cli-help")
def cli(out):
dump_command(out, root_command, ["sentry"])
dump_command(out, root_command, ["sentry-server"])


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def main(context: dict[str, str]) -> int:
if not os.path.exists(f"{sentry_conf}/config.yml") or not os.path.exists(
f"{sentry_conf}/sentry.conf.py"
):
proc.run((f"{venv_dir}/bin/sentry", "init", "--dev"))
proc.run((f"{venv_dir}/bin/sentry-server", "init", "--dev"))

if not run_procs(
repo,
Expand Down Expand Up @@ -386,7 +386,7 @@ def main(context: dict[str, str]) -> int:
if stdout != "t":
proc.run(
(
f"{venv_dir}/bin/sentry",
f"{venv_dir}/bin/sentry-server",
"createuser",
"--superuser",
"--email",
Expand Down
Loading
Loading