Skip to content

docs: Add AGENTS.md#5579

Open
sentrivana wants to merge 3 commits intomasterfrom
ivana/agents-md
Open

docs: Add AGENTS.md#5579
sentrivana wants to merge 3 commits intomasterfrom
ivana/agents-md

Conversation

@sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Mar 3, 2026

Description

Add a tailored AGENTS.md.

Tested with Claude fixing a small issue in the Celery integration. It correctly identified where to make the change, where to add the tests, and how to run the correct test suite.

Issues

Closes #5576

Reminders

@sentrivana sentrivana marked this pull request as ready for review March 3, 2026 10:07
@sentrivana sentrivana requested a review from a team as a code owner March 3, 2026 10:07
AGENTS.md Outdated

## Type Checking

- 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`
Copy link
Contributor

Choose a reason for hiding this comment

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

We should create a tox env that only runs mypy imo, feel like it's easy for a virtual env to be polluted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea. Added ruff and mypy as tox envs and tweaked the file.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (celery) Propagate user-set headers by sentrivana in #5581

Documentation 📚

  • Add AGENTS.md by sentrivana in #5579
  • Add set_attribute example to changelog by sentrivana in #5578

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 4.57s

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 13794 uncovered lines.


Generated by Codecov Action

Comment on lines +942 to +949
[testenv:mypy]
commands =
mypy sentry_sdk

[testenv:ruff]
commands =
ruff check tests sentry_sdk
ruff format --check tests sentry_sdk
Copy link

Choose a reason for hiding this comment

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

Bug: Manual changes to tox.ini for mypy and ruff environments will be lost when the auto-generation script populate_tox.py is run, as it overwrites the file.
Severity: MEDIUM

Suggested Fix

Instead of editing tox.ini directly, add the [testenv:mypy] and [testenv:ruff] configurations to the source template file, scripts/populate_tox/tox.jinja. This will ensure the changes are preserved when the auto-generation script runs.

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: tox.ini#L942-L949

Potential issue: The `tox.ini` file is being manually modified to add `[testenv:mypy]`
and `[testenv:ruff]` sections. However, a comment at the top of `tox.ini` warns that the
file is auto-generated by `scripts/populate_tox/populate_tox.py` from the `tox.jinja`
template. The generation script opens `tox.ini` in write mode (`"w"`), which overwrites
the entire file. Since the new `mypy` and `ruff` environments are not present in the
`tox.jinja` template, these manual changes will be lost the next time the generation
script is executed. This will break the `tox -e mypy` and `tox -e ruff` commands
documented in `AGENTS.md`.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link

@cursor cursor bot left a comment

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 and found 2 potential issues.

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

[testenv:ruff]
commands =
ruff check tests sentry_sdk
ruff format --check tests sentry_sdk
Copy link

Choose a reason for hiding this comment

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

Direct edits to auto-generated file will be lost

Medium Severity

The new [testenv:mypy] and [testenv:ruff] environments, along with their mypy: and ruff: factor-conditional deps and basepython entries, were added directly to tox.ini. However, tox.ini is auto-generated from scripts/populate_tox/tox.jinja, and the file itself begins with # DON'T EDIT THIS FILE BY HAND. tox.jinja has no corresponding changes, so the next run of scripts/generate-test-files.sh will silently overwrite and delete these new environments, making the tox -e mypy and tox -e ruff commands described in AGENTS.md disappear.

Additional Locations (1)

Fix in Cursor Fix in Web


[testenv:mypy]
commands =
mypy sentry_sdk
Copy link

Choose a reason for hiding this comment

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

New mypy env missing werkzeug dependency for type checking

Medium Severity

The new [testenv:mypy] environment only installs requirements-linting.txt but is missing werkzeug<2.3.0, which is explicitly included in [testenv:linters] via linters: werkzeug<2.3.0. Because sentry_sdk/integrations/flask.py imports from werkzeug.datastructures import FileStorage, ImmutableMultiDict under TYPE_CHECKING, mypy will attempt to resolve those types. Since werkzeug has no ignore_missing_imports override in pyproject.toml, running tox -e mypy (as instructed in AGENTS.md) will fail with a missing import error that the linters env never surfaces.

Fix in Cursor Fix in Web

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

nice, do we want to keep .cursor or remove it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add AGENTS.md

3 participants