From 233f0c05f8cc0b6362541a9df81920181c79e5bd Mon Sep 17 00:00:00 2001 From: Roberto Montero Date: Fri, 13 Nov 2026 17:49:53 +0100 Subject: [PATCH 1/2] [TEST] Review learning: rule changes from 2026-10-01 to 2026-10-31 Test of the --address flow. Do not merge. The changes come from a local run of review learning. --- .../rules/code-review/activation-and-metadata.md | 14 ++++++++++++-- .../code-review/infrastructure-and-conventions.md | 10 ++++++++++ .../rules/code-review/lifecycle-and-isolation.md | 8 ++++++++ .agents/rules/code-review/test-effectiveness.md | 9 +++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.agents/rules/code-review/activation-and-metadata.md b/.agents/rules/code-review/activation-and-metadata.md index bec7e14d122..f14c7e216bd 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. Several exclusions with different causes share one vague reason or carry no reason. A marked test fails in setup on invalid configuration or a missing secret, and the marker does not say so. - ✅ 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) @@ -60,7 +60,7 @@ - Old_id: claude-06 - Severity: P0 - Flag: A feature whose docstring links a Feature Parity Dashboard entry must pass that id as `feature_id`, not `NOT_REPORTED_ID`. -- Detect: A feature in `utils/_features.py` links `feature-parity.us1.prod.dog/#/?feature=` and passes `feature_id=NOT_REPORTED_ID`. +- Detect: A feature in `utils/_features.py` links `feature-parity.us1.prod.dog/#/?feature=` and passes `feature_id=NOT_REPORTED_ID`. A PR adds a feature that passes `feature_id=NOT_REPORTED_ID` and has no dashboard link. - ✅ The docstring links `?feature=544` and the code passes `feature_id=544`. - ❌ The docstring links `?feature=544` and the code passes `feature_id=NOT_REPORTED_ID`. - Ref: [Create a feature](../../../docs/edit/features.md#hello-world-test) @@ -74,3 +74,13 @@ - ✅ Add, remove, or rename the workflow step in the same PR as the scenario. - ❌ Add a named scenario without its workflow step, even when its scenario groups are otherwise valid. - Ref: [End-to-end testing rules](../end-to-end-testing.md) + +### META-010: Gate each method at the versions that have its behavior. +- Severity: P0 +- Flag: A version gate that lets a method run on a release without its behavior. If a manifest activates a class or a file at one version, every method must pass from that version. If a method needs a later version, add a method-level entry with that version. If a later release changes the asserted behavior, the range must end before that release. If a change ships on several active release lines, the range must cover each line. +- Detect: A class-level or file-level entry sets one version, and a method asserts behavior that a later release added. A version floor has no upper bound, and a later release changed the asserted behavior. A version range in a manifest or in `tests/parametric/capabilities.yml` omits an active release line with the same change. + +### META-011: Link a test class to the RFC that it implements. +- Severity: P1 +- Flag: A test class that implements an RFC and has no `@rfc` decorator. If an RFC defines the behavior that a test class checks, the class must carry `@rfc("")` from `utils`. +- Detect: A new test class checks behavior from an RFC that the PR or the feature names. The class has no `@rfc` decorator. diff --git a/.agents/rules/code-review/infrastructure-and-conventions.md b/.agents/rules/code-review/infrastructure-and-conventions.md index a4b93d012e0..96c610abcdd 100644 --- a/.agents/rules/code-review/infrastructure-and-conventions.md +++ b/.agents/rules/code-review/infrastructure-and-conventions.md @@ -73,3 +73,13 @@ - ✅ Add the `/new_endpoint` route to the weblogs and its section to `end-to-end_weblog.md` in the same pull request. - ❌ Add a field to the response of a parametric endpoint, and leave `parametric_weblog.md` unchanged. - Ref: [Weblogs](../../../docs/understand/weblogs/README.md) + +### INFRA-011: Keep local build output out of the Docker build context. +- Severity: P1 +- Flag: A new weblog or test app that builds locally into a folder must exclude that folder in `.dockerignore`. Add the pattern in the same pull request. Examples are a cargo `target/`, a dotnet `bin/` or `obj/`, or a `node_modules/`. +- Detect: A new app under `utils/build/docker/` has a local build output folder, and no `.dockerignore` pattern excludes it. + +### INFRA-013: Stop the session when a component fails to start. +- Severity: P1 +- Flag: A failure to provision or start a scenario component must stop the session with an error. The framework must first keep the logs. It must not store the error and let the tests run. +- Detect: An error handler in `utils/` catches a startup or provisioning error and only logs or stores it. The session then continues to the test phase. diff --git a/.agents/rules/code-review/lifecycle-and-isolation.md b/.agents/rules/code-review/lifecycle-and-isolation.md index d4d86ab94bd..85d8297dc86 100644 --- a/.agents/rules/code-review/lifecycle-and-isolation.md +++ b/.agents/rules/code-review/lifecycle-and-isolation.md @@ -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-006: Keep one active Remote Config file per product and case. +- Severity: P0 +- Flag: A setup that applies several Remote Config files in turn must replace or remove the earlier file. Do this before the next request. Several active files of one product can overwrite each other in an order that the SDK chooses. +- Detect: One setup calls `rc.tracer_rc_state.set_config()` with a new path for the same product. The earlier path stays active, and the test expects only the new config. +- Not when: The test is about how the SDK handles several active files of one product. +- ✅ Reuse one config path, so each `set_config()` call replaces the previous config. Call `rc.tracer_rc_state.reset()` to start a new case. +- ❌ Add a second flag file at a new path while the first file stays active. diff --git a/.agents/rules/code-review/test-effectiveness.md b/.agents/rules/code-review/test-effectiveness.md index 4a68ef64fef..2e62e9dda05 100644 --- a/.agents/rules/code-review/test-effectiveness.md +++ b/.agents/rules/code-review/test-effectiveness.md @@ -28,7 +28,7 @@ - Old_id: claude-13 - Severity: P0 - Flag: A test of behavior that does not depend on the trace encoding must give the same result for v0.4, v0.5, and v1.0 payloads. Compare trace IDs with `trace_id_equals()`, read the sampling priority with `get_sampling_priority()`, and filter intake requests with `interfaces.library.trace_paths`. Use `is_same_boolean()` only when the contract accepts `True`, `1`, and `"true"` as the same value. A test of the wire format itself must check the exact fields and types of its encoding. -- Detect: A test that is not about the encoding compares raw fields, as in `span["trace_id"] == expected` or `meta[key] == "true"`. A test reads a sampling priority field directly. A path filter lists only `/v0.4/traces` or `/v0.5/traces`. +- Detect: A test that is not about the encoding compares raw fields, as in `span["trace_id"] == expected` or `meta[key] == "true"`. A test reads a sampling priority field directly. A path filter lists only `/v0.4/traces` or `/v0.5/traces`. A test mocks Agent responses for some paths of `interfaces.library.trace_paths`, but not for all of them. - Not when: The test is explicitly validating the wire format itself. - ✅ `assert span.trace_id_equals(int(expected_id))`. - ❌ `assert span["trace_id"] == int(expected_id)`. @@ -55,7 +55,12 @@ - Old_id: codex-21 - Severity: P1 - Flag: When the test uses a fake Agent or backend, its request and response must match the real service. Check that shape in the spec, the real code, or a real capture. Do not copy the expected JSON from the fake. A deliberately broken response belongs only in the test of that error. -- Detect: The self-test imports every expected value from the fake. The fake returns a bare body where the real service uses an envelope. The fake sends config for a product the client did not ask for. +- Detect: The self-test imports every expected value from the fake. The fake returns a bare body where the real service uses an envelope. The fake sends config for a product the client did not ask for. A test asserts a request property, such as a content type, that the test agent changes before capture. - Not when: The test intentionally validates a deliberately broken response. - ✅ Return the real backend envelope under `data.attributes`, and derive the check from the real contract. - ❌ Return the flag config as the whole body and make the self-test expect that same body. + +### TEST-008: Make each assertion able to fail on the defect it targets. +- Severity: P0 +- Flag: Each assertion must fail when the SDK lacks the behavior under test. A status code proves only that a route exists. If the endpoint catches every error and returns OK, the status proves nothing. Check each subject, case, and expected field on its own, not as one sum. If sibling tests use a shared assertion helper, a new test must use it too. Do not loosen a helper to accept output that breaks the contract. +- Detect: A regex accepts empty groups, so a missing value still matches. A test asserts only `status_code == 200` on an endpoint that catches every exception. A count sums several subjects, so data from the wrong subject still passes. A type check covers one side only, so `1 == True` passes. A fixture carries expected fields that the runner never asserts. A helper adds a fallback for one SDK that breaks the payload contract. From a3fb505cb665b011cedfe5e1f56ecf1808b2b887 Mon Sep 17 00:00:00 2001 From: Roberto Montero Date: Mon, 16 Nov 2026 08:04:48 +0100 Subject: [PATCH 2/2] Apply review feedback from #8505 --- .agents/rules/code-review/activation-and-metadata.md | 5 ----- .../rules/code-review/infrastructure-and-conventions.md | 5 ----- .agents/rules/code-review/lifecycle-and-isolation.md | 8 -------- 3 files changed, 18 deletions(-) diff --git a/.agents/rules/code-review/activation-and-metadata.md b/.agents/rules/code-review/activation-and-metadata.md index f14c7e216bd..04474a562ba 100644 --- a/.agents/rules/code-review/activation-and-metadata.md +++ b/.agents/rules/code-review/activation-and-metadata.md @@ -75,11 +75,6 @@ - ❌ Add a named scenario without its workflow step, even when its scenario groups are otherwise valid. - Ref: [End-to-end testing rules](../end-to-end-testing.md) -### META-010: Gate each method at the versions that have its behavior. -- Severity: P0 -- Flag: A version gate that lets a method run on a release without its behavior. If a manifest activates a class or a file at one version, every method must pass from that version. If a method needs a later version, add a method-level entry with that version. If a later release changes the asserted behavior, the range must end before that release. If a change ships on several active release lines, the range must cover each line. -- Detect: A class-level or file-level entry sets one version, and a method asserts behavior that a later release added. A version floor has no upper bound, and a later release changed the asserted behavior. A version range in a manifest or in `tests/parametric/capabilities.yml` omits an active release line with the same change. - ### META-011: Link a test class to the RFC that it implements. - Severity: P1 - Flag: A test class that implements an RFC and has no `@rfc` decorator. If an RFC defines the behavior that a test class checks, the class must carry `@rfc("")` from `utils`. diff --git a/.agents/rules/code-review/infrastructure-and-conventions.md b/.agents/rules/code-review/infrastructure-and-conventions.md index 96c610abcdd..052b9d6a36e 100644 --- a/.agents/rules/code-review/infrastructure-and-conventions.md +++ b/.agents/rules/code-review/infrastructure-and-conventions.md @@ -78,8 +78,3 @@ - Severity: P1 - Flag: A new weblog or test app that builds locally into a folder must exclude that folder in `.dockerignore`. Add the pattern in the same pull request. Examples are a cargo `target/`, a dotnet `bin/` or `obj/`, or a `node_modules/`. - Detect: A new app under `utils/build/docker/` has a local build output folder, and no `.dockerignore` pattern excludes it. - -### INFRA-013: Stop the session when a component fails to start. -- Severity: P1 -- Flag: A failure to provision or start a scenario component must stop the session with an error. The framework must first keep the logs. It must not store the error and let the tests run. -- Detect: An error handler in `utils/` catches a startup or provisioning error and only logs or stores it. The session then continues to the test phase. diff --git a/.agents/rules/code-review/lifecycle-and-isolation.md b/.agents/rules/code-review/lifecycle-and-isolation.md index 85d8297dc86..d4d86ab94bd 100644 --- a/.agents/rules/code-review/lifecycle-and-isolation.md +++ b/.agents/rules/code-review/lifecycle-and-isolation.md @@ -32,11 +32,3 @@ - ✅ 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-006: Keep one active Remote Config file per product and case. -- Severity: P0 -- Flag: A setup that applies several Remote Config files in turn must replace or remove the earlier file. Do this before the next request. Several active files of one product can overwrite each other in an order that the SDK chooses. -- Detect: One setup calls `rc.tracer_rc_state.set_config()` with a new path for the same product. The earlier path stays active, and the test expects only the new config. -- Not when: The test is about how the SDK handles several active files of one product. -- ✅ Reuse one config path, so each `set_config()` call replaces the previous config. Call `rc.tracer_rc_state.reset()` to start a new case. -- ❌ Add a second flag file at a new path while the first file stays active.