Repository navigation
Review learning: rule changes from 2026-11-03 to 2026-11-22 - #8648
dd-apm-ecosystems[bot] wants to merge 4 commits into
Conversation
|
|
| - 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. |
There was a problem hiding this comment.
From what I understand, it should be simplified and rephrased :
Follow marker semantics :
- Use irrelevant when the test will never be activated (not possible/ RFC explicitly says the feature is not supported)
- Use missing_feature when the feature is not implemented
- Use incomplete_test_app when the weblog lack an endpoint
- Use flaky when the test outcome is not stable (whatever the reason)
- Use bug when the feature is implemented, but the test fails deterministicly
Detect : anything (comments, weblog code, tracer code, RFC) contradicts the used marker.
There was a problem hiding this comment.
Edited META-006 in 76e3f04. I simplified Flag into the marker semantics the reviewer listed, made Detect flag any source that contradicts the marker, and cut the example of a failure during setup.
The review learning workflow answers once a day. It does not read this reply.
| - 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 |
There was a problem hiding this comment.
set the severity to P1
There was a problem hiding this comment.
Edited LIFE-005 in 238102a. The severity of LIFE-005 is now P1, as the reviewer asked.
The review learning workflow answers once a day. It does not read this reply.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Note
Monthly review learning. 3 changes to the code review rules, learned from the 247 PRs merged from 2026-11-03 to 2026-11-22.
Review them in Files changed, and answer on each rule:
ok,discard, a suggestion, or a comment. Once a day, a workflow applies the answers and replies.🆕 New rules (1)
Rules that the review does not have yet. Open the last cell of a row for what it does, why, a bad and a good example, and the evidence.
LIFE-005Three pull requests show exact counts that depend on flush or bucket timing.
What it does: 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.
Why is this bad? Three pull requests show exact counts that depend on flush or bucket timing. One test assumed a single 10s stats bucket. One asserted a scenario-wide telemetry count that races the flush interval. One stopped waiting once the expected span count showed up. No existing rule names this defect.
Example
Use instead
Merge stats entries across all requests and buckets by aggregation key, then sum the counters.
Evidence:
correction: "so it depends on every metric point being flushed before teardown"correction: "This returns as soon as 2 spans show up, so a third evaluation landing in a later flush wouldn't be caught."miss(culprit #5543)🔧 Existing rules, tuned (2)
Rules that exist, with a new case, a new exception, or better words. The Change column says which. Open the last cell of a row for the details.
META-006META-006 requires a marker and reason that match the real cause, but its Detect line misses three cases.
What it does: 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
flakydeclaration hides a deterministic bug in the test logic.Why is this bad? META-006 requires a marker and reason that match the real cause, but its Detect line misses three cases. In one, missing_feature entries had no reason. In another, a whole file was declared incomplete_test_app and that hid passing classes. In the third, a flaky declaration hid a deterministic tag assertion bug.
Example
Use instead
The fix removed the flaky declarations and added adjust_meta_checks_for_schema, which expects the _dd.p.ts tag when the span carries an API Security schema.
Evidence:
correction: "Would you consider declaring these per class with the real cause, or letting the ones that pass run?"absence(culprit #8348)correction: "These newmissing_featureentries have no reason."LIFE-002The ffe_start and ffe_evaluate POSTs had no HTTP timeout.
What it does: 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.
Why is this bad? The ffe_start and ffe_evaluate POSTs had no HTTP timeout. That is an unbounded wait that the current Detect wording, which only mentions polling, does not catch. Separately, an app-started wait used half the usual budget and could fail on a busy CI runner.
Example
Evidence:
correction: "Please give the POST a finite timeout and add a control where termination fails."correction: "Please passtimeout=self.timeoutinParametricTestClientApi.ffe_evaluate()"correction: "Otherwait_for_telemetry_event("app-started", ...)call sites in this repo"13 more changes with evidence from one PR only. They stay out of the diff. Comment
add <ID>to apply one.META-010INFRA-007INFRA-005!cancelled()but also required the weblog build to succeed, so PARAMETRIC runs saved no logs.INFRA-013INFRA-014LIFE-003TEST-001TEST-001TEST-004TEST-007TEST-007TEST-008TEST-009META-010· new rule: Validate a lowered version on every weblog it activates. · activation-and-metadataNo rule covers a version gate whose evidence is narrower than the set of weblogs that the entry activates.
Proposed:
Proposed severity: P1. An unvalidated activation shows up as visible failures on other variants and does not hide any coverage.
Evidence:
correction: "If I read the description correctly, 1.67.0 was validated on API Gateway v2 only"INFRA-007· sharpen Detect · infrastructure-and-conventionsINFRA-007 already asks for a retry on brittle fetches. Its Detect only names CI steps that pull from a registry, so it missed a base-image build script that runs curl on a GitHub tarball with no retry.
Current:
Proposed:
Evidence:
correction: "can you add a retry policy"INFRA-005· sharpen Detect · infrastructure-and-conventionsThe upload step used
!cancelled()but also required the weblog build to succeed, so PARAMETRIC runs saved no logs. The current Detect does not cover extra conditions on the outcome of another step.Current:
Proposed:
Evidence:
correction: "with parametric, you won't have any logs saved"INFRA-013· new rule: Implement backend behavior in the shared mocked backend. · infrastructure-and-conventionsNo rule in any lens says where mocked backend behavior must live. A maintainer asked to move the endpoint behavior from the test into the shared mocked backend, and the author did it.
Proposed:
Proposed severity: P1. A handler defined in one test duplicates the mock and can drift from it, but it does not by itself hide a failure.
Evidence:
correction: "can you add it directly in the mocked backend, rather dynamically in a test ?"INFRA-014· new rule: Do not hide broken weblog dependencies. · infrastructure-and-conventionsINFRA-011 covers hidden shell errors only. No rule covers weblog code that hides a broken dependency behind a broad ImportError handler. The author applied the requested find_spec gate.
Proposed:
Proposed severity: P0. A swallowed import error turns a broken install into a 501 response, so the test fails or gets skipped for the wrong reason.
Evidence:
correction: "on anthropic>=0.84 this also swallows a brokenmcpinstall"LIFE-003· sharpen Detect · lifecycle-and-isolationThe root cause is a helper that reads telemetry from the shared test agent without scoping it to the restarted runtime. Stale app-started data from the old runtime matched. LIFE-003 already requires matching the reply to its action, but its Detect only names request ids and config versions.
Current:
Proposed:
Evidence:
miss(culprit #7196)TEST-001· sharpen Detect · test-effectivenessThe flag already forbids counts that the protocol does not define. Detect missed stats tests that assume one wall-clock bucket and flake at bucket boundaries.
Current:
Proposed:
Evidence:
miss(culprit #5543)TEST-001· sharpen Flag · test-effectivenessComparing a serialized JSON string to Python json.dumps output rejects valid output from other tracers because of separator choices. The rule covers unrelated formatting, but its fields did not name this case.
Current:
Proposed:
Evidence:
correction: "Once nodejs implements this,JSON.stringifygives"TEST-004· sharpen Flag · test-effectivenessA check relaxed for v1 payload-level git tags dropped the strict first-span-only check for v0.4 and v0.5 too. The rule covers encoding differences but did not say to keep the strict check for the other encodings.
Current:
Proposed:
Evidence:
correction: "Shouldn't we still be validating the git tags are only on the first span for them?"TEST-007· sharpen Flag · test-effectivenessThe mock could drift from the shared evaluation vectors without failing CI. The only test that used it was xfail for every SDK, and the self-test checked only the selected keys.
Current:
Proposed:
Evidence:
correction: "Add a test-the-test check that each suite case file agrees with the mock."correction: "Also compare the mock's normalized selection with each vector'ssdk.selection."TEST-007· sharpen Detect · test-effectivenessThe mock backend checked the whole query for strict equality and returned 404 for a client capability parameter, so SDK tests failed with PROVIDER_NOT_READY.
Current:
Proposed:
Evidence:
absence(culprit #7365)TEST-008· new rule: Do not treat a failed command as an empty result. · test-effectivenessNo rule covers a test that treats a failed container exec like an empty result. The process discovery test could then drop real holders and pass for the wrong reason.
Proposed:
Proposed severity: P0. If an exec failure counts as an empty result, the test can pass without checking anything.
Evidence:
correction: "if rc:treats exec failures like pgrep no-match, so real holders can vanish fromholders."TEST-009· new rule: Check a run-wide guarantee over the whole run. · test-effectivenessTest_V1PayloadByDefault was narrowed to one request, so a tracer that falls back to v0.4 later in the run would pass. No existing rule names this loss of scope.
Proposed:
Proposed severity: P0. If the check covers only one request, the test misses a fallback later in the run.
Evidence:
correction: "Is it possible a tracer could downgrade back down to v0.4 and we wouldn't catch it here?"5 defects that a rule already describes
INFRA-008· infrastructure-and-conventions: INFRA-008 already requires exact pins or a lockfile for every dependency that the weblog does not test, including the transitive dependencies of mcp. #8441INFRA-011· infrastructure-and-conventions: INFRA-011 already describes this exact `find ... #8572INFRA-012· infrastructure-and-conventions: INFRA-012 already flags a new weblog Dockerfile that starts withFROM python:3.11-slimand runs apt-get and pip install. #8554TEST-002· test-effectiveness: TEST-002 already asks for a positive control and names new skip.yml entries as a review signal. #8398TEST-005· test-effectiveness: A condition on context.library inside an assertion is the case that TEST-005 detects. #8306How to answer, and run details
How to answer each change
ok,LGTMor a thumbs up: keep the change.discardordiscard: <reason>: put the rule back as it is onmain. Outside a review thread, name the rule:discard LIFE-005.add <ID>: apply a folded change, for example one with evidence from one PR only.Not when:. The next runs read the rules.This PR only edits
.agents/rules/code-review/. It never merges by itself: a person fromsystem-tests-coreapproves it. The next monthly run publishes nothing while it is open.Not applied
META-011INFRA-015Human-only review and outside context: never rule material.
context: FFE flag-selection test encoded reject behavior that conflicts with the external flag-selection RFC and shared vectors.context: Java manifest activation depends on an unmerged dd-trace-java change (PR 12901) for dev builds.context: Dotnet manifest: OTEL_ENABLED startup-log tests disabled temporarily to unblock a dd-trace-dotnet merge; the easy-wins script will reactivate them.Coverage: test-effectiveness 12 · lifecycle-and-isolation 6 · activation-and-metadata 4 · infrastructure-and-conventions 11. 63 candidates went to another lens. 1 candidates had a quote that does not match.
Run: the workflow run in Datadog.