|
| 1 | +# Agent Instructions |
| 2 | + |
| 3 | +## Package Manager |
| 4 | + |
| 5 | +Use **tox** for testing (not pytest directly): |
| 6 | +- Always run tox from the main `.venv`. If there is no `.venv`, create it and install `pip install -r requirements-lint.txt -r requirements-test.txt tox` |
| 7 | +- Test matrix config is in `tox.ini` |
| 8 | +- Integration tests: `tox -e py3.14-{integration}-v{version}` |
| 9 | +- Common tests: `tox -e py3.14-common` |
| 10 | + |
| 11 | +## Type Checking |
| 12 | + |
| 13 | +- Always run mypy from the main `.venv`. If there is no `.venv`, create it and install `pip install -r requirements-lint.txt -r requirements-test.txt` |
| 14 | +- Run `mypy sentry_sdk` before committing (must pass with zero errors) |
| 15 | +- Strict mode enabled (`check_untyped_defs`, `disallow_untyped_defs`) |
| 16 | + |
| 17 | +## Linting & Formatting |
| 18 | + |
| 19 | +- **Ruff** for linting and formatting |
| 20 | +- `ruff check tests sentry_sdk` |
| 21 | +- `ruff format --check tests sentry_sdk` |
| 22 | +- Full lint suite: `tox -e linters` |
| 23 | + |
| 24 | +## Commit Attribution |
| 25 | + |
| 26 | +AI commits MUST include: |
| 27 | +``` |
| 28 | +Co-Authored-By: <agent model name> <noreply@anthropic.com> |
| 29 | +``` |
| 30 | +Example: `Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>` |
| 31 | + |
| 32 | +## Auto-Generated Files |
| 33 | + |
| 34 | +Do NOT edit these directly — modify source scripts instead: |
| 35 | +- `tox.ini` — generated by `scripts/populate_tox/populate_tox.py` from `scripts/populate_tox/tox.jinja` |
| 36 | +- `.github/workflows/test-integrations-*.yml` — generated by `scripts/split_tox_gh_actions/split_tox_gh_actions.py` |
| 37 | +- Regenerate all: `scripts/generate-test-files.sh` |
| 38 | + |
| 39 | +## Adding Integrations to Test Suite |
| 40 | + |
| 41 | +1. Add minimum version to `_MIN_VERSIONS` in `sentry_sdk/integrations/__init__.py` |
| 42 | +2. Add config to `TEST_SUITE_CONFIG` in `scripts/populate_tox/config.py` |
| 43 | +3. Add to group in `scripts/split_tox_gh_actions/split_tox_gh_actions.py` |
| 44 | +4. Run `scripts/generate-test-files.sh` |
| 45 | + |
| 46 | +## Integration Contract |
| 47 | + |
| 48 | +- Don't crash applications or swallow exceptions |
| 49 | +- Don't mutate object references or alter function signatures |
| 50 | +- Don't leak file descriptors or make unexpected DB requests |
| 51 | +- Write defensive code |
| 52 | +- Use end-to-end tests (not mocks) |
| 53 | + |
| 54 | +## Key Paths |
| 55 | + |
| 56 | +| Path | Description | |
| 57 | +|------|-------------| |
| 58 | +| `sentry_sdk/integrations/` | integration modules | |
| 59 | +| `sentry_sdk/ai/` | AI monitoring | |
| 60 | +| `sentry_sdk/crons/` | Cron monitoring | |
| 61 | +| `sentry_sdk/profiler/` | Performance profiling | |
| 62 | +| `tests/integrations/{name}/` | Integration test suites | |
| 63 | +| `scripts/populate_tox/config.py` | Test suite configuration | |
0 commit comments