Skip to content

fix(test-optimization): omit empty FTR capture containers#9304

Merged
juan-fernandez merged 1 commit into
masterfrom
juan-fernandez/ftr-empty-fields-snapshot
Jul 13, 2026
Merged

fix(test-optimization): omit empty FTR capture containers#9304
juan-fernandez merged 1 commit into
masterfrom
juan-fernandez/ftr-empty-fields-snapshot

Conversation

@juan-fernandez

@juan-fernandez juan-fernandez commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Omits empty capture containers from Failed Test Replay DI snapshots before they are sent through the Test Optimization logs path. This keeps captured object and collection types while avoiding empty or null fields, elements, and entries payloads that can break debugger UI rendering.

The cleanup now only prunes recognized captured values and traverses all remaining object-valued children, so application variables or properties named fields, elements, or entries cannot block recursive cleanup.

This also adds coverage for the raw serialized FTR DI log body, verifying that captured empty objects, arrays, and maps preserve their type while omitting empty containers. The existing raw log assertions also confirm git ddtags are present for the covered FTR paths.

Motivation

FTR snapshots can include empty captured objects and collections. In the Test Optimization logs flow, those empty containers may surface as fields: null, elements: null, or entries: null in the debugger UI, causing capture rendering failures.

Additional Notes

Verification covers the worker snapshot cleanup matrix, recursive name-collision cases, metadata preservation, and a Jest FTR integration path that inspects the raw DI log body received by the fake intake.

@dd-octo-sts

dd-octo-sts Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.71 MB
Deduped: 7.37 MB
No deduping: 7.37 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 438.86 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 Jul 13, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.54% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: d94153a | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Jul 13, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-13 11:30:27

Comparing candidate commit d94153a in PR branch juan-fernandez/ftr-empty-fields-snapshot with baseline commit 66bce78 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2309 metrics, 49 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:appsec-appsec-enabled-24

  • unstable execution_time [-205.827ms; +202.660ms] or [-7.799%; +7.679%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-236.150ms; +242.085ms] or [-9.289%; +9.522%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-164.230ms; +159.008ms] or [-5.269%; +5.101%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-185.837ms; +193.920ms] or [-6.408%; +6.687%]

scenario:appsec-control-20

  • unstable execution_time [-105.238ms; +140.013ms] or [-6.387%; +8.498%]

scenario:appsec-control-24

  • unstable execution_time [-117.595ms; +115.338ms] or [-9.516%; +9.333%]

scenario:appsec-control-26

  • unstable execution_time [-123501.043µs; +124673.643µs] or [-9.996%; +10.091%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-11.966ms; +21.065ms] or [-4.656%; +8.196%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-11.324ms; +15.996ms] or [-4.497%; +6.352%]

scenario:appsec-iast-with-vulnerability-control-20

  • unstable cpu_usage_percentage [-5.755%; +4.290%]
  • unstable execution_time [-30.886ms; +41.004ms] or [-5.589%; +7.420%]

scenario:appsec-iast-with-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-26.250ms; +32.360ms] or [-4.795%; +5.912%]

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

  • unstable cpu_user_time [-2.915s; +0.161s] or [-30.743%; +1.694%]
  • unstable execution_time [-2.959s; +0.171s] or [-29.015%; +1.680%]
  • unstable instructions [-24.9G instructions; +1.4G instructions] or [-32.048%; +1.748%]
  • unstable throughput [-77.214op/s; +785.866op/s] or [-2.344%; +23.859%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-3408.989ms; +5292.445ms] or [-31.319%; +48.623%]
  • unstable execution_time [-3529.879ms; +5480.238ms] or [-30.408%; +47.210%]
  • unstable instructions [-29.6G instructions; +46.8G instructions] or [-32.265%; +51.063%]
  • unstable max_rss_usage [-10.796MB; +16.705MB] or [-6.595%; +10.205%]
  • unstable throughput [-1067.158op/s; +715.639op/s] or [-35.897%; +24.072%]

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

  • unstable cpu_user_time [-1659.786ms; +2646.899ms] or [-19.947%; +31.811%]
  • unstable execution_time [-1647.772ms; +2667.447ms] or [-18.268%; +29.573%]
  • unstable instructions [-14.1G instructions; +22.8G instructions] or [-20.774%; +33.556%]
  • unstable max_rss_usage [-6.990MB; +11.090MB] or [-4.461%; +7.077%]
  • unstable throughput [-760.461op/s; +467.149op/s] or [-20.965%; +12.878%]

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

  • unstable cpu_user_time [-1873.728ms; +572.343ms] or [-20.002%; +6.110%]
  • unstable execution_time [-1889.647ms; +592.707ms] or [-18.736%; +5.877%]
  • unstable instructions [-16.5G instructions; +5.0G instructions] or [-21.130%; +6.443%]
  • unstable throughput [-133.397op/s; +424.492op/s] or [-4.096%; +13.033%]

scenario:debugger-line-probe-without-snapshot-24

  • unstable cpu_user_time [-2677.666ms; +2406.925ms] or [-28.978%; +26.048%]
  • unstable execution_time [-2684.662ms; +2423.553ms] or [-26.911%; +24.294%]
  • unstable instructions [-23.1G instructions; +20.8G instructions] or [-30.391%; +27.396%]
  • unstable max_rss_usage [-11357.942KB; +10731.542KB] or [-7.093%; +6.702%]
  • unstable throughput [-617.956op/s; +728.327op/s] or [-18.539%; +21.851%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2074.737ms; +3289.837ms] or [-22.118%; +35.072%]
  • unstable execution_time [-2115.901ms; +3305.415ms] or [-20.958%; +32.741%]
  • unstable instructions [-18.5G instructions; +29.2G instructions] or [-23.650%; +37.314%]
  • unstable max_rss_usage [-6.481MB; +10.534MB] or [-4.076%; +6.625%]
  • unstable throughput [-717.191op/s; +464.780op/s] or [-22.061%; +14.297%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-266.156ms; +467.772ms] or [-5.494%; +9.655%]
  • unstable execution_time [-261.064ms; +465.208ms] or [-5.306%; +9.455%]
  • unstable throughput [-164871.739op/s; +84262.168op/s] or [-9.623%; +4.918%]

scenario:plugin-aws-sdk-lambda-inject-with-context-24

  • unstable cpu_user_time [-152.402ms; +231.417ms] or [-4.033%; +6.124%]
  • unstable execution_time [-152.983ms; +230.808ms] or [-4.024%; +6.071%]

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

  • unstable max_rss_usage [-7.989MB; +5.530MB] or [-6.179%; +4.277%]

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

  • unstable cpu_user_time [-748.292ms; +690.032ms] or [-5.797%; +5.346%]
  • unstable execution_time [-750.500ms; +691.180ms] or [-5.687%; +5.238%]
  • unstable throughput [-3.147op/s; +3.442op/s] or [-5.161%; +5.645%]

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9304      +/-   ##
==========================================
+ Coverage   96.57%   96.58%   +0.01%     
==========================================
  Files         918      918              
  Lines      121577   121584       +7     
  Branches    21074    20994      -80     
==========================================
+ Hits       117407   117433      +26     
+ Misses       4170     4151      -19     
Flag Coverage Δ
aiguard 53.56% <ø> (-0.05%) ⬇️
aiguard-integration 57.01% <ø> (ø)
apm-bucket-0 53.79% <ø> (-0.05%) ⬇️
apm-bucket-1 58.01% <ø> (-0.12%) ⬇️
apm-bucket-2 56.11% <ø> (-0.05%) ⬇️
apm-capabilities-tracing 60.34% <100.00%> (+0.02%) ⬆️
apm-integrations-aerospike 52.94% <ø> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.06% <ø> (-0.05%) ⬇️
apm-integrations-couchbase 53.27% <ø> (-0.05%) ⬇️
apm-integrations-http 57.96% <ø> (-0.05%) ⬇️
apm-integrations-kafkajs 57.71% <ø> (-0.05%) ⬇️
apm-integrations-next 54.24% <ø> (-0.05%) ⬇️
apm-integrations-prisma 54.17% <ø> (-0.05%) ⬇️
apm-integrations-tedious 53.04% <ø> (-0.05%) ⬇️
appsec 68.96% <ø> (-0.04%) ⬇️
appsec-express_fastify_graphql 65.60% <ø> (-0.04%) ⬇️
appsec-integration 45.59% <ø> (ø)
appsec-kafka_ldapjs_lodash 59.09% <ø> (-0.05%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.25% <ø> (-0.04%) ⬇️
appsec-next 52.85% <ø> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 61.88% <ø> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.34% <ø> (-0.04%) ⬇️
debugger 65.71% <ø> (-0.04%) ⬇️
instrumentations-bucket-0 48.75% <ø> (-0.05%) ⬇️
instrumentations-bucket-1 54.96% <ø> (-0.05%) ⬇️
instrumentations-bucket-10 56.63% <ø> (-0.05%) ⬇️
instrumentations-bucket-11 48.74% <ø> (-0.05%) ⬇️
instrumentations-bucket-12 48.84% <ø> (-0.05%) ⬇️
instrumentations-bucket-13 48.68% <ø> (-0.05%) ⬇️
instrumentations-bucket-2 49.74% <ø> (-0.05%) ⬇️
instrumentations-bucket-3 53.83% <ø> (-0.05%) ⬇️
instrumentations-bucket-4 49.16% <ø> (-0.05%) ⬇️
instrumentations-bucket-5 53.01% <ø> (-0.05%) ⬇️
instrumentations-bucket-6 55.60% <ø> (-0.05%) ⬇️
instrumentations-bucket-7 53.61% <ø> (-0.05%) ⬇️
instrumentations-bucket-8 54.64% <ø> (-0.05%) ⬇️
instrumentations-bucket-9 56.10% <ø> (-0.04%) ⬇️
instrumentations-instrumentation-couchbase 48.18% <ø> (-0.05%) ⬇️
instrumentations-integration-esbuild 33.96% <ø> (ø)
llmobs-ai_anthropic_bedrock 57.73% <ø> (-0.04%) ⬇️
llmobs-bucket-1 56.80% <ø> (-0.04%) ⬇️
llmobs-openai 57.56% <ø> (-0.04%) ⬇️
llmobs-sdk 59.95% <ø> (-0.05%) ⬇️
llmobs-vertex-ai 54.21% <ø> (-0.05%) ⬇️
master-coverage 96.58% <100.00%> (?)
openfeature 54.62% <ø> (ø)
openfeature-unit 49.83% <ø> (-0.05%) ⬇️
platform-core_esbuild_instrumentations-misc 38.46% <ø> (-0.03%) ⬇️
platform-integration 62.24% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 37.29% <ø> (-0.03%) ⬇️
plugins-bucket-0 53.18% <ø> (-0.05%) ⬇️
plugins-bucket-1 55.09% <ø> (ø)
plugins-bucket-11 55.60% <ø> (-0.05%) ⬇️
plugins-bucket-18 57.08% <ø> (-0.05%) ⬇️
plugins-bucket-19 55.36% <ø> (-0.05%) ⬇️
plugins-bucket-20 57.44% <ø> (-0.05%) ⬇️
plugins-bucket-4 53.86% <ø> (-0.05%) ⬇️
plugins-bullmq_cassandra_cookie 57.39% <ø> (-0.05%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.32% <ø> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.54% <ø> (-0.05%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.87% <ø> (-0.05%) ⬇️
plugins-hapi_hono_ioredis 55.86% <ø> (-0.05%) ⬇️
plugins-jest_knex_langgraph 51.67% <ø> (-0.05%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.42% <ø> (-0.05%) ⬇️
plugins-lodash_mariadb_memcached 54.21% <ø> (-0.05%) ⬇️
plugins-moleculer_mongodb_mongodb-core 57.29% <ø> (-0.05%) ⬇️
plugins-mongoose_multer_mysql 54.71% <ø> (-0.05%) ⬇️
plugins-mysql2_nats_node-serialize 56.21% <ø> (-0.05%) ⬇️
plugins-opensearch_passport-http_pino 55.05% <ø> (-0.05%) ⬇️
plugins-postgres_process_pug 54.29% <ø> (-0.05%) ⬇️
plugins-redis_router_sequelize 57.03% <ø> (-0.03%) ⬇️
plugins-test-and-upstream-rhea_undici_url 57.03% <ø> (-0.05%) ⬇️
plugins-valkey_vm_winston 53.93% <ø> (+0.03%) ⬆️
plugins-ws 54.80% <ø> (-0.05%) ⬇️
profiling 58.20% <ø> (-0.05%) ⬇️
serverless-aws-sdk-aws-sdk 50.67% <ø> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.69% <ø> (-0.05%) ⬇️
serverless-aws-sdk-client 51.97% <ø> (-0.05%) ⬇️
serverless-aws-sdk-dynamodb 51.75% <ø> (-0.08%) ⬇️
serverless-aws-sdk-eventbridge 46.25% <ø> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 54.71% <ø> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.79% <ø> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.53% <ø> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.73% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.48% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.91% <ø> (-0.05%) ⬇️
serverless-aws-sdk-stepfunctions 51.25% <ø> (-0.05%) ⬇️
serverless-aws-sdk-util 48.48% <ø> (-0.05%) ⬇️
serverless-bucket-0 55.23% <ø> (ø)
serverless-bucket-1 56.01% <ø> (-0.05%) ⬇️
test-optimization-cucumber 72.95% <86.95%> (-0.02%) ⬇️
test-optimization-cypress 66.33% <ø> (+0.01%) ⬆️
test-optimization-jest 74.26% <100.00%> (+0.32%) ⬆️
test-optimization-mocha 74.70% <100.00%> (+0.44%) ⬆️
test-optimization-playwright-playwright-atr 61.57% <ø> (-0.02%) ⬇️
test-optimization-playwright-playwright-efd 61.76% <ø> (-0.01%) ⬇️
test-optimization-playwright-playwright-final-status 61.72% <ø> (+0.05%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.44% <ø> (+0.15%) ⬆️
test-optimization-playwright-playwright-reporting 61.34% <ø> (-0.02%) ⬇️
test-optimization-playwright-playwright-test-management 62.25% <ø> (-0.13%) ⬇️
test-optimization-playwright-playwright-test-span 61.49% <ø> (-0.07%) ⬇️
test-optimization-selenium 60.67% <ø> (-0.12%) ⬇️
test-optimization-testopt 59.15% <ø> (+0.08%) ⬆️
test-optimization-vitest 71.59% <91.30%> (+0.02%) ⬆️

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.

@juan-fernandez
juan-fernandez force-pushed the juan-fernandez/ftr-empty-fields-snapshot branch from b7d78b3 to 153d69a Compare July 13, 2026 11:08
@juan-fernandez
juan-fernandez force-pushed the juan-fernandez/ftr-empty-fields-snapshot branch from 153d69a to d94153a Compare July 13, 2026 11:16
@juan-fernandez
juan-fernandez marked this pull request as ready for review July 13, 2026 11:30
@juan-fernandez
juan-fernandez requested a review from a team as a code owner July 13, 2026 11:30

@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

PR successfully removes empty FTR capture containers while safely handling edge cases. Unit test validates recursive deletion of empty fields, elements, and entries from captured values, proper handling of property name collisions, and preservation of metadata. No behavioral regressions identified.

Was this helpful? React 👍 or 👎

📊 Validated against 15 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit d94153a · What is Autotest? · Any feedback? Reach out in #autotest

@juan-fernandez
juan-fernandez merged commit adf5f1c into master Jul 13, 2026
814 of 815 checks passed
@juan-fernandez
juan-fernandez deleted the juan-fernandez/ftr-empty-fields-snapshot branch July 13, 2026 11:37
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 14, 2026
This was referenced Jul 14, 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