From 78a3b1b73beb7bbbf9408a7ca6c43b74c835fc19 Mon Sep 17 00:00:00 2001 From: "dd-apm-ecosystems[bot]" <183529005+dd-apm-ecosystems[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:52:11 +0000 Subject: [PATCH 1/4] Review learning: rule changes from 2026-11-03 to 2026-11-22 --- .agents/rules/code-review/activation-and-metadata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/rules/code-review/activation-and-metadata.md b/.agents/rules/code-review/activation-and-metadata.md index bec7e14d122..89fb36b254f 100644 --- a/.agents/rules/code-review/activation-and-metadata.md +++ b/.agents/rules/code-review/activation-and-metadata.md @@ -41,7 +41,7 @@ - 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. +- 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. A declaration has no reason in parentheses. A file-level declaration hides classes that pass or that fail for other causes. A `flaky` declaration hides a deterministic bug in the test logic. - ✅ 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. - Ref: [Declaration decorators](../../../docs/edit/skip-tests.md#declaration-decorators) From 02d0ddc4832eb30406ba70003035216517c84229 Mon Sep 17 00:00:00 2001 From: "dd-apm-ecosystems[bot]" <183529005+dd-apm-ecosystems[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:52:13 +0000 Subject: [PATCH 2/4] Review learning: rule changes from 2026-11-03 to 2026-11-22 --- .agents/rules/code-review/lifecycle-and-isolation.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.agents/rules/code-review/lifecycle-and-isolation.md b/.agents/rules/code-review/lifecycle-and-isolation.md index d4d86ab94bd..3288221a83d 100644 --- a/.agents/rules/code-review/lifecycle-and-isolation.md +++ b/.agents/rules/code-review/lifecycle-and-isolation.md @@ -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. @@ -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: P0 +- 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"` From 76e3f041a25e99f00ec2c801309159bf84cf94b2 Mon Sep 17 00:00:00 2001 From: "dd-apm-ecosystems[bot]" <183529005+dd-apm-ecosystems[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:16:19 +0000 Subject: [PATCH 3/4] Apply the review comments --- .agents/rules/code-review/activation-and-metadata.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.agents/rules/code-review/activation-and-metadata.md b/.agents/rules/code-review/activation-and-metadata.md index 89fb36b254f..fbc3c179163 100644 --- a/.agents/rules/code-review/activation-and-metadata.md +++ b/.agents/rules/code-review/activation-and-metadata.md @@ -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. A declaration has no reason in parentheses. A file-level declaration hides classes that pass or that fail for other causes. A `flaky` declaration hides a deterministic bug in the test logic. +- 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. From 238102a9fc98fd722964fb73e70178aef1d598cb Mon Sep 17 00:00:00 2001 From: "dd-apm-ecosystems[bot]" <183529005+dd-apm-ecosystems[bot]@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:40:23 +0000 Subject: [PATCH 4/4] Apply the review comments --- .agents/rules/code-review/lifecycle-and-isolation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/rules/code-review/lifecycle-and-isolation.md b/.agents/rules/code-review/lifecycle-and-isolation.md index 3288221a83d..6361539dfd3 100644 --- a/.agents/rules/code-review/lifecycle-and-isolation.md +++ b/.agents/rules/code-review/lifecycle-and-isolation.md @@ -34,7 +34,7 @@ - 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: P0 +- 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.