Repository navigation
[SDTEST-3895] Internal local testdrive analyzer - #137
Conversation
Codex Review SummaryThis 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. |
|
✅ All CI checks and tests passed. Datadog automation helped this PR pass. 🎉 All green!🧪 All tests passed 🔄 Datadog retried 1 test - 1 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: d323740 | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64ed4ff4a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
64ed4ff to
8ca0f56
Compare
d6b6649 to
873eb2c
Compare
There was a problem hiding this comment.
Two critical correctness bugs stand out: the grouping key does not include all test-identity fields (module, parameters, source position), causing distinct tests to be merged as retries and producing false flaky results and wrong counts; and coverage data is propagated only to the Tests slice, leaving FailedTests, FlakyTests, and SlowTests with empty coverage fields. A separate median-calculation defect causes CoveredFilesMedian to be reported as zero whenever exactly one coverage record exists.
🤖 Bits Code Review · Commit 64ed4ff · @DataDog review to ask questions
8ca0f56 to
afcb8a6
Compare
5dfcd23 to
e213074
Compare
415b043 to
805f534
Compare
283c281 to
622b335
Compare
805f534 to
59212b8
Compare
622b335 to
a01b66e
Compare
59212b8 to
65de703
Compare
a01b66e to
efb1c18
Compare
65de703 to
28e1498
Compare
efb1c18 to
a4f1361
Compare
28e1498 to
159ef0b
Compare
a4f1361 to
488fed9
Compare
159ef0b to
465a5f5
Compare
488fed9 to
58ec8c2
Compare
47e8964 to
f4fd8cd
Compare
58ec8c2 to
2c491ee
Compare
d97cabf to
d80100c
Compare
71c0250 to
df2b41c
Compare
d80100c to
51efab4
Compare
df2b41c to
f59d148
Compare
41fcda9 to
a0154d2
Compare
f59d148 to
7cfd1ec
Compare
a0154d2 to
4da8df0
Compare
7cfd1ec to
0d5101b
Compare
0d5101b to
8d719f3
Compare
There was a problem hiding this comment.
Two of the most critical correctness issues are: the test identity key omits module and parameter data, causing distinct parameterized or multi-module tests to be collapsed into one (producing false flaky results and wrong counts), and coverage data is attached to the main Tests list only after the FailedTests/FlakyTests/SlowTests lists are already copied, leaving those derived lists without coverage. Additional bugs include unnamed tests losing coverage due to a key mismatch, a zero-median miscalculation for single-record coverage runs, and a quadratic scan when attaching suite-level coverage.
🤖 Bits Code Review · Commit 8d719f3 · @DataDog review to ask questions
|
Addressed the seven automated review threads in ab27291 and the four human naming comments in d323740.
On d323740, Go 1.27.1 GitHub reports all 45 checks successful on this exact head, including the instrumented CI test job and coverage gate: https://github.com/DataDog/ddtest/actions/runs/35878198628. The dependent PRs #138–#147 have been rebased with explicit leases and their renamed API callers updated. Every resulting head passed full tests, lint and testdrive race checks locally; tree comparisons verified that downstream changes outside intake are only the required API substitutions. Remote CI is now green on all ten exact published descendant heads. No unresolved review threads remain. This PR is still open and requires human approval before merge; I will continue monitoring reviews, QA and CI. |
|
@autotest review |
|
Independent E2E QA rechecked head d323740 and reported no analyzer defect in the exercised scenarios. The QA run passed Corrected two instructions in the E2E plan:
This update changes only the PR's manual verification instructions; the code head is unchanged. QA used local intake traffic, with no production backend/UI validation. Temporary QA artifacts and debug logs were subsequently cleaned up at the user’s request. The final independent retest report is the durable results record. |
E2E retest report: PASSTested by: Shepherd Agent (autonomous QA for Datadog Test Optimization)
Issues found: No analyzer defect reproduced. Both previously reported E2E-plan issues are resolved by the revised instructions: separate Jest suites establish a meaningful broad-coverage comparison; the deterministic harness verifies absent coverage without relying on ineffective disable flags. No real-Jest coverage-disable flag is certified. Methodology: Ran the component's HTTP intake harness from an isolated checkout, with fresh intake sessions and real instrumented Jest traffic. Compared analyzer attempt counts, final statuses, and exact coverage file lists against captured HTTP payloads; asserted the deterministic scenarios. No production source changes were made. Datadog UI/backend verification: Not performed. This PR exposes a local analyzer component, and these runs targeted its loopback intake. This report does not claim production ingestion or UI validation. Temporary QA artifacts and debug logs are being cleaned up at the user's request; this comment records the final results. |
What
Group local test attempts by module, suite, name, and parameters; report failed, flaky, slow, and broadly covered tests with their coverage context. Surface tracer configuration errors and empty coverage separately from application failures.
Part 4/14 of #128, based on
mainafter #136 merged. Next: #138.Why
Customers need actionable findings rather than raw traffic or retry-inflated test counts.
E2E testing
This PR exposes a component, not a
testdrivecommand yet. Use Go 1.27.1 (as pinned ingo.mod) on this PR’s checkout. Create.qa-intake/main.gounder the DDTest root with the following manual harness, then rungo run ./.qa-intake. It prints a loopback URL and artifact directory and waits while QA sends traffic.In a separate temporary directory, prepare a real Node.js 22+ project:
Set
QA_INTAKE_URLto the harness URL and run the tracer against that local intake:Run the passing
addstest, then press Enter in the harness. Expect one logical test even if multiple retry events arrived, a passing final status, and coverage associated with sum.js.In a fresh harness session, change the expectation to
toBe(4)and rerun Jest. Expect Jest to fail and the printed findings to listaddsas failed with its assertion error. Received instrumentation must still be visible.In a fresh session, use a module-level attempt counter so a test fails on its first invocation and passes on retry. Confirm in the captured traffic that both outcomes arrived. Expect one logical test with multiple attempts and a flaky finding, not two independent tests. Compare its final status with the tracer’s final-status field.
Add three tests that finish immediately and one that waits 500 ms. Run in a fresh session. Expect the slow test in SlowTests and the fast tests absent from that list.
In a fresh disposable Jest project, create four separate test files (one test per file): three narrow suites that each load one source module, and one broad suite that loads twelve distinct source modules. Run with coverage in a fresh intake session. Jest emits suite-level coverage, so inspect BroadCoverage for the broad suite, with exactly its twelve source modules plus its test file (13 files). Compare the file list with captured coverage. Putting all four tests in one file gives them shared suite coverage and correctly produces no broad outlier. Verify unrelated coverage IDs with the deterministic HTTP scenario rather than adding unrelated files to a Jest suite.
To verify analysis when coverage is absent, create the deterministic harness below and run
go run ./.qa-findings no-coveragefrom the DDTest root. It sends test events without a coverage request. Expect 6 events / 5 logical tests, zero covered tests, zero empty entries, no broad-coverage findings, and unchanged failed/flaky/slow classifications. With the pinned dd-trace 6.15.0 setup,DD_CIVISIBILITY_CODE_COVERAGE_ENABLED=falseandDD_CIVISIBILITY_ITR_ENABLED=falsedo not disable collection: the tracer uses the intake settings response, which enablescode_coverage. This deterministic scenario verifies absent-coverage analysis; it does not certify a real-Jest coverage-disable flag.In a fresh harness, send a MessagePack test-cycle payload containing a passing test and a
test_session_endevent whosecontent.metaincludes_dd.ci.library_configuration_error.skippable_tests: "true". Use Python in the disposable QA environment (python -m pip install msgpack) and the snippet below. Close the harness: expect one test, no failed tests, andConfigurationErrors:[skippable_tests]. Repeat with the same true tag on a suite event: it must appear only once. Change it to"false": it must disappear.Cleanup: stop any remaining harness processes and remove
.qa-intakeplus the printed temporary QA directories after inspecting the artifacts.Also remove the temporary Jest repository.
Additional empty-coverage scenario: use the deterministic fixtures from #136’s E2E plan against this PR’s intake harness. POST the valid events and
coverage-empty.msgpack, then inspect the printed findings. ExpectEmptyCoverageEntryCount: 1, unchanged test/event counts, and zero covered tests. Repeat with mixed valid/empty coverage and empty suite coverage: both must retain that diagnostic and contribute no coverage. A valid-only control must have zero empty entries and retain its coverage association. Remove the temporary fixtures and harness after inspection.For deterministic identity and coverage regression checks, create
.qa-findings/main.gounder the repository root with the following harness (Go 1.27.1, no external service or credentials required):Run each command from the repository root and inspect the JSON:
go run ./.qa-findings test: expect HTTP 200 for both requests, 6 test events, 5 logical/covered tests, one failed test frommodule-two, one flaky parameter-2 test with two attempts, and one slow unnamed test. Every categorized finding must retain the same coverage as itsTestsentry. The parameter-1 test must cover only source-1.js; parameter-2 must cover source-2.js and source-3.js. ConfigurationErrors must contain skippable_tests without increasing failed-test counts.go run ./.qa-findings suite: expect the same test counts and categories, each with suite coverage for shared.js, including the unnamed test.go run ./.qa-findings single-testandgo run ./.qa-findings single-suite: expect 1 logical/covered test, CoveredFilesMedian 1, and no broad-coverage finding.go run ./.qa-findings empty: expect HTTP 200, 6 events/5 logical tests, EmptyCoverageEntryCount 1, zero covered tests and no coverage on any finding. The entire mixed payload is excluded.go run ./.qa-findings no-coverage: expect 6 events/5 tests, zero covered tests, zero empty entries, and the same failure/flaky/slow classification.Inspect each printed artifact directory before deleting it. Remove
.qa-findingsand the printed directories afterward.