Skip to content

fix(test-optimization): restore pre-defer suite reporting - #10017

Merged
juan-fernandez merged 9 commits into
masterfrom
juan-fernandez/report-test-suites-immediately
Aug 28, 2026
Merged

juan-fernandez merged 9 commits into
masterfrom
juan-fernandez/report-test-suites-immediately

Conversation

@juan-fernandez

@juan-fernandez juan-fernandez commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Restores test-suite reporting to its behavior before deferred-suite storage was introduced. Framework integrations finish suite spans at their natural lifecycle boundary, while normal trace buffering decides when the completed trace is sent. The exporter no longer retains, rewrites, or separately replays suite events.

This does not add a suite-level partial-flush boundary or promise immediate delivery. Mocha keeps its pre-existing framework-error behavior: if reporter finalization fails while suite spans are still buffered, the suite, module, and session receive the framework error.

Motivation

Deferred-suite storage added cross-framework lifecycle plumbing and late span mutation that proved undesirable. Returning to the established reporting path removes that machinery without changing the normal batching behavior each framework already had.

This change is extracted from #9987 so the lifecycle rollback can be reviewed independently while #9987 remains the combined E2E validation branch.

Additional Notes

Verification:

  • 65 CI Visibility exporter unit tests
  • 27 focused Mocha reporter-error integration tests
  • Old-agent APM protocol integration coverage
  • Targeted Cucumber, Cypress CommonJS/ESM, Jest, Mocha, and Vitest integration cases
  • Scoped ESLint and git diff --check

@dd-octo-sts

dd-octo-sts Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 8.42 MB
Deduped: 9.09 MB
No deduping: 9.09 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 445.14 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

datadog-official Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 98.59% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c6599ed | Docs | View more details | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8118ae7569

ℹ️ 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".

Comment thread packages/datadog-plugin-mocha/src/index.js

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: FAIL

Finishing a suite span does not export it while its parent module and session spans remain open. Normal framework runs therefore keep suites buffered until finalization, so the change does not provide immediate suite reporting.

Open Bits AI session

🤖 Datadog Autotest · Commit 8118ae7 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread packages/datadog-plugin-mocha/src/index.js
@pr-commenter

pr-commenter Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-28 08:24:25

Comparing candidate commit c6599ed in PR branch juan-fernandez/report-test-suites-immediately with baseline commit c1b5aaf in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2295 metrics, 15 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:debugger-enabled-but-breakpoint-not-hit-20

  • unstable cpu_user_time [-479.784ms; +568.691ms] or [-5.268%; +6.244%]
  • unstable execution_time [-481.327ms; +573.263ms] or [-5.282%; +6.291%]
  • unstable throughput [-1587022.392op/s; +1357057.800op/s] or [-5.763%; +4.928%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable max_rss_usage [-13803.027KB; +12777.427KB] or [-5.561%; +5.148%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-148.626ms; +458.769ms] or [-3.110%; +9.600%]
  • unstable execution_time [-146.569ms; +456.936ms] or [-3.018%; +9.410%]
  • unstable throughput [-165485.601op/s; +48716.030op/s] or [-9.573%; +2.818%]

scenario:fs-subscribed-24

  • unstable execution_time [-19.692ms; +34.806ms] or [-4.810%; +8.502%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-26

  • unstable cpu_usage_percentage [-7.053%; +3.660%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-20

  • unstable max_rss_usage [-21.034MB; +34.423MB] or [-5.461%; +8.937%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable max_rss_usage [-7.732MB; +13.542MB] or [-4.223%; +7.395%]

scenario:plugin-pg-service-24

  • unstable execution_time [-136.191ms; +66.306ms] or [-8.031%; +3.910%]

scenario:test-codeowners-large-26

  • unstable cpu_user_time [-95.129ms; +150.677ms] or [-4.652%; +7.368%]
  • unstable execution_time [-97.520ms; +149.982ms] or [-4.711%; +7.246%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-4.335MB; +7.992MB] or [-5.358%; +9.878%]

@codecov

codecov Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.58%. Comparing base (c1b5aaf) to head (c6599ed).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10017      +/-   ##
==========================================
- Coverage   98.58%   98.58%   -0.01%     
==========================================
  Files         991      991              
  Lines      149573   149346     -227     
  Branches    13089    13066      -23     
==========================================
- Hits       147460   147236     -224     
+ Misses       2113     2110       -3     
Flag Coverage Δ
aiguard 62.53% <ø> (-0.03%) ⬇️
aiguard-integration 59.13% <ø> (ø)
apm-bucket-0 61.97% <ø> (-0.03%) ⬇️
apm-bucket-1 67.54% <ø> (-0.03%) ⬇️
apm-bucket-2 67.12% <ø> (-0.03%) ⬇️
apm-bucket-3 63.78% <ø> (-0.03%) ⬇️
apm-capabilities-tracing 62.44% <92.85%> (-0.03%) ⬇️
apm-integrations-aerospike 59.78% <ø> (-0.03%) ⬇️
apm-integrations-confluentinc-kafka-javascript 66.10% <ø> (-0.03%) ⬇️
apm-integrations-couchbase 60.32% <ø> (-0.03%) ⬇️
apm-integrations-http 65.78% <ø> (-0.03%) ⬇️
apm-integrations-kafkajs 66.70% <ø> (-0.03%) ⬇️
apm-integrations-next 63.29% <ø> (-0.03%) ⬇️
apm-integrations-prisma 61.39% <ø> (-0.03%) ⬇️
appsec 76.59% <ø> (-0.02%) ⬇️
appsec-express_fastify_graphql 73.03% <ø> (-0.02%) ⬇️
appsec-integration 49.23% <0.00%> (+0.01%) ⬆️
appsec-kafka_ldapjs_lodash 67.08% <ø> (+<0.01%) ⬆️
appsec-mongodb-core_mongoose_mysql 70.37% <ø> (-0.02%) ⬇️
appsec-next 56.62% <0.00%> (-0.02%) ⬇️
appsec-node-serialize_passport_postgres 69.82% <ø> (-0.02%) ⬇️
appsec-sourcing_stripe_template 68.20% <ø> (-0.02%) ⬇️
debugger 68.91% <ø> (-0.04%) ⬇️
instrumentations-bucket-0 55.10% <ø> (-0.03%) ⬇️
instrumentations-bucket-1 63.63% <ø> (-0.03%) ⬇️
instrumentations-bucket-10 64.87% <ø> (-0.03%) ⬇️
instrumentations-bucket-11 65.53% <ø> (-0.03%) ⬇️
instrumentations-bucket-12 54.98% <ø> (-0.03%) ⬇️
instrumentations-bucket-13 55.27% <ø> (-0.03%) ⬇️
instrumentations-bucket-14 55.10% <ø> (-0.03%) ⬇️
instrumentations-bucket-2 56.19% <ø> (-0.03%) ⬇️
instrumentations-bucket-3 57.02% <ø> (-0.03%) ⬇️
instrumentations-bucket-4 63.08% <ø> (-0.03%) ⬇️
instrumentations-bucket-5 49.31% <ø> (-0.03%) ⬇️
instrumentations-bucket-6 64.97% <ø> (-0.03%) ⬇️
instrumentations-bucket-7 55.24% <ø> (-0.03%) ⬇️
instrumentations-bucket-8 62.45% <ø> (-0.03%) ⬇️
instrumentations-bucket-9 57.84% <ø> (-0.03%) ⬇️
instrumentations-instrumentation-couchbase 53.64% <ø> (-0.03%) ⬇️
instrumentations-integration-esbuild 34.38% <0.00%> (+<0.01%) ⬆️
llmobs-ai_anthropic_bedrock 66.35% <ø> (-0.02%) ⬇️
llmobs-bucket-1 64.46% <ø> (-0.02%) ⬇️
llmobs-openai 66.33% <ø> (-0.03%) ⬇️
llmobs-openai-agents_vertex-ai 63.50% <ø> (-0.03%) ⬇️
llmobs-sdk 75.77% <ø> (-0.03%) ⬇️
master-coverage 98.58% <100.00%> (?)
openfeature 59.75% <ø> (ø)
openfeature-unit 57.48% <ø> (-0.03%) ⬇️
platform-core_esbuild_instrumentations-misc 40.52% <0.00%> (+<0.01%) ⬆️
platform-integration 64.48% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 38.25% <0.00%> (-0.01%) ⬇️
plugins-browser-bunyan_bullmq_cassandra 65.76% <ø> (-0.03%) ⬇️
plugins-bucket-0 60.38% <ø> (-0.03%) ⬇️
plugins-bucket-1 57.66% <ø> (-0.02%) ⬇️
plugins-bucket-11 66.26% <ø> (-0.03%) ⬇️
plugins-bucket-18 65.78% <ø> (-0.03%) ⬇️
plugins-bucket-19 64.39% <ø> (-0.03%) ⬇️
plugins-bucket-20 66.25% <ø> (-0.03%) ⬇️
plugins-bucket-4 60.57% <ø> (-0.03%) ⬇️
plugins-cookie_cookie-parser_crypto 54.65% <ø> (-0.03%) ⬇️
plugins-fastify_fetch_fs 64.91% <ø> (-0.03%) ⬇️
plugins-generic-pool_google-cloud-pubsub_grpc 68.54% <ø> (-0.03%) ⬇️
plugins-handlebars_hapi_hono 62.97% <ø> (-0.03%) ⬇️
plugins-ioredis_knex_langgraph 61.04% <ø> (-0.03%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 62.71% <ø> (-0.02%) ⬇️
plugins-lodash_mariadb_memcached 63.32% <ø> (-0.03%) ⬇️
plugins-moleculer_mongodb_mongodb-core 65.63% <ø> (-0.03%) ⬇️
plugins-mongoose_multer_mysql 63.42% <ø> (-0.03%) ⬇️
plugins-mysql2_nats_node-serialize 65.61% <ø> (-0.03%) ⬇️
plugins-opensearch_passport-http_pino 63.44% <ø> (-0.03%) ⬇️
plugins-postgres_process_pug 62.53% <ø> (-0.03%) ⬇️
plugins-redis_router_sequelize 66.21% <ø> (-0.03%) ⬇️
plugins-test-and-upstream-rhea_undici_url 65.57% <ø> (-0.03%) ⬇️
plugins-valkey_vm_winston 61.84% <ø> (-0.03%) ⬇️
plugins-ws 63.84% <ø> (-0.03%) ⬇️
profiling 65.87% <ø> (-0.03%) ⬇️
serverless-aws-sdk-aws-sdk 54.81% <ø> (-0.02%) ⬇️
serverless-aws-sdk-base-inject-field 54.23% <ø> (-0.03%) ⬇️
serverless-aws-sdk-bedrockruntime 57.53% <ø> (-0.03%) ⬇️
serverless-aws-sdk-client 59.37% <ø> (-0.03%) ⬇️
serverless-aws-sdk-dynamodb 58.48% <ø> (-0.03%) ⬇️
serverless-aws-sdk-eventbridge 57.06% <ø> (-0.02%) ⬇️
serverless-aws-sdk-kinesis 62.58% <ø> (-0.03%) ⬇️
serverless-aws-sdk-lambda 60.48% <ø> (-0.03%) ⬇️
serverless-aws-sdk-s3 58.55% <ø> (-0.03%) ⬇️
serverless-aws-sdk-serverless-peer-service 63.15% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sns 63.49% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sqs 63.95% <ø> (-0.03%) ⬇️
serverless-aws-sdk-stepfunctions 58.35% <ø> (-0.03%) ⬇️
serverless-aws-sdk-util 54.90% <ø> (-0.03%) ⬇️
serverless-bucket-0 57.10% <ø> (ø)
serverless-bucket-1 63.11% <ø> (-0.03%) ⬇️
test-optimization-cucumber 70.41% <100.00%> (-0.07%) ⬇️
test-optimization-cypress 64.64% <93.75%> (+0.04%) ⬆️
test-optimization-jest 72.02% <100.00%> (-0.06%) ⬇️
test-optimization-mocha 71.88% <100.00%> (-0.02%) ⬇️
test-optimization-playwright-playwright-atr 59.50% <57.14%> (-0.04%) ⬇️
test-optimization-playwright-playwright-efd 60.18% <57.14%> (-0.04%) ⬇️
test-optimization-playwright-playwright-final-status 59.79% <57.14%> (-0.04%) ⬇️
test-optimization-playwright-playwright-impacted-tests 59.90% <57.14%> (+0.11%) ⬆️
test-optimization-playwright-playwright-reporting 60.92% <92.85%> (-0.08%) ⬇️
test-optimization-playwright-playwright-test-management 60.98% <57.14%> (-0.15%) ⬇️
test-optimization-playwright-playwright-test-span 59.54% <57.14%> (-0.10%) ⬇️
test-optimization-selenium 58.60% <53.33%> (-0.17%) ⬇️
test-optimization-testopt 61.64% <60.00%> (+<0.01%) ⬆️
test-optimization-vitest 72.54% <100.00%> (+<0.01%) ⬆️
test-optimization-vitest-browser 58.46% <64.28%> (-0.01%) ⬇️
test-optimization-webdriverio 65.08% <64.28%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6043445034

ℹ️ 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".

Comment thread packages/dd-trace/src/span_processor.js Outdated
Comment thread packages/dd-trace/src/span_processor.js Outdated
@gh-worker-ownership-write-b05516
gh-worker-ownership-write-b05516 Bot removed the request for review from a team August 27, 2026 13:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc5752e692

ℹ️ 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".

Comment thread packages/datadog-plugin-mocha/src/index.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c3073991a

ℹ️ 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".

Comment thread packages/datadog-plugin-mocha/src/index.js
@juan-fernandez juan-fernandez changed the title fix(test-optimization): report test suites immediately fix(test-optimization): restore pre-defer suite reporting Aug 27, 2026
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@DataDog review
@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 9aa623df0c

ℹ️ 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".

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

Suite spans now finish at each framework boundary and use normal trace buffering. The changed callers and exporter contain no remaining deferred-suite references.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 9aa623d · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

…rt-test-suites-immediately

# Conflicts:
#	packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c65f73a7e6

ℹ️ 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".

Comment thread packages/dd-trace/src/plugins/ci_plugin.js
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: c6599ed9dc

ℹ️ 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".

@juan-fernandez
juan-fernandez merged commit d140900 into master Aug 28, 2026
686 checks passed
@juan-fernandez
juan-fernandez deleted the juan-fernandez/report-test-suites-immediately branch August 28, 2026 08:29
This was referenced Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants