Skip to content
Open
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
6 changes: 3 additions & 3 deletions .agents/rules/code-review/activation-and-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
### META-006: Match each manifest marker to its cause.
- Old_id: claude-07
- Severity: P1
- Flag: Pick the marker that matches the cause. When one PR excludes tests for different causes, give each exclusion its own reason, and make each reason state the real cause. By default, markers other than `irrelevant` and `flaky` become a non-strict xfail, and `conftest.py` also records a fixture error as `xfailed`. When a marked test fails before its assertions, the reason must name that failure.
- Detect: A marker contradicts its cause, or several exclusions with different causes share one vague reason. A marked test fails during setup because of invalid configuration or a missing required secret that the marker does not describe.
- Flag: Pick the marker that matches the cause. If the test will never be activated, use `irrelevant`. This applies when the test is not possible, or the RFC says the feature is not supported. If the feature is not implemented, use `missing_feature`. If the weblog lacks an endpoint, use `incomplete_test_app`. If the test outcome is not stable for any reason, use `flaky`. If the feature is implemented but the test fails deterministically, use `bug`.
- Detect: Any source contradicts the marker in use, such as comments, weblog code, tracer code, or an RFC.
- ✅ Use `incomplete_test_app (weblog has no /ffe endpoint)` when the weblog does not implement the endpoint.
- ❌ Use `missing_feature` for an endpoint that the weblog does not implement. Set `DD_TRACE_AGENT_PORT` to the literal `agent.port`, causing the library to exit at startup while the run reports an expected failure.
- ❌ Use `missing_feature` for an endpoint that the weblog does not implement.
- Ref: [Declaration decorators](../../../docs/edit/skip-tests.md#declaration-decorators)

### META-007: Do not let a minimum dev version match an older release candidate.
Expand Down
10 changes: 9 additions & 1 deletion .agents/rules/code-review/lifecycle-and-isolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
### LIFE-002: Avoid fixed sleeps and unbounded waits
- Severity: P1
- Flag: Do not use `time.sleep()`, fixed delays, or unbounded polling to wait for end-to-end data. Use `agent_interface_timeout` or `library_interface_timeout` for the general post-setup flush window. Use a bounded condition wait in `setup_*` when a specific condition must be observed before teardown or before triggering a subsequent action.
- Detect: A setup or test uses a fixed sleep, polls without a deadline, or increases an arbitrary delay instead of waiting for an observable condition.
- Detect: A setup or test uses a fixed sleep, polls without a deadline, or increases an arbitrary delay instead of waiting for an observable condition. An HTTP call to the test app has no timeout, so a silent app blocks the test and its retry deadline. A wait uses a shorter timeout than other call sites of the same helper.
- Not when: The delay itself is the behavior under test and no observable condition can represent it.
- ✅ Configure the scenario flush timeout for general data collection, or use `interfaces.library.wait_for(condition, timeout=...)` for a specific condition.
- ❌ Use `time.sleep(30)` before assuming that traces or Remote Config are ready.
Expand All @@ -32,3 +32,11 @@
- ✅ Store the response and wait result during setup, then assert and inspect the captured data in `test_*`.
- ❌ Poll for traces in `test_*` after the containers have stopped, or assert expected trace contents from `setup_*`.
- Ref: [End-to-end test flow](../../../docs/understand/test-flow.md#end-to-end-scenario), [Flushing default behavior](../../../docs/edit/flushing.md#default-behavior)

### LIFE-005: Do not tie counts to one flush or one bucket.
- Severity: P1
- Flag: Telemetry, stats, and spans can arrive over several flushes and time buckets. If a test asserts an exact count, it must merge all payloads and buckets. The wait must also last long enough for late payloads to arrive.
- Detect: A test reads only the first stats bucket or asserts that there is one bucket. A wait returns as soon as the expected count appears, and then the test asserts that exact count. A test asserts an exact scenario-wide metric count that needs every point flushed before teardown.
- Not when: The payload format guarantees one bucket or one flush for the data under test.
- ✅ Merge stats entries across all requests and buckets by aggregation key, then sum the counters.
- ❌ `assert len(buckets) == 1, "There should be one bucket containing the stats"`
Loading