Skip to content

test(vitest): cover msw preload regression#9262

Merged
juan-fernandez merged 10 commits into
masterfrom
juan-fernandez/fix-vitest-telemetry-log-stack
Jul 10, 2026
Merged

test(vitest): cover msw preload regression#9262
juan-fernandez merged 10 commits into
masterfrom
juan-fernandez/fix-vitest-telemetry-log-stack

Conversation

@juan-fernandez

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

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds a Vitest 3.2.6 + MSW 2.14.6 integration regression test for dd-trace's supported Vitest preload path:

NODE_OPTIONS="-r dd-trace/ci/init --import dd-trace/register.js"

The test verifies that importing MSW and performing an MSW-backed fetch does not fail while dd-trace telemetry/logging handles loader diagnostics.

Motivation

The original #9260 failure path was:

  1. MSW imports GraphQL handler code even when a test only imports http helpers, so loading MSW also loads graphql.
  2. The GraphQL Orchestrion instrumentation introduced by #7757 attempted __module_export__ transforms for those GraphQL files.
  3. For the loaded GraphQL file shape, Orchestrion could throw Failed to find injection points for: ["__module_export__"].
  4. The rewriter caught that internal instrumentation error and logged it with log.error(e).
  5. Telemetry log collection read e.stack.
  6. Vitest/vite-node stack remapping scanned the raw dd-trace rewriter source for //# sourceMappingURL=....
  7. It accidentally matched the rewriter's inline source-map template literal and parsed the literal ${inlineMap} text as base64 JSON, which produced SyntaxError: Unexpected token '�'.

After merging current master, the MSW/Vitest repro passes even with this PR's production log/telemetry guard changes removed. The relevant master fix is #9212, which avoids leaving the problematic raw sourceMappingURL marker in the rewriter source for vite-node to misparse.

This PR keeps the focused regression coverage so the supported Vitest preload path stays protected.

Additional Notes

Validation:

  • Merged current master into this branch.
  • Removed this PR's production log/telemetry changes and their unit tests.
  • Confirmed the final diff is limited to the Vitest/MSW integration coverage.
  • Confirmed SPEC=vitest.msw npm run test:integration:vitest passes.

@dd-octo-sts

dd-octo-sts Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Overall package size

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

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 437.94 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-prod-us1-6

datadog-prod-us1-6 Bot commented Jul 8, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

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

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

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.52%. Comparing base (6dddc05) to head (2ff3217).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9262      +/-   ##
==========================================
- Coverage   96.57%   96.52%   -0.05%     
==========================================
  Files         918      918              
  Lines      121564   121564              
  Branches    20803    20684     -119     
==========================================
- Hits       117396   117342      -54     
- Misses       4168     4222      +54     
Flag Coverage Δ
aiguard 53.55% <ø> (-0.05%) ⬇️
aiguard-integration 57.00% <ø> (ø)
apm-bucket-0 53.78% <ø> (-0.05%) ⬇️
apm-bucket-1 58.07% <ø> (-0.05%) ⬇️
apm-bucket-2 56.11% <ø> (-0.05%) ⬇️
apm-capabilities-tracing 60.32% <ø> (ø)
apm-integrations-aerospike 52.93% <ø> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.05% <ø> (-0.05%) ⬇️
apm-integrations-couchbase 53.26% <ø> (-0.05%) ⬇️
apm-integrations-http 57.96% <ø> (-0.04%) ⬇️
apm-integrations-kafkajs 57.71% <ø> (-0.05%) ⬇️
apm-integrations-next 54.23% <ø> (-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.59% <ø> (-0.05%) ⬇️
appsec-integration 45.59% <ø> (+<0.01%) ⬆️
appsec-kafka_ldapjs_lodash 59.09% <ø> (-0.04%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.24% <ø> (-0.04%) ⬇️
appsec-next ?
appsec-node-serialize_passport_postgres 61.87% <ø> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.23% <ø> (-0.04%) ⬇️
debugger 65.72% <ø> (ø)
instrumentations-bucket-0 48.74% <ø> (-0.05%) ⬇️
instrumentations-bucket-1 54.95% <ø> (-0.05%) ⬇️
instrumentations-bucket-10 56.61% <ø> (-0.05%) ⬇️
instrumentations-bucket-11 48.73% <ø> (-0.05%) ⬇️
instrumentations-bucket-12 48.84% <ø> (-0.05%) ⬇️
instrumentations-bucket-13 48.67% <ø> (-0.05%) ⬇️
instrumentations-bucket-2 49.73% <ø> (-0.05%) ⬇️
instrumentations-bucket-3 ?
instrumentations-bucket-4 49.15% <ø> (-0.05%) ⬇️
instrumentations-bucket-5 53.00% <ø> (-0.05%) ⬇️
instrumentations-bucket-6 55.60% <ø> (-0.05%) ⬇️
instrumentations-bucket-7 53.60% <ø> (-0.04%) ⬇️
instrumentations-bucket-8 54.63% <ø> (-0.05%) ⬇️
instrumentations-bucket-9 56.09% <ø> (-0.04%) ⬇️
instrumentations-instrumentation-couchbase 48.17% <ø> (-0.05%) ⬇️
instrumentations-integration-esbuild 33.96% <ø> (ø)
llmobs-ai_anthropic_bedrock 57.72% <ø> (-0.04%) ⬇️
llmobs-bucket-1 56.98% <ø> (-0.04%) ⬇️
llmobs-openai 57.55% <ø> (-0.04%) ⬇️
llmobs-sdk 59.94% <ø> (-0.05%) ⬇️
llmobs-vertex-ai 54.20% <ø> (-0.05%) ⬇️
master-coverage 96.52% <ø> (?)
openfeature 54.61% <ø> (+<0.01%) ⬆️
openfeature-unit 49.82% <ø> (-0.05%) ⬇️
platform-core_esbuild_instrumentations-misc 38.45% <ø> (-0.03%) ⬇️
platform-integration 62.23% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 37.28% <ø> (-0.03%) ⬇️
plugins-bucket-0 53.17% <ø> (-0.05%) ⬇️
plugins-bucket-1 55.07% <ø> (ø)
plugins-bucket-11 55.56% <ø> (-0.05%) ⬇️
plugins-bucket-18 57.06% <ø> (-0.05%) ⬇️
plugins-bucket-19 55.37% <ø> (-0.05%) ⬇️
plugins-bucket-20 57.44% <ø> (-0.05%) ⬇️
plugins-bucket-4 53.84% <ø> (-0.05%) ⬇️
plugins-bullmq_cassandra_cookie 57.39% <ø> (-0.05%) ⬇️
plugins-cookie-parser_crypto_dd-trace-api 52.31% <ø> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.46% <ø> (-0.05%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.86% <ø> (-0.05%) ⬇️
plugins-hapi_hono_ioredis 55.85% <ø> (-0.05%) ⬇️
plugins-jest_knex_langgraph 51.66% <ø> (-0.05%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.40% <ø> (-0.05%) ⬇️
plugins-lodash_mariadb_memcached 54.20% <ø> (-0.05%) ⬇️
plugins-moleculer_mongodb_mongodb-core 57.28% <ø> (-0.05%) ⬇️
plugins-mongoose_multer_mysql 54.70% <ø> (-0.05%) ⬇️
plugins-mysql2_nats_node-serialize 56.20% <ø> (-0.05%) ⬇️
plugins-opensearch_passport-http_pino 55.05% <ø> (-0.05%) ⬇️
plugins-postgres_process_pug 54.28% <ø> (-0.05%) ⬇️
plugins-redis_router_sequelize 57.00% <ø> (-0.08%) ⬇️
plugins-test-and-upstream-rhea_undici_url 57.02% <ø> (-0.05%) ⬇️
plugins-valkey_vm_winston 53.92% <ø> (+0.03%) ⬆️
plugins-ws 54.79% <ø> (-0.05%) ⬇️
profiling 58.19% <ø> (-0.05%) ⬇️
serverless-aws-sdk-aws-sdk 50.66% <ø> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.68% <ø> (-0.05%) ⬇️
serverless-aws-sdk-client 51.97% <ø> (-0.05%) ⬇️
serverless-aws-sdk-dynamodb 51.75% <ø> (-0.05%) ⬇️
serverless-aws-sdk-eventbridge 46.24% <ø> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 54.71% <ø> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.78% <ø> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.53% <ø> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.72% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.48% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.97% <ø> (-0.07%) ⬇️
serverless-aws-sdk-stepfunctions 51.25% <ø> (-0.05%) ⬇️
serverless-aws-sdk-util 48.47% <ø> (-0.05%) ⬇️
serverless-bucket-0 55.22% <ø> (ø)
serverless-bucket-1 55.99% <ø> (-0.05%) ⬇️
test-optimization-cucumber 72.93% <ø> (-0.01%) ⬇️
test-optimization-cypress 66.38% <ø> (+0.10%) ⬆️
test-optimization-jest 73.89% <ø> (-0.03%) ⬇️
test-optimization-mocha 74.29% <ø> (+0.07%) ⬆️
test-optimization-playwright-playwright-atr 61.56% <ø> (+0.02%) ⬆️
test-optimization-playwright-playwright-efd 61.75% <ø> (+0.03%) ⬆️
test-optimization-playwright-playwright-final-status 61.71% <ø> (+0.02%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.43% <ø> (+0.19%) ⬆️
test-optimization-playwright-playwright-reporting 61.33% <ø> (+0.02%) ⬆️
test-optimization-playwright-playwright-test-management 62.24% <ø> (-0.09%) ⬇️
test-optimization-playwright-playwright-test-span 61.48% <ø> (-0.03%) ⬇️
test-optimization-selenium 60.66% <ø> (-0.08%) ⬇️
test-optimization-testopt 59.15% <ø> (+0.08%) ⬆️
test-optimization-vitest 71.57% <ø> (-0.86%) ⬇️

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.

@pr-commenter

pr-commenter Bot commented Jul 8, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-10 08:52:07

Comparing candidate commit 2ff3217 in PR branch juan-fernandez/fix-vitest-telemetry-log-stack with baseline commit 6dddc05 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2305 metrics, 53 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 [-207.157ms; +213.980ms] or [-7.837%; +8.095%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-236.026ms; +245.089ms] or [-9.270%; +9.626%]

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

  • unstable execution_time [-166.215ms; +163.233ms] or [-5.385%; +5.289%]

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

  • unstable execution_time [-193.081ms; +188.976ms] or [-6.655%; +6.514%]

scenario:appsec-control-20

  • unstable execution_time [-100.767ms; +142.659ms] or [-6.222%; +8.808%]

scenario:appsec-control-24

  • unstable execution_time [-113.157ms; +110.922ms] or [-9.159%; +8.978%]

scenario:appsec-control-26

  • unstable execution_time [-126964.033µs; +127679.667µs] or [-10.243%; +10.301%]

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

  • unstable execution_time [-14.873ms; +19.328ms] or [-5.770%; +7.499%]

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

  • unstable execution_time [-10.042ms; +22.181ms] or [-3.860%; +8.526%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-15.573ms; +11.188ms] or [-6.084%; +4.371%]

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

  • unstable execution_time [-25.887ms; +31.625ms] or [-4.693%; +5.733%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-29228.463µs; +27639.997µs] or [-5.360%; +5.069%]

scenario:child_process-shell-string-24

  • unstable execution_time [-23.492ms; +18.282ms] or [-7.170%; +5.580%]
  • unstable throughput [-165228.193op/s; +210374.147op/s] or [-4.615%; +5.876%]

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

  • unstable cpu_user_time [-1770.249ms; +476.672ms] or [-21.233%; +5.717%]
  • unstable execution_time [-1798.533ms; +479.863ms] or [-19.861%; +5.299%]
  • unstable instructions [-15.2G instructions; +4.1G instructions] or [-22.268%; +6.056%]
  • unstable throughput [-121.761op/s; +500.707op/s] or [-3.352%; +13.783%]

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

  • unstable cpu_user_time [-1.806s; +5.786s] or [-16.747%; +53.658%]
  • unstable execution_time [-1.756s; +5.781s] or [-15.237%; +50.145%]
  • unstable instructions [-16.2G instructions; +51.7G instructions] or [-17.897%; +57.199%]
  • unstable max_rss_usage [-5.447MB; +18.299MB] or [-3.344%; +11.234%]
  • unstable throughput [-1193.521op/s; +349.748op/s] or [-40.457%; +11.855%]

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

  • unstable cpu_user_time [-2029.916ms; +4020.989ms] or [-22.233%; +44.041%]
  • unstable execution_time [-2.024s; +4.081s] or [-20.589%; +41.512%]
  • unstable instructions [-17.3G instructions; +34.7G instructions] or [-23.096%; +46.435%]
  • unstable max_rss_usage [-8.514MB; +18.082MB] or [-5.329%; +11.318%]
  • unstable throughput [-1058.846op/s; +546.862op/s] or [-31.187%; +16.107%]

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

  • unstable cpu_user_time [-2.145s; +4.510s] or [-21.406%; +45.003%]
  • unstable execution_time [-2.125s; +4.508s] or [-19.788%; +41.966%]
  • unstable instructions [-19.0G instructions; +40.5G instructions] or [-22.708%; +48.452%]
  • unstable max_rss_usage [-7.850MB; +13.214MB] or [-4.853%; +8.169%]
  • unstable throughput [-975.665op/s; +464.485op/s] or [-31.433%; +14.964%]

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

  • unstable cpu_user_time [-2118.850ms; +507.636ms] or [-23.761%; +5.693%]
  • unstable execution_time [-2123.256ms; +505.220ms] or [-22.053%; +5.247%]
  • unstable instructions [-18.1G instructions; +4.3G instructions] or [-24.841%; +5.890%]
  • unstable throughput [-181.222op/s; +582.375op/s] or [-5.265%; +16.919%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-389.230ms; +308.385ms] or [-7.809%; +6.187%]
  • unstable execution_time [-387.420ms; +308.379ms] or [-7.655%; +6.093%]
  • unstable throughput [-106716.124op/s; +133252.217op/s] or [-6.433%; +8.033%]

scenario:log-with-debug-20

  • unstable max_rss_usage [-8.127MB; +5.275MB] or [-7.055%; +4.579%]

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

  • unstable cpu_usage_percentage [-5.576%; +4.512%]

scenario:plugin-claude-agent-sdk-delayed-noisy-stream-scan-24

  • unstable cpu_user_time [-50.628ms; +83.148ms] or [-6.626%; +10.883%]
  • unstable execution_time [-52.886ms; +83.059ms] or [-6.904%; +10.843%]
  • unstable throughput [-2365.550op/s; +1504.664op/s] or [-7.033%; +4.473%]

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

  • unstable max_rss_usage [-5.360MB; +9.736MB] or [-4.146%; +7.530%]

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

  • unstable cpu_user_time [-717054.379µs; +718406.479µs] or [-5.585%; +5.595%]
  • unstable execution_time [-723.762ms; +717.188ms] or [-5.514%; +5.464%]
  • unstable throughput [-3.308op/s; +3.321op/s] or [-5.394%; +5.416%]

scenario:plugin-pg-service-26

  • unstable cpu_usage_percentage [-11.239%; +6.403%]
  • unstable execution_time [-110.609ms; +174.976ms] or [-12.124%; +19.180%]
  • unstable throughput [-797893.548op/s; +507786.343op/s] or [-11.853%; +7.543%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-5174.134KB; +3302.801KB] or [-6.452%; +4.119%]

@juan-fernandez
juan-fernandez marked this pull request as ready for review July 9, 2026 10:12
@juan-fernandez
juan-fernandez requested review from a team as code owners July 9, 2026 10:12
@juan-fernandez
juan-fernandez requested review from BridgeAR and removed request for a team July 9, 2026 10:12

@datadog-prod-us1-6 datadog-prod-us1-6 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: WARN

The getErrorStack try/catch fix in telemetry/logs/index.js is correct and directly resolves the Vite/MSW crash. One subtlety worth the author's attention: the change from value.stack (truthy check) to 'stack' in value (property existence) in hasErrorStack silently expands the cause-detection to objects with falsy stack values (null, undefined, '') — those objects are now popped from log args and treated as error causes rather than formatted into the message, which is a behavioral change from before this PR.

📊 Validated against 8 scenarios · Open Bits AI session

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

Comment thread packages/dd-trace/src/log/log.js Outdated
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 1d9ed63aec

ℹ️ 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 integration-tests/vitest/vitest.msw.spec.js
Comment thread packages/dd-trace/src/telemetry/logs/index.js
Comment thread packages/dd-trace/src/log/log.js Outdated
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 218dc19c50

ℹ️ 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/log/log.js Outdated
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

/datadog autotest review

@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. Can't wait for the next one!

Reviewed commit: aa247d36fd

ℹ️ 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-prod-us1-6 datadog-prod-us1-6 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

The core fix is sound: hasErrorStack now uses types.isNativeError (which returns true for Error subclasses on Node.js ≥22 without reading .stack) and an own-data-property descriptor check for plain objects, and getErrorStack wraps .stack reads in try/catch. The 74 tests all pass across the changed files. One intentional behavioral narrowing: objects whose stack property is an inherited property rather than an own data property are no longer treated as error causes (old code: maybeError.stack truthy check; new code: own descriptor check). This is a deliberate, low-risk tradeoff to avoid ever triggering getter-based stack formatters during cause detection.

Was this helpful? React 👍 or 👎

📊 Validated against 12 scenarios · Open Bits AI session

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

@gh-worker-ownership-write-b05516
gh-worker-ownership-write-b05516 Bot removed the request for review from a team July 10, 2026 06:49
@juan-fernandez juan-fernandez changed the title fix(telemetry): guard log stack formatting test(vitest): cover msw preload regression Jul 10, 2026
@juan-fernandez
juan-fernandez enabled auto-merge (squash) July 10, 2026 08:52
@juan-fernandez
juan-fernandez merged commit b40ce55 into master Jul 10, 2026
811 of 812 checks passed
@juan-fernandez
juan-fernandez deleted the juan-fernandez/fix-vitest-telemetry-log-stack branch July 10, 2026 08:53
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 10, 2026
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 10, 2026
dd-octo-sts Bot pushed a commit that referenced this pull request Jul 10, 2026
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 10, 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