Skip to content

Commit 094f524

Browse files
authored
Merge branch 'main' into chore/wrapping-improve-coding
2 parents e914f1c + 301a50b commit 094f524

File tree

867 files changed

+37247
-15208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

867 files changed

+37247
-15208
lines changed

.claude/CLAUDE.md

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,2 @@
1-
# dd-trace-py Project Guide
2-
3-
## Skills
4-
5-
This project has custom skills that provide specialized workflows. **Always check if a skill exists before using lower-level tools.**
6-
7-
### run-tests
8-
9-
**Use whenever:** Running any tests, validating code changes, or when "test" is mentioned.
10-
11-
**Purpose:** Intelligently runs the test suite using `scripts/run-tests`:
12-
- Discovers affected test suites based on changed files
13-
- Selects minimal venv combinations (avoiding hours of unnecessary test runs)
14-
- Manages Docker services automatically
15-
- Handles riot/hatch environment setup
16-
17-
**Never:** Run pytest directly or use `hatch run tests:test` - these bypass the project's test infrastructure.
18-
19-
**Usage:** Use the Skill tool with command "run-tests"
20-
21-
### lint
22-
23-
**Use whenever:** Formatting code, validating style/types/security, or before committing changes.
24-
25-
**Purpose:** Runs targeted linting and code quality checks using `hatch run lint:*`:
26-
- Formats code with Black and Ruff auto-fixes
27-
- Validates style, types, and security
28-
- Checks spelling and documentation
29-
- Validates test infrastructure (suitespec, riotfile, etc.)
30-
- Supports running all checks or targeting specific files
31-
32-
**Common Commands:**
33-
- `hatch run lint:fmt -- <file>` - Format a specific file after editing (recommended after every edit)
34-
- `hatch run lint:typing -- <file>` - Type check specific files
35-
- `hatch run lint:checks` - Run all quality checks (use before committing)
36-
- `hatch run lint:security -- -r <dir>` - Security scan a directory
37-
38-
**Never:** Skip linting before committing. Always run `hatch run lint:checks` before pushing.
39-
40-
**Usage:** Use the Skill tool with command "lint"
41-
42-
---
43-
44-
<!-- Add more skills below as they are created -->
1+
<!-- Do not edit. Canonical instructions live in ../AGENTS.md -->
2+
@../AGENTS.md

.claude/settings.local.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,38 @@
55
"Bash(grep:*)",
66
"Bash(python:*)",
77
"Bash(./scripts/events/generate_stub.py:*)",
8-
"Bash(hatch run lint:typing:*)",
98
"Bash(./scripts/ddtest:*)",
10-
"mcp__github__search_pull_requests",
11-
"mcp__github__get_pull_request",
12-
"mcp__atlassian__getJiraIssue",
13-
"mcp__github__get_pull_request_review_comments",
9+
"Bash(scripts/ddtest:*)",
10+
"Bash(scripts/run-tests:*)",
11+
"Bash(gh pr list:*)",
12+
"Bash(git remote:*)",
13+
"Bash(pyenv versions:*)",
14+
"Bash(pyenv virtualenv:*)",
15+
"Bash(mkdir:*)",
16+
"Bash(docker compose build:*)",
1417
"Bash(riot list:*)",
15-
"Read(//Users/brett.langdon/datadog/riot/**)",
18+
"Bash(riot -v run:*)",
1619
"Bash(hatch run docs:*)",
20+
"Bash(hatch run lint:fmt:*)",
21+
"Bash(hatch run lint:typing:*)",
22+
"Bash(hatch run lint:sg:*)",
1723
"Bash(cargo:*)",
1824
"Bash(source:*)",
1925
"Bash(pip install:*)",
20-
"WebFetch(domain:ast-grep.github.io)",
2126
"Bash(git grep:*)",
2227
"Bash(ast-grep scan:*)",
23-
"Bash(hatch run lint:sg:*)",
2428
"Bash(awk:*)",
25-
"mcp__github__pull_request_read",
29+
"WebFetch(domain:ast-grep.github.io)",
2630
"WebFetch(domain:github.com)",
31+
"WebFetch(domain:raw.githubusercontent.com)",
32+
"mcp__atlassian__getJiraIssue",
33+
"mcp__github__search_pull_requests",
34+
"mcp__github__get_pull_request",
35+
"mcp__github__get_pull_request_review_comments",
36+
"mcp__github__pull_request_read",
2737
"Skill(run-tests)",
28-
"Bash(scripts/run-tests:*)"
38+
"Skill(lint)"
2939
],
3040
"deny": []
3141
}
32-
}
42+
}

.claude/skills/lint/SKILL.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ Use this skill when you:
2626
- Need to validate test infrastructure (suitespec, log messages)
2727
- Want to run comprehensive quality checks before pushing
2828

29+
## Key Principles
30+
31+
1. **Always format after editing** - Use `hatch run lint:fmt -- <file>` immediately after code changes
32+
2. **Run comprehensive checks before committing** - Use `hatch run lint:checks` before pushing
33+
3. **Target specific files** - Use `-- <file>` syntax to validate only what you changed, not the entire codebase
34+
4. **Fix auto-fixable issues** - Use `fmt` instead of manually fixing style issues
35+
5. **Type check after adding types** - Use `hatch run lint:typing -- <file>` after adding type annotations
36+
2937
## Quick Start
3038

3139
**Run all checks (broad validation):**
@@ -48,7 +56,7 @@ hatch run lint:typing -- path/to/file.py
4856
### Code Formatting
4957

5058
#### `fmt` - Format code (recommended for most edits)
51-
Formats and validates code style using Black and Ruff.
59+
Formats and validates code style using Ruff.
5260

5361
**Usage:**
5462
```bash
@@ -63,7 +71,7 @@ hatch run lint:fmt -- ddtrace/contrib/flask/
6371
```
6472

6573
**What it does:**
66-
1. Runs Black formatter
74+
1. Runs the Ruff formatter
6775
2. Runs Ruff with --fix to auto-fix issues
6876
3. Re-validates with style checks
6977

@@ -94,20 +102,21 @@ hatch run lint:style -- ddtrace/
94102
```
95103

96104
**What it validates:**
97-
- Black formatting
105+
- Ruff formatting
98106
- Ruff linting rules
99107
- Cython linting
100108
- C code formatting
101109
- CMake formatting
102110

103111
**When to use:** To verify style compliance before committing without auto-fixes.
104112

105-
#### `black_check` - Check Black formatting
106-
Validates Python code formatting with Black (no auto-fix).
113+
#### `format_check` - Check formatting
114+
115+
Validates Python code formatting with `ruff format` (no auto-fix).
107116

108117
**Usage:**
109118
```bash
110-
hatch run lint:black_check -- ddtrace/tracer.py
119+
hatch run lint:format_check -- ddtrace/tracer.py
111120
```
112121

113122
**When to use:** Quick check of Python formatting before committing.

.claude/skills/run-tests/SKILL.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ Use this skill when you have:
2626
- Modified test infrastructure or configuration
2727
- Want to verify changes don't break existing functionality
2828

29+
## Key Principles
30+
31+
1. **Always use the run-tests skill** when testing code changes - it's optimized for intelligent suite discovery
32+
2. **Never run pytest directly** - bypasses the project's test infrastructure (use `scripts/run-tests` or `riot` via `scripts/ddtest`)
33+
3. **Minimal venvs for iteration** - run 1-2 venvs initially, expand only if needed
34+
4. **Use `--dry-run` first** - see what would run before executing
35+
5. **Follow official docs** - `docs/contributing-testing.rst` is the source of truth for testing procedures
36+
2937
## How This Skill Works
3038

3139
### Step 1: Identify Changed Files
@@ -116,6 +124,16 @@ For re-running specific tests:
116124
scripts/run-tests --venv <hash> -- -vv -k test_name
117125
```
118126

127+
## When Tests Fail
128+
129+
When you encounter test failures, follow this systematic approach:
130+
131+
1. **Review the failure details carefully** - Don't just skim the error, understand what's actually failing
132+
2. **Understand what's failing** - Don't blindly re-run; analyze the root cause
133+
3. **Make code changes** - Fix the underlying issue
134+
4. **Re-run with more verbosity if needed** - Use `-vv` or `-vvv` for detailed output
135+
5. **Iterate until tests pass** - Repeat the process with each fix
136+
119137
## Venv Selection Strategy in Detail
120138

121139
### Understanding Venv Hashes
@@ -255,13 +273,42 @@ scripts/run-tests --venv flask_py311 -- -vv -k test_view_called_twice
255273
- **Run tests without changes saved**: Make sure edits are saved first
256274
- **Iterate blindly**: Understand what's failing before re-running
257275

276+
## Additional Testing Resources
277+
278+
**For comprehensive testing guidance, refer to the contributing documentation:**
279+
280+
- **[docs/contributing-testing.rst](../../docs/contributing-testing.rst)** - Detailed testing guidelines
281+
- What kind of tests to write (unit tests, integration tests, e2e tests)
282+
- When to write tests (feature development, bug fixes)
283+
- Where to put tests in the repository
284+
- Prerequisites (Docker, uv)
285+
- Complete `scripts/run-tests` usage examples
286+
- Riot environment management details
287+
- Running specific test files and functions
288+
- Test debugging strategies
289+
290+
- **[docs/contributing.rst](../../docs/contributing.rst)** - PR and testing requirements
291+
- All changes need tests or documented testing strategy
292+
- How tests fit into the PR review process
293+
- Testing expectations for different types of changes
294+
295+
- **[docs/contributing-design.rst](../../docs/contributing-design.rst)** - Test architecture context
296+
- How products, integrations, and core interact
297+
- Where different types of tests should live
298+
- Testing patterns for each library component
299+
300+
**When to reference these docs:**
301+
- First time writing tests for this project → Read `contributing-testing.rst`
302+
- Understanding test requirements for PRs → Read `contributing.rst`
303+
- Need context on test architecture → Read `contributing-design.rst`
304+
258305
## Troubleshooting
259306

260307
### Docker services won't start
261308
```bash
262309
# Manually check/stop services:
263-
docker-compose ps
264-
docker-compose down
310+
docker compose ps
311+
docker compose down
265312
```
266313

267314
### Can't find matching suites

0 commit comments

Comments
 (0)