dd-trace 6.15.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/ci/diagnose.js +0 -23
- package/ci/test-optimization-validation/approval-artifacts.js +0 -3
- package/ci/test-optimization-validation/approval.js +0 -6
- package/ci/test-optimization-validation/artifact-id.js +0 -1
- package/ci/test-optimization-validation/bounded-json.js +0 -1
- package/ci/test-optimization-validation/cli.js +0 -12
- package/ci/test-optimization-validation/command-output-policy.js +0 -1
- package/ci/test-optimization-validation/command-runner.js +0 -3
- package/ci/test-optimization-validation/environment.js +0 -4
- package/ci/test-optimization-validation/executable-approval.js +0 -1
- package/ci/test-optimization-validation/executable.js +0 -5
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +4 -8
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -3
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -6
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -4
- package/ci/test-optimization-validation/generated-test-contract.js +0 -5
- package/ci/test-optimization-validation/generated-verifier.js +0 -1
- package/ci/test-optimization-validation/literal-environment.js +0 -1
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -17
- package/ci/test-optimization-validation/manifest-schema.js +0 -21
- package/ci/test-optimization-validation/offline-fixtures.js +0 -4
- package/ci/test-optimization-validation/package-check.js +4 -1
- package/ci/test-optimization-validation/plan-writer.js +0 -11
- package/ci/test-optimization-validation/preflight-runner.js +0 -1
- package/ci/test-optimization-validation/redaction.js +0 -4
- package/ci/test-optimization-validation/report-writer.js +0 -16
- package/ci/test-optimization-validation/runner-command.js +0 -3
- package/ci/test-optimization-validation/runner-contract.js +0 -4
- package/ci/test-optimization-validation/safe-files.js +0 -1
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -1
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +1 -2
- package/ci/test-optimization-validation/source-text.js +0 -3
- package/ci/vitest-no-worker-init-setup.mjs +41 -16
- package/index.d.ts +169 -0
- package/next.d.ts +27 -0
- package/next.js +3 -0
- package/package.json +28 -23
- package/packages/datadog-esbuild/index.js +14 -1
- package/packages/datadog-esbuild/src/resolver.js +284 -0
- package/packages/datadog-esbuild/src/utils.js +162 -120
- package/packages/datadog-instrumentations/src/aerospike.js +28 -6
- package/packages/datadog-instrumentations/src/ai.js +39 -97
- package/packages/datadog-instrumentations/src/anthropic.js +76 -134
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +1 -3
- package/packages/datadog-instrumentations/src/aws-sdk.js +0 -2
- package/packages/datadog-instrumentations/src/azure-cosmos.js +1 -1
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +23 -9
- package/packages/datadog-instrumentations/src/azure-functions.js +48 -0
- package/packages/datadog-instrumentations/src/bullmq.js +1 -1
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +1 -3
- package/packages/datadog-instrumentations/src/console.js +97 -0
- package/packages/datadog-instrumentations/src/cucumber.js +72 -12
- package/packages/datadog-instrumentations/src/cypress-config.js +0 -23
- package/packages/datadog-instrumentations/src/dd-trace-api.js +2 -2
- package/packages/datadog-instrumentations/src/graphql.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +39 -14
- package/packages/datadog-instrumentations/src/helpers/channel.js +0 -2
- package/packages/datadog-instrumentations/src/helpers/graphql-jit-runtime.js +0 -5
- package/packages/datadog-instrumentations/src/helpers/hooks.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +25 -8
- package/packages/datadog-instrumentations/src/helpers/instrumentation-utils.js +69 -0
- package/packages/datadog-instrumentations/src/helpers/pool-acquire.js +0 -6
- package/packages/datadog-instrumentations/src/helpers/register.js +13 -64
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +109 -29
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +39 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-durable-functions.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +3 -16
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +36 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/supabase.js +128 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +6 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +388 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +99 -75
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +0 -1
- package/packages/datadog-instrumentations/src/jest.js +141 -51
- package/packages/datadog-instrumentations/src/knex.js +0 -1
- package/packages/datadog-instrumentations/src/langchain.js +1 -1
- package/packages/datadog-instrumentations/src/langgraph.js +1 -1
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +0 -24
- package/packages/datadog-instrumentations/src/mariadb.js +0 -2
- package/packages/datadog-instrumentations/src/mercurius.js +1 -1
- package/packages/datadog-instrumentations/src/mocha/common.js +0 -1
- package/packages/datadog-instrumentations/src/mocha/main.js +22 -25
- package/packages/datadog-instrumentations/src/mocha/utils.js +119 -49
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +0 -6
- package/packages/datadog-instrumentations/src/mocha/worker.js +14 -17
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/mysql2.js +0 -2
- package/packages/datadog-instrumentations/src/openai-agents.js +1 -1
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +241 -0
- package/packages/datadog-instrumentations/src/openai-realtime/events.js +76 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +301 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +998 -0
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +211 -0
- package/packages/datadog-instrumentations/src/openai.js +97 -80
- package/packages/datadog-instrumentations/src/oracledb.js +9 -3
- package/packages/datadog-instrumentations/src/playwright-reporter.js +3 -16
- package/packages/datadog-instrumentations/src/playwright.js +238 -55
- package/packages/datadog-instrumentations/src/postgres.js +7 -0
- package/packages/datadog-instrumentations/src/router.js +0 -2
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +0 -2
- package/packages/datadog-instrumentations/src/sequelize.js +0 -1
- package/packages/datadog-instrumentations/src/supabase.js +15 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +18 -18
- package/packages/datadog-instrumentations/src/vitest-main.js +37 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +7 -1
- package/packages/datadog-instrumentations/src/vitest-worker.js +56 -23
- package/packages/datadog-instrumentations/src/webdriverio.js +23 -42
- package/packages/datadog-instrumentations/src/ws.js +0 -1
- package/packages/datadog-plugin-ai/src/utils.js +0 -2
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +0 -1
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +0 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +7 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +0 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +0 -1
- package/packages/datadog-plugin-azure-cosmos/src/index.js +1 -1
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +95 -1
- package/packages/datadog-plugin-cucumber/src/index.js +10 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +171 -75
- package/packages/datadog-plugin-cypress/src/finalization.js +0 -3
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +0 -4
- package/packages/datadog-plugin-cypress/src/support.js +52 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -24
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +2 -36
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +31 -0
- package/packages/datadog-plugin-graphql/src/resolve-error.js +32 -11
- package/packages/datadog-plugin-graphql/src/utils.js +0 -5
- package/packages/datadog-plugin-jest/src/index.js +13 -0
- package/packages/datadog-plugin-kafkajs/src/producer.js +0 -1
- package/packages/datadog-plugin-mocha/src/index.js +39 -11
- package/packages/datadog-plugin-mongodb-core/src/query.js +0 -1
- package/packages/datadog-plugin-openai/src/index.js +16 -1
- package/packages/datadog-plugin-openai/src/realtime.js +144 -0
- package/packages/datadog-plugin-openai-agents/src/integration.js +0 -4
- package/packages/datadog-plugin-openai-agents/src/util.js +0 -1
- package/packages/datadog-plugin-playwright/src/index.js +76 -9
- package/packages/datadog-plugin-postgres/src/index.js +167 -0
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +0 -1
- package/packages/datadog-plugin-redis/src/index.js +15 -1
- package/packages/datadog-plugin-supabase/src/error.js +18 -0
- package/packages/datadog-plugin-supabase/src/index.js +21 -0
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +69 -0
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +70 -0
- package/packages/datadog-plugin-supabase/src/supabase-postgrest-js-postgrestbuilder-then.js +122 -0
- package/packages/datadog-plugin-supabase/src/supabase-realtime-js-realtimechannel-send.js +66 -0
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +93 -0
- package/packages/datadog-plugin-supabase/src/url.js +17 -0
- package/packages/datadog-plugin-vitest/src/index.js +10 -0
- package/packages/datadog-plugin-ws/src/util.js +0 -4
- package/packages/datadog-turbopack/index.js +206 -0
- package/packages/datadog-turbopack/src/constants.js +5 -0
- package/packages/datadog-turbopack/src/loader.js +484 -0
- package/packages/datadog-webpack/src/loader.js +0 -1
- package/packages/dd-trace/src/aiguard/client.js +2 -3
- package/packages/dd-trace/src/aiguard/evaluation.js +6 -12
- package/packages/dd-trace/src/aiguard/index.js +3 -2
- package/packages/dd-trace/src/aiguard/integrations/anthropic.js +53 -25
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +49 -25
- package/packages/dd-trace/src/aiguard/integrations/index.js +4 -3
- package/packages/dd-trace/src/aiguard/integrations/openai.js +132 -29
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +116 -42
- package/packages/dd-trace/src/aiguard/messages/anthropic.js +0 -2
- package/packages/dd-trace/src/aiguard/messages/openai.js +64 -1
- package/packages/dd-trace/src/aiguard/messages/utils.js +29 -2
- package/packages/dd-trace/src/aiguard/messages/vercel-ai.js +25 -0
- package/packages/dd-trace/src/aiguard/redaction.js +0 -1
- package/packages/dd-trace/src/aiguard/sdk.js +1 -1
- package/packages/dd-trace/src/appsec/activation.js +1 -1
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +0 -5
- package/packages/dd-trace/src/appsec/api_security/sampler.js +0 -4
- package/packages/dd-trace/src/appsec/blocking/index.js +3 -3
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -4
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +5 -5
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +8 -10
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +2 -2
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +4 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +7 -7
- package/packages/dd-trace/src/appsec/index.js +2 -2
- package/packages/dd-trace/src/appsec/lambda.js +71 -2
- package/packages/dd-trace/src/appsec/rasp/utils.js +5 -1
- package/packages/dd-trace/src/appsec/remote_config.js +8 -6
- package/packages/dd-trace/src/appsec/reporter.js +10 -6
- package/packages/dd-trace/src/appsec/rule_manager.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +0 -2
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/common.js +4 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +23 -5
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +1 -20
- package/packages/dd-trace/src/appsec/telemetry/user.js +1 -3
- package/packages/dd-trace/src/appsec/telemetry/waf.js +1 -20
- package/packages/dd-trace/src/appsec/waf/index.js +2 -2
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +8 -5
- package/packages/dd-trace/src/carrier.js +0 -5
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +104 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +0 -2
- package/packages/dd-trace/src/ci-visibility/efd-retry-policy.js +34 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -4
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +37 -15
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +0 -3
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +0 -11
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +0 -1
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +0 -6
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +2 -2
- package/packages/dd-trace/src/ci-visibility/requests/rate-limit.js +0 -1
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +0 -5
- package/packages/dd-trace/src/ci-visibility/requests/video-request.js +0 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +13 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +0 -1
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +0 -2
- package/packages/dd-trace/src/ci-visibility/test-video.js +0 -1
- package/packages/dd-trace/src/config/defaults.js +3 -2
- package/packages/dd-trace/src/config/generated-config-types.d.ts +74 -66
- package/packages/dd-trace/src/config/helper.js +9 -2
- package/packages/dd-trace/src/config/index.js +44 -29
- package/packages/dd-trace/src/config/parsers.js +34 -6
- package/packages/dd-trace/src/config/remote_config.js +25 -109
- package/packages/dd-trace/src/config/supported-configurations.json +146 -9
- package/packages/dd-trace/src/datastreams/encoding.js +0 -1
- package/packages/dd-trace/src/datastreams/pathway.js +0 -1
- package/packages/dd-trace/src/debugger/constants.js +10 -0
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +76 -17
- package/packages/dd-trace/src/debugger/devtools_client/config.js +2 -0
- package/packages/dd-trace/src/debugger/devtools_client/guardrail-metrics.js +15 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +103 -27
- package/packages/dd-trace/src/debugger/devtools_client/json-buffer.js +50 -7
- package/packages/dd-trace/src/debugger/devtools_client/log.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +34 -8
- package/packages/dd-trace/src/debugger/devtools_client/send.js +40 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +53 -13
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +118 -71
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +0 -3
- package/packages/dd-trace/src/debugger/devtools_client/status.js +20 -6
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +167 -0
- package/packages/dd-trace/src/debugger/index.js +50 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +0 -3
- package/packages/dd-trace/src/debugger/probe_sampler.js +133 -9
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +31 -1
- package/packages/dd-trace/src/dogstatsd.js +0 -23
- package/packages/dd-trace/src/encode/0.4-cross-payload.js +0 -3
- package/packages/dd-trace/src/encode/0.4.js +0 -7
- package/packages/dd-trace/src/encode/0.5.js +0 -2
- package/packages/dd-trace/src/encode/tags-processors.js +0 -1
- package/packages/dd-trace/src/evp_proxy/discovery.js +3 -5
- package/packages/dd-trace/src/evp_proxy/path.js +11 -4
- package/packages/dd-trace/src/exporters/agent/writer.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/index.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/intake.js +0 -1
- package/packages/dd-trace/src/exporters/agentless/writer.js +0 -3
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/exporters/common/final-flush-request-tracker.js +0 -6
- package/packages/dd-trace/src/exporters/common/proxy.js +3 -0
- package/packages/dd-trace/src/exporters/common/request.js +1 -0
- package/packages/dd-trace/src/exporters/common/url.js +0 -2
- package/packages/dd-trace/src/exporters/common/writer.js +0 -2
- package/packages/dd-trace/src/id.js +0 -11
- package/packages/dd-trace/src/llmobs/audio-codec.js +192 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +121 -0
- package/packages/dd-trace/src/llmobs/constants/audio.js +35 -0
- package/packages/dd-trace/src/llmobs/constants/prompts.js +14 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +17 -0
- package/packages/dd-trace/src/llmobs/eval-metric.js +0 -6
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +0 -4
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +0 -3
- package/packages/dd-trace/src/llmobs/experiments/index.js +7 -6
- package/packages/dd-trace/src/llmobs/experiments/util.js +1 -11
- package/packages/dd-trace/src/llmobs/index.js +1 -3
- package/packages/dd-trace/src/llmobs/noop.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +0 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +0 -4
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +0 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +4 -6
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +285 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +16 -3
- package/packages/dd-trace/src/llmobs/prompts/cache.js +272 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +639 -0
- package/packages/dd-trace/src/llmobs/prompts/noop.js +29 -0
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +92 -0
- package/packages/dd-trace/src/llmobs/sdk.js +21 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +81 -2
- package/packages/dd-trace/src/llmobs/tagger.js +30 -7
- package/packages/dd-trace/src/llmobs/telemetry.js +36 -4
- package/packages/dd-trace/src/llmobs/util.js +0 -34
- package/packages/dd-trace/src/llmobs/writers/base.js +0 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/channels.js +3 -0
- package/packages/dd-trace/src/log/index.js +23 -5
- package/packages/dd-trace/src/log-submission/log-submission-plugin.js +74 -6
- package/packages/dd-trace/src/msgpack/chunk.js +0 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +0 -12
- package/packages/dd-trace/src/openfeature/encoding.js +0 -2
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/index.js +0 -4
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +0 -1
- package/packages/dd-trace/src/openfeature/span-enrichment.js +0 -4
- package/packages/dd-trace/src/openfeature/writers/base.js +0 -6
- package/packages/dd-trace/src/openfeature/writers/exposures.js +0 -5
- package/packages/dd-trace/src/openfeature/writers/util.js +0 -4
- package/packages/dd-trace/src/opentelemetry/logs/logger.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +0 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/meter_provider.js +4 -4
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +0 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +103 -35
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +0 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +36 -13
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +0 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +0 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +0 -3
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -6
- package/packages/dd-trace/src/opentracing/span_context.js +0 -1
- package/packages/dd-trace/src/otel-thread-ctx.js +38 -11
- package/packages/dd-trace/src/payload-tagging/tagging.js +15 -3
- package/packages/dd-trace/src/plugin_manager.js +9 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +0 -1
- package/packages/dd-trace/src/plugins/database.js +2 -6
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +0 -4
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/git.js +1 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +0 -1
- package/packages/dd-trace/src/plugins/util/llm.js +0 -2
- package/packages/dd-trace/src/plugins/util/status-validator.js +0 -1
- package/packages/dd-trace/src/plugins/util/test.js +25 -21
- package/packages/dd-trace/src/plugins/util/url.js +0 -5
- package/packages/dd-trace/src/priority_sampler.js +0 -6
- package/packages/dd-trace/src/process-tags/index.js +0 -1
- package/packages/dd-trace/src/profiler.js +132 -35
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +0 -1
- package/packages/dd-trace/src/profiling/profiler.js +101 -41
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +29 -15
- package/packages/dd-trace/src/propagation-hash/index.js +0 -1
- package/packages/dd-trace/src/proxy.js +21 -45
- package/packages/dd-trace/src/random_sampler.js +0 -4
- package/packages/dd-trace/src/rate_limiter.js +0 -4
- package/packages/dd-trace/src/remote_config/capabilities.js +1 -9
- package/packages/dd-trace/src/remote_config/index.js +0 -1
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +0 -3
- package/packages/dd-trace/src/sampler.js +0 -4
- package/packages/dd-trace/src/sampling_rule.js +0 -7
- package/packages/dd-trace/src/serverless/vercel.js +0 -1
- package/packages/dd-trace/src/serverless.js +0 -1
- package/packages/dd-trace/src/service-naming/index.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +0 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +7 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +5 -0
- package/packages/dd-trace/src/span_processor.js +2 -2
- package/packages/dd-trace/src/span_sampler.js +0 -1
- package/packages/dd-trace/src/standalone/product.js +2 -2
- package/packages/dd-trace/src/standalone/tracesource.js +0 -1
- package/packages/dd-trace/src/startup-log.js +1 -1
- package/packages/dd-trace/src/telemetry/endpoints.js +0 -8
- package/packages/dd-trace/src/telemetry/logs/index.js +16 -5
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +16 -6
- package/packages/dd-trace/src/telemetry/metrics.js +0 -2
- package/packages/dd-trace/src/telemetry/telemetry.js +4 -1
- package/packages/dd-trace/src/util.js +13 -1
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +0 -10
|
@@ -32,7 +32,6 @@ const GENERATED_SCENARIOS = {
|
|
|
32
32
|
*
|
|
33
33
|
* @param {string} framework test framework
|
|
34
34
|
* @param {string} filename generated ATR test file
|
|
35
|
-
* @returns {string} retry-state path
|
|
36
35
|
*/
|
|
37
36
|
function getGeneratedRetryStatePath (framework, filename) {
|
|
38
37
|
const namespace = `dd-test-optimization-validation-${framework}-`
|
|
@@ -52,7 +51,6 @@ function getGeneratedRetryStatePath (framework, filename) {
|
|
|
52
51
|
* @param {string} input.moduleSystem generated module system
|
|
53
52
|
* @param {string} input.scenarioId generated scenario id
|
|
54
53
|
* @param {string} [input.stateFile] persistent ATR state file
|
|
55
|
-
* @returns {string} canonical generated source
|
|
56
54
|
*/
|
|
57
55
|
function getGeneratedTestContent ({ framework, moduleSystem, scenarioId, stateFile }) {
|
|
58
56
|
const scenario = GENERATED_SCENARIOS[scenarioId]
|
|
@@ -232,7 +230,6 @@ function getGeneratedTestContractError (framework) {
|
|
|
232
230
|
* Describes adapter-specific files in generated-contract errors.
|
|
233
231
|
*
|
|
234
232
|
* @param {string} framework framework name
|
|
235
|
-
* @returns {string} additional file description
|
|
236
233
|
*/
|
|
237
234
|
function getAdditionalGeneratedFileDescription (framework) {
|
|
238
235
|
if (framework === 'cucumber') return ' plus isolated Cucumber step definitions'
|
|
@@ -245,7 +242,6 @@ function getAdditionalGeneratedFileDescription (framework) {
|
|
|
245
242
|
*
|
|
246
243
|
* @param {string} root project root
|
|
247
244
|
* @param {string} filename generated path
|
|
248
|
-
* @returns {boolean} whether the path is contained
|
|
249
245
|
*/
|
|
250
246
|
function isPathInside (root, filename) {
|
|
251
247
|
const relative = path.relative(path.resolve(root), path.resolve(filename))
|
|
@@ -259,7 +255,6 @@ function isPathInside (root, filename) {
|
|
|
259
255
|
* @param {string} input.moduleSystem generated module system
|
|
260
256
|
* @param {string} input.assertion passing assertion
|
|
261
257
|
* @param {string} input.stateFile persistent ATR state file
|
|
262
|
-
* @returns {string} retry test body
|
|
263
258
|
*/
|
|
264
259
|
function getAtrBody ({ moduleSystem, assertion, stateFile }) {
|
|
265
260
|
if (typeof stateFile !== 'string' || !path.isAbsolute(stateFile)) {
|
|
@@ -227,7 +227,6 @@ function getGeneratedRuntimeFileStatus (strategy) {
|
|
|
227
227
|
* Formats a parsed test count for a customer-facing diagnosis.
|
|
228
228
|
*
|
|
229
229
|
* @param {number|null} count observed test count
|
|
230
|
-
* @returns {string} formatted count
|
|
231
230
|
*/
|
|
232
231
|
function formatObservedCount (count) {
|
|
233
232
|
return count === null ? 'an unknown test count' : `${count} observed tests`
|
|
@@ -37,7 +37,6 @@ function parseLiteralEnvironmentPrefix (command) {
|
|
|
37
37
|
* @param {string} command command text
|
|
38
38
|
* @param {string} name environment variable
|
|
39
39
|
* @param {string} [platform] target platform
|
|
40
|
-
* @returns {string} command without empty assignments
|
|
41
40
|
*/
|
|
42
41
|
function removeEmptyLiteralEnvironmentAssignments (command, name, platform = process.platform) {
|
|
43
42
|
const source = String(command || '')
|
|
@@ -746,7 +746,6 @@ function hasCucumberBrowserSupport (files, retainedInputs, projectRoot) {
|
|
|
746
746
|
* @param {string} framework framework name
|
|
747
747
|
* @param {string} projectRoot project root
|
|
748
748
|
* @param {boolean} allowDirectoryConvention whether a literal runner selector owns this root
|
|
749
|
-
* @returns {boolean} whether the file is a candidate
|
|
750
749
|
*/
|
|
751
750
|
function isTestFile (filename, source, framework, projectRoot, allowDirectoryConvention) {
|
|
752
751
|
const basename = path.basename(filename)
|
|
@@ -775,7 +774,6 @@ function isTestFile (filename, source, framework, projectRoot, allowDirectoryCon
|
|
|
775
774
|
*
|
|
776
775
|
* @param {string} source candidate source
|
|
777
776
|
* @param {string} framework framework name
|
|
778
|
-
* @returns {boolean} whether ownership is explicit
|
|
779
777
|
*/
|
|
780
778
|
function hasExplicitFrameworkImport (source, framework) {
|
|
781
779
|
if (framework === 'vitest') {
|
|
@@ -797,7 +795,6 @@ function hasExplicitFrameworkImport (source, framework) {
|
|
|
797
795
|
* @param {string} source file source
|
|
798
796
|
* @param {string} framework framework name
|
|
799
797
|
* @param {string} packageName project package name
|
|
800
|
-
* @returns {boolean} whether ownership is plausible
|
|
801
798
|
*/
|
|
802
799
|
function hasFrameworkOwnership (filename, source, framework, packageName) {
|
|
803
800
|
const normalized = filename.replaceAll('\\', '/').toLowerCase()
|
|
@@ -821,7 +818,6 @@ function hasFrameworkOwnership (filename, source, framework, packageName) {
|
|
|
821
818
|
*
|
|
822
819
|
* @param {string} source candidate source
|
|
823
820
|
* @param {string} framework selected framework
|
|
824
|
-
* @returns {boolean} whether source ownership conflicts
|
|
825
821
|
*/
|
|
826
822
|
function hasConflictingFramework (source, framework) {
|
|
827
823
|
const markers = {
|
|
@@ -840,7 +836,6 @@ function hasConflictingFramework (source, framework) {
|
|
|
840
836
|
* @param {string} filename candidate filename
|
|
841
837
|
* @param {string} source candidate source
|
|
842
838
|
* @param {string} projectRoot project root
|
|
843
|
-
* @returns {number} lower-is-better rank
|
|
844
839
|
*/
|
|
845
840
|
function getTestRank (filename, source, projectRoot) {
|
|
846
841
|
const relative = path.relative(projectRoot, filename).replaceAll('\\', '/').toLowerCase()
|
|
@@ -857,7 +852,6 @@ function getTestRank (filename, source, projectRoot) {
|
|
|
857
852
|
* Counts static test declarations for preferring small representative files.
|
|
858
853
|
*
|
|
859
854
|
* @param {string} source test source
|
|
860
|
-
* @returns {number} approximate test declaration count
|
|
861
855
|
*/
|
|
862
856
|
function getStaticTestCount (source) {
|
|
863
857
|
const direct = [...source.matchAll(/\b(?:it|test)((?:\.[A-Za-z]+)*)\s*\(\s*(['"`])/g)]
|
|
@@ -873,7 +867,6 @@ function getStaticTestCount (source) {
|
|
|
873
867
|
*
|
|
874
868
|
* @param {string} projectRoot detected project root
|
|
875
869
|
* @param {string} repositoryRoot repository root
|
|
876
|
-
* @returns {string} preferred representative root
|
|
877
870
|
*/
|
|
878
871
|
function findPreferredRepresentativeRoot (projectRoot, repositoryRoot) {
|
|
879
872
|
if (path.resolve(projectRoot) !== path.resolve(repositoryRoot)) return projectRoot
|
|
@@ -895,7 +888,6 @@ function findPreferredRepresentativeRoot (projectRoot, repositoryRoot) {
|
|
|
895
888
|
* Normalizes repository and package names for exact identity comparison.
|
|
896
889
|
*
|
|
897
890
|
* @param {string} value package identity
|
|
898
|
-
* @returns {string} normalized identity
|
|
899
891
|
*/
|
|
900
892
|
function normalizeProjectIdentity (value) {
|
|
901
893
|
const unscoped = String(value || '').toLowerCase().replace(/^@[^/]+\//, '')
|
|
@@ -983,7 +975,6 @@ function findPackageRoot (packageName, projectRoot, repositoryRoot) {
|
|
|
983
975
|
* Returns a runner package name.
|
|
984
976
|
*
|
|
985
977
|
* @param {string} framework framework name
|
|
986
|
-
* @returns {string} package name
|
|
987
978
|
*/
|
|
988
979
|
function getRunnerPackageName (framework) {
|
|
989
980
|
return {
|
|
@@ -1024,7 +1015,6 @@ function getGeneratedTestConvention (framework, representative, projectRoot) {
|
|
|
1024
1015
|
*
|
|
1025
1016
|
* @param {string} framework framework name
|
|
1026
1017
|
* @param {string} representative representative test
|
|
1027
|
-
* @returns {string} generated test suffix
|
|
1028
1018
|
*/
|
|
1029
1019
|
function getTestExtension (framework, representative) {
|
|
1030
1020
|
if (framework === 'cucumber') return '.feature'
|
|
@@ -1102,7 +1092,6 @@ function rankCiReviewTargets (files) {
|
|
|
1102
1092
|
* Returns a lower-is-better CI review rank.
|
|
1103
1093
|
*
|
|
1104
1094
|
* @param {string} filename CI path
|
|
1105
|
-
* @returns {number} rank
|
|
1106
1095
|
*/
|
|
1107
1096
|
function getCiRank (filename) {
|
|
1108
1097
|
const value = filename.toLowerCase()
|
|
@@ -1219,7 +1208,6 @@ function readJson (filename) {
|
|
|
1219
1208
|
*
|
|
1220
1209
|
* @param {string} framework framework id
|
|
1221
1210
|
* @param {Set<string>} selected selected ids
|
|
1222
|
-
* @returns {boolean} selection result
|
|
1223
1211
|
*/
|
|
1224
1212
|
function isSelected (framework, selected) {
|
|
1225
1213
|
return selected.size === 0 || selected.has(framework)
|
|
@@ -1231,7 +1219,6 @@ function isSelected (framework, selected) {
|
|
|
1231
1219
|
* @param {object} packageJson package metadata
|
|
1232
1220
|
* @param {string} projectRoot project root
|
|
1233
1221
|
* @param {string} repositoryRoot repository root
|
|
1234
|
-
* @returns {string} project id
|
|
1235
1222
|
*/
|
|
1236
1223
|
function getProjectId (packageJson, projectRoot, repositoryRoot) {
|
|
1237
1224
|
const value = packageJson.name || path.relative(repositoryRoot, projectRoot) || 'root'
|
|
@@ -1242,7 +1229,6 @@ function getProjectId (packageJson, projectRoot, repositoryRoot) {
|
|
|
1242
1229
|
* Detects package-manager metadata for reporting only.
|
|
1243
1230
|
*
|
|
1244
1231
|
* @param {string} root repository root
|
|
1245
|
-
* @returns {string} package manager
|
|
1246
1232
|
*/
|
|
1247
1233
|
function detectPackageManager (root) {
|
|
1248
1234
|
if (fs.existsSync(path.join(root, 'pnpm-lock.yaml'))) return 'pnpm'
|
|
@@ -1255,7 +1241,6 @@ function detectPackageManager (root) {
|
|
|
1255
1241
|
* Detects workspace metadata for reporting only.
|
|
1256
1242
|
*
|
|
1257
1243
|
* @param {string} root repository root
|
|
1258
|
-
* @returns {string} workspace manager
|
|
1259
1244
|
*/
|
|
1260
1245
|
function detectWorkspaceManager (root) {
|
|
1261
1246
|
if (fs.existsSync(path.join(root, 'pnpm-workspace.yaml'))) return 'pnpm'
|
|
@@ -1267,7 +1252,6 @@ function detectWorkspaceManager (root) {
|
|
|
1267
1252
|
* Returns a manifest operating-system name.
|
|
1268
1253
|
*
|
|
1269
1254
|
* @param {string} platform Node.js platform
|
|
1270
|
-
* @returns {string} OS name
|
|
1271
1255
|
*/
|
|
1272
1256
|
function getManifestOs (platform) {
|
|
1273
1257
|
return platform === 'win32' ? 'windows' : platform
|
|
@@ -1278,7 +1262,6 @@ function getManifestOs (platform) {
|
|
|
1278
1262
|
*
|
|
1279
1263
|
* @param {string} root root path
|
|
1280
1264
|
* @param {string} filename candidate path
|
|
1281
|
-
* @returns {boolean} whether the candidate is contained
|
|
1282
1265
|
*/
|
|
1283
1266
|
function isPathInside (root, filename) {
|
|
1284
1267
|
const relative = path.relative(path.resolve(root), path.resolve(filename))
|
|
@@ -94,7 +94,6 @@ function validateManifest (manifest) {
|
|
|
94
94
|
*
|
|
95
95
|
* @param {object} manifest validation manifest
|
|
96
96
|
* @param {{push: function(string): void, full: function(): boolean}} errors error collector
|
|
97
|
-
* @returns {void}
|
|
98
97
|
*/
|
|
99
98
|
function validateFrameworks (manifest, errors) {
|
|
100
99
|
const ids = new Set()
|
|
@@ -164,7 +163,6 @@ function validateFrameworks (manifest, errors) {
|
|
|
164
163
|
* @param {object} project project metadata
|
|
165
164
|
* @param {string} prefix error prefix
|
|
166
165
|
* @param {{push: function(string): void}} errors error collector
|
|
167
|
-
* @returns {void}
|
|
168
166
|
*/
|
|
169
167
|
function validateProject (repositoryRoot, project, prefix, errors) {
|
|
170
168
|
if (!isObject(project)) return
|
|
@@ -192,7 +190,6 @@ function validateProject (repositoryRoot, project, prefix, errors) {
|
|
|
192
190
|
* @param {string} prefix error prefix
|
|
193
191
|
* @param {Map<string, string>} generatedPaths generated paths used by other frameworks
|
|
194
192
|
* @param {{push: function(string): void}} errors error collector
|
|
195
|
-
* @returns {void}
|
|
196
193
|
*/
|
|
197
194
|
function validateRunnableFramework (repositoryRoot, framework, prefix, generatedPaths, errors) {
|
|
198
195
|
if (!isObject(framework.validation)) {
|
|
@@ -276,7 +273,6 @@ function validateRunnableFramework (repositoryRoot, framework, prefix, generated
|
|
|
276
273
|
* @param {object} validation direct-runner validation data
|
|
277
274
|
* @param {string} prefix error prefix
|
|
278
275
|
* @param {{push: function(string): void}} errors error collector
|
|
279
|
-
* @returns {void}
|
|
280
276
|
*/
|
|
281
277
|
function validateFallbackTests (repositoryRoot, validation, prefix, errors) {
|
|
282
278
|
if (validation.fallbackTests === undefined) return
|
|
@@ -322,7 +318,6 @@ function validateFallbackTests (repositoryRoot, validation, prefix, errors) {
|
|
|
322
318
|
* @param {string} prefix framework error prefix
|
|
323
319
|
* @param {Map<string, string>} generatedPaths generated paths used by other frameworks
|
|
324
320
|
* @param {{push: function(string): void}} errors error collector
|
|
325
|
-
* @returns {void}
|
|
326
321
|
*/
|
|
327
322
|
function validateGeneratedStrategy (repositoryRoot, framework, prefix, generatedPaths, errors) {
|
|
328
323
|
const strategy = framework.generatedTestStrategy
|
|
@@ -406,7 +401,6 @@ function validateGeneratedStrategy (repositoryRoot, framework, prefix, generated
|
|
|
406
401
|
* @param {object} scenario generated scenario
|
|
407
402
|
* @param {string} prefix error prefix
|
|
408
403
|
* @param {{push: function(string): void}} errors error collector
|
|
409
|
-
* @returns {void}
|
|
410
404
|
*/
|
|
411
405
|
function validateScenarioIdentity (repositoryRoot, scenario, prefix, errors) {
|
|
412
406
|
if (!Array.isArray(scenario.testIdentities) || scenario.testIdentities.length !== 1) {
|
|
@@ -431,7 +425,6 @@ function validateScenarioIdentity (repositoryRoot, scenario, prefix, errors) {
|
|
|
431
425
|
* @param {object|undefined} ciWiring CI evidence
|
|
432
426
|
* @param {string} prefix error prefix
|
|
433
427
|
* @param {{push: function(string): void}} errors error collector
|
|
434
|
-
* @returns {void}
|
|
435
428
|
*/
|
|
436
429
|
function validateCiWiring (repositoryRoot, ciWiring, prefix, errors) {
|
|
437
430
|
if (ciWiring === undefined) return
|
|
@@ -468,7 +461,6 @@ function validateCiWiring (repositoryRoot, ciWiring, prefix, errors) {
|
|
|
468
461
|
* @param {string} prefix error prefix
|
|
469
462
|
* @param {{push: function(string): void}} errors error collector
|
|
470
463
|
* @param {Set<string>} [allowed] explicitly inert keys
|
|
471
|
-
* @returns {void}
|
|
472
464
|
*/
|
|
473
465
|
function rejectExecutionFields (value, prefix, errors, allowed = new Set()) {
|
|
474
466
|
if (!isObject(value)) return
|
|
@@ -487,7 +479,6 @@ function rejectExecutionFields (value, prefix, errors, allowed = new Set()) {
|
|
|
487
479
|
* @param {string} prefix error prefix
|
|
488
480
|
* @param {Map<string, string>} generatedPaths previously claimed paths
|
|
489
481
|
* @param {{push: function(string): void}} errors error collector
|
|
490
|
-
* @returns {void}
|
|
491
482
|
*/
|
|
492
483
|
function claimGeneratedPath (filename, owner, prefix, generatedPaths, errors) {
|
|
493
484
|
if (typeof filename !== 'string' || !path.isAbsolute(filename)) return
|
|
@@ -505,7 +496,6 @@ function claimGeneratedPath (filename, owner, prefix, generatedPaths, errors) {
|
|
|
505
496
|
* @param {unknown} value current value
|
|
506
497
|
* @param {string} prefix error prefix
|
|
507
498
|
* @param {{push: function(string): void, full: function(): boolean}} errors error collector
|
|
508
|
-
* @returns {void}
|
|
509
499
|
*/
|
|
510
500
|
function validateAllStrings (value, prefix, errors) {
|
|
511
501
|
if (errors.full()) return
|
|
@@ -534,7 +524,6 @@ function validateAllStrings (value, prefix, errors) {
|
|
|
534
524
|
* @param {string} field field name
|
|
535
525
|
* @param {string} prefix error prefix
|
|
536
526
|
* @param {{push: function(string): void}} errors error collector
|
|
537
|
-
* @returns {void}
|
|
538
527
|
*/
|
|
539
528
|
function requiredObject (object, field, prefix, errors) {
|
|
540
529
|
if (!isObject(object[field])) errors.push(`${prefix}.${field} must be an object.`)
|
|
@@ -547,7 +536,6 @@ function requiredObject (object, field, prefix, errors) {
|
|
|
547
536
|
* @param {string} field field name
|
|
548
537
|
* @param {string} prefix error prefix
|
|
549
538
|
* @param {{push: function(string): void}} errors error collector
|
|
550
|
-
* @returns {void}
|
|
551
539
|
*/
|
|
552
540
|
function requiredArray (object, field, prefix, errors) {
|
|
553
541
|
if (!Array.isArray(object[field])) errors.push(`${prefix}.${field} must be an array.`)
|
|
@@ -560,7 +548,6 @@ function requiredArray (object, field, prefix, errors) {
|
|
|
560
548
|
* @param {string} field field name
|
|
561
549
|
* @param {string} prefix error prefix
|
|
562
550
|
* @param {{push: function(string): void}} errors error collector
|
|
563
|
-
* @returns {void}
|
|
564
551
|
*/
|
|
565
552
|
function requiredString (object, field, prefix, errors) {
|
|
566
553
|
if (typeof object?.[field] !== 'string' || object[field].trim() === '') {
|
|
@@ -576,7 +563,6 @@ function requiredString (object, field, prefix, errors) {
|
|
|
576
563
|
* @param {Set<string>} values accepted values
|
|
577
564
|
* @param {string} prefix error prefix
|
|
578
565
|
* @param {{push: function(string): void}} errors error collector
|
|
579
|
-
* @returns {void}
|
|
580
566
|
*/
|
|
581
567
|
function enumString (object, field, values, prefix, errors) {
|
|
582
568
|
if (!values.has(object?.[field])) {
|
|
@@ -591,7 +577,6 @@ function enumString (object, field, values, prefix, errors) {
|
|
|
591
577
|
* @param {string} field field name
|
|
592
578
|
* @param {string} prefix error prefix
|
|
593
579
|
* @param {{push: function(string): void}} errors error collector
|
|
594
|
-
* @returns {void}
|
|
595
580
|
*/
|
|
596
581
|
function requiredAbsolutePath (object, field, prefix, errors) {
|
|
597
582
|
absolutePathValue(object?.[field], `${prefix}.${field}`, errors)
|
|
@@ -603,7 +588,6 @@ function requiredAbsolutePath (object, field, prefix, errors) {
|
|
|
603
588
|
* @param {unknown} value path value
|
|
604
589
|
* @param {string} prefix error prefix
|
|
605
590
|
* @param {{push: function(string): void}} errors error collector
|
|
606
|
-
* @returns {void}
|
|
607
591
|
*/
|
|
608
592
|
function absolutePathValue (value, prefix, errors) {
|
|
609
593
|
if (typeof value !== 'string' || !path.isAbsolute(value)) errors.push(`${prefix} must be an absolute path.`)
|
|
@@ -616,7 +600,6 @@ function absolutePathValue (value, prefix, errors) {
|
|
|
616
600
|
* @param {string} field field name
|
|
617
601
|
* @param {string} prefix error prefix
|
|
618
602
|
* @param {{push: function(string): void}} errors error collector
|
|
619
|
-
* @returns {void}
|
|
620
603
|
*/
|
|
621
604
|
function optionalAbsolutePathOrNull (object, field, prefix, errors) {
|
|
622
605
|
if (object[field] !== null && object[field] !== undefined &&
|
|
@@ -632,7 +615,6 @@ function optionalAbsolutePathOrNull (object, field, prefix, errors) {
|
|
|
632
615
|
* @param {string} field field name
|
|
633
616
|
* @param {string} prefix error prefix
|
|
634
617
|
* @param {{push: function(string): void}} errors error collector
|
|
635
|
-
* @returns {void}
|
|
636
618
|
*/
|
|
637
619
|
function optionalStringOrNull (object, field, prefix, errors) {
|
|
638
620
|
if (object[field] !== null && object[field] !== undefined && typeof object[field] !== 'string') {
|
|
@@ -646,7 +628,6 @@ function optionalStringOrNull (object, field, prefix, errors) {
|
|
|
646
628
|
* @param {unknown} value array value
|
|
647
629
|
* @param {string} prefix error prefix
|
|
648
630
|
* @param {{push: function(string): void}} errors error collector
|
|
649
|
-
* @returns {void}
|
|
650
631
|
*/
|
|
651
632
|
function validateStringArray (value, prefix, errors) {
|
|
652
633
|
if (value === undefined) return
|
|
@@ -667,7 +648,6 @@ function validateStringArray (value, prefix, errors) {
|
|
|
667
648
|
* @param {unknown} filename candidate path
|
|
668
649
|
* @param {string} prefix error prefix
|
|
669
650
|
* @param {{push: function(string): void}} errors error collector
|
|
670
|
-
* @returns {void}
|
|
671
651
|
*/
|
|
672
652
|
function containedPath (root, filename, prefix, errors) {
|
|
673
653
|
if (typeof root !== 'string' || !path.isAbsolute(root) ||
|
|
@@ -682,7 +662,6 @@ function containedPath (root, filename, prefix, errors) {
|
|
|
682
662
|
* Returns whether a value is a plain object.
|
|
683
663
|
*
|
|
684
664
|
* @param {unknown} value candidate value
|
|
685
|
-
* @returns {boolean} whether the value is an object
|
|
686
665
|
*/
|
|
687
666
|
function isObject (value) {
|
|
688
667
|
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
@@ -174,7 +174,6 @@ function getOfflineScenarioNames (requestedScenario) {
|
|
|
174
174
|
*
|
|
175
175
|
* @param {object} framework framework manifest entry
|
|
176
176
|
* @param {string} scenarioName cache execution name
|
|
177
|
-
* @returns {string} SHA-256 fixture recipe digest
|
|
178
177
|
*/
|
|
179
178
|
function getFixtureRecipeDigest (framework, scenarioName) {
|
|
180
179
|
const generatedScenarioId = {
|
|
@@ -276,7 +275,6 @@ function mergeSettings (settings = {}) {
|
|
|
276
275
|
* Creates or verifies a private validator-owned fixture directory.
|
|
277
276
|
*
|
|
278
277
|
* @param {string} directory fixture base directory
|
|
279
|
-
* @returns {void}
|
|
280
278
|
*/
|
|
281
279
|
function ensurePrivateDirectory (directory) {
|
|
282
280
|
try {
|
|
@@ -298,7 +296,6 @@ function ensurePrivateDirectory (directory) {
|
|
|
298
296
|
*
|
|
299
297
|
* @param {string} directory first candidate directory
|
|
300
298
|
* @param {string} stop fixture base directory
|
|
301
|
-
* @returns {void}
|
|
302
299
|
*/
|
|
303
300
|
function removeEmptyParents (directory, stop) {
|
|
304
301
|
let current = directory
|
|
@@ -320,7 +317,6 @@ function removeEmptyParents (directory, stop) {
|
|
|
320
317
|
*
|
|
321
318
|
* @param {string} root candidate parent
|
|
322
319
|
* @param {string} filename candidate child
|
|
323
|
-
* @returns {boolean} whether the child is inside the parent
|
|
324
320
|
*/
|
|
325
321
|
function isPathInside (root, filename) {
|
|
326
322
|
const relative = path.relative(root, filename)
|
|
@@ -88,7 +88,10 @@ function getFailureDetail (result) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function sanitizeLine (value) {
|
|
91
|
-
|
|
91
|
+
const line = sanitizeString(String(value)).replaceAll(/\p{Cc}+/gu, ' ').trim().slice(0, 1000)
|
|
92
|
+
let end = line.length
|
|
93
|
+
while (end > 0 && line[end - 1] === '.') end--
|
|
94
|
+
return line.slice(0, end)
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
module.exports = { checkInstalledPackage, getInstalledPackageFailure }
|
|
@@ -27,7 +27,6 @@ const SCENARIO_TO_GENERATED_ID = {
|
|
|
27
27
|
* Produces the deterministic execution plan shown before live validation.
|
|
28
28
|
*
|
|
29
29
|
* @param {object} input plan inputs
|
|
30
|
-
* @returns {string} Markdown execution plan
|
|
31
30
|
*/
|
|
32
31
|
function formatExecutionPlan (input) {
|
|
33
32
|
return formatExecutionPlanArtifacts(input).plan
|
|
@@ -104,7 +103,6 @@ function formatExecutionPlanArtifacts ({
|
|
|
104
103
|
* @param {object|undefined} input.packageCheck installed package-load result
|
|
105
104
|
* @param {string|null} input.requestedScenario selected scenario
|
|
106
105
|
* @param {string[]} input.validatorArgv exact validator command
|
|
107
|
-
* @returns {string} Markdown plan
|
|
108
106
|
*/
|
|
109
107
|
function formatApprovalPlan ({
|
|
110
108
|
approvalArtifacts,
|
|
@@ -449,7 +447,6 @@ function getSelectedSupportFiles (framework, selectedScenarios) {
|
|
|
449
447
|
*
|
|
450
448
|
* @param {object} framework framework entry
|
|
451
449
|
* @param {object} scenario generated scenario
|
|
452
|
-
* @returns {string} source
|
|
453
450
|
*/
|
|
454
451
|
function getGeneratedSource (framework, scenario) {
|
|
455
452
|
const filename = path.resolve(scenario.testIdentities[0].file)
|
|
@@ -461,7 +458,6 @@ function getGeneratedSource (framework, scenario) {
|
|
|
461
458
|
* Returns the execution plan path.
|
|
462
459
|
*
|
|
463
460
|
* @param {string} out output directory
|
|
464
|
-
* @returns {string} plan path
|
|
465
461
|
*/
|
|
466
462
|
function getExecutionPlanPath (out) {
|
|
467
463
|
return path.join(out, EXECUTION_PLAN_FILENAME)
|
|
@@ -472,7 +468,6 @@ function getExecutionPlanPath (out) {
|
|
|
472
468
|
*
|
|
473
469
|
* @param {object} framework framework entry
|
|
474
470
|
* @param {string} root repository root
|
|
475
|
-
* @returns {string} label
|
|
476
471
|
*/
|
|
477
472
|
function getFrameworkLabel (framework, root) {
|
|
478
473
|
const project = framework.project?.name || relative(root, framework.project?.root || root)
|
|
@@ -483,7 +478,6 @@ function getFrameworkLabel (framework, root) {
|
|
|
483
478
|
* Formats a framework status.
|
|
484
479
|
*
|
|
485
480
|
* @param {string} status status id
|
|
486
|
-
* @returns {string} status text
|
|
487
481
|
*/
|
|
488
482
|
function formatStatus (status) {
|
|
489
483
|
return {
|
|
@@ -498,7 +492,6 @@ function formatStatus (status) {
|
|
|
498
492
|
*
|
|
499
493
|
* @param {string} root repository root
|
|
500
494
|
* @param {string} filename absolute path
|
|
501
|
-
* @returns {string} relative display path
|
|
502
495
|
*/
|
|
503
496
|
function relative (root, filename) {
|
|
504
497
|
const value = path.relative(root, filename)
|
|
@@ -509,7 +502,6 @@ function relative (root, filename) {
|
|
|
509
502
|
* Formats a safe Markdown code block.
|
|
510
503
|
*
|
|
511
504
|
* @param {string} value text
|
|
512
|
-
* @returns {string} code block
|
|
513
505
|
*/
|
|
514
506
|
function codeBlock (value) {
|
|
515
507
|
return `\`\`\`text\n${plainMultiline(value).replaceAll('```', String.raw`\u0060\u0060\u0060`)}\n\`\`\``
|
|
@@ -519,7 +511,6 @@ function codeBlock (value) {
|
|
|
519
511
|
* Formats safe inline code.
|
|
520
512
|
*
|
|
521
513
|
* @param {string} value text
|
|
522
|
-
* @returns {string} inline code
|
|
523
514
|
*/
|
|
524
515
|
function inline (value) {
|
|
525
516
|
return `\`${plain(value).replaceAll('`', String.raw`\u0060`)}\``
|
|
@@ -529,7 +520,6 @@ function inline (value) {
|
|
|
529
520
|
* Sanitizes one line of plan text.
|
|
530
521
|
*
|
|
531
522
|
* @param {unknown} value text
|
|
532
|
-
* @returns {string} safe text
|
|
533
523
|
*/
|
|
534
524
|
function plain (value) {
|
|
535
525
|
return sanitizeString(String(value ?? '')).replaceAll(/\p{Cc}+/gu, ' ').trim()
|
|
@@ -539,7 +529,6 @@ function plain (value) {
|
|
|
539
529
|
* Sanitizes multiline plan text.
|
|
540
530
|
*
|
|
541
531
|
* @param {unknown} value text
|
|
542
|
-
* @returns {string} safe text
|
|
543
532
|
*/
|
|
544
533
|
function plainMultiline (value) {
|
|
545
534
|
return sanitizeString(String(value ?? '')).replaceAll('\r\n', '\n').replaceAll('\r', '\n').trim()
|
|
@@ -141,7 +141,6 @@ async function runCandidate ({ framework, index, options, out, testFile }) {
|
|
|
141
141
|
* @param {object|undefined} commandFailure classified blocker
|
|
142
142
|
* @param {string[]} diagnosticSummary bounded diagnostic lines
|
|
143
143
|
* @param {object} framework framework manifest entry
|
|
144
|
-
* @returns {string} customer-facing diagnosis
|
|
145
144
|
*/
|
|
146
145
|
function getFailureDiagnosis (result, observedTestCount, commandFailure, diagnosticSummary, framework) {
|
|
147
146
|
const sharedPrerequisite = !commandFailure && framework.allCandidatesRequireLocalSocket
|
|
@@ -167,7 +167,6 @@ function sanitizeEnvValue (name, value) {
|
|
|
167
167
|
* Redacts common inline secret forms from strings.
|
|
168
168
|
*
|
|
169
169
|
* @param {string} value string to sanitize
|
|
170
|
-
* @returns {string} sanitized string
|
|
171
170
|
*/
|
|
172
171
|
function sanitizeString (value) {
|
|
173
172
|
const references = []
|
|
@@ -195,7 +194,6 @@ function sanitizeString (value) {
|
|
|
195
194
|
* Detects default-ignorable Unicode characters that can conceal executable text or secret names.
|
|
196
195
|
*
|
|
197
196
|
* @param {unknown} value candidate text
|
|
198
|
-
* @returns {boolean} true when the text contains a default-ignorable Unicode character
|
|
199
197
|
*/
|
|
200
198
|
function hasUnicodeDefaultIgnorable (value) {
|
|
201
199
|
return DEFAULT_IGNORABLE_TEST_PATTERN.test(String(value ?? ''))
|
|
@@ -214,7 +212,6 @@ function hasUnsafeExecutionCharacter (value) {
|
|
|
214
212
|
* Makes untrusted text safe to print to an interactive terminal while preserving line breaks.
|
|
215
213
|
*
|
|
216
214
|
* @param {unknown} value console value
|
|
217
|
-
* @returns {string} inert console text
|
|
218
215
|
*/
|
|
219
216
|
function sanitizeConsoleText (value) {
|
|
220
217
|
let result = ''
|
|
@@ -231,7 +228,6 @@ function sanitizeConsoleText (value) {
|
|
|
231
228
|
* Returns whether a key or variable name usually carries secret values.
|
|
232
229
|
*
|
|
233
230
|
* @param {string} name key or environment variable name
|
|
234
|
-
* @returns {boolean} true when values under this name should be redacted
|
|
235
231
|
*/
|
|
236
232
|
function isSensitiveName (name) {
|
|
237
233
|
const normalized = String(name || '').replaceAll(/[-.]/g, '_')
|
|
@@ -33,7 +33,6 @@ const SCENARIO_NAMES = {
|
|
|
33
33
|
* @param {string} input.out output directory
|
|
34
34
|
* @param {object} [input.staticDiagnosis] static diagnosis artifacts
|
|
35
35
|
* @param {object} [input.runSummary] run summary
|
|
36
|
-
* @returns {void}
|
|
37
36
|
*/
|
|
38
37
|
function writeReport ({ manifest, results, out, staticDiagnosis, runSummary = {} }) {
|
|
39
38
|
const reportPath = path.join(out, REPORT_FILENAME)
|
|
@@ -60,7 +59,6 @@ function writeReport ({ manifest, results, out, staticDiagnosis, runSummary = {}
|
|
|
60
59
|
* @param {object} input pending report inputs
|
|
61
60
|
* @param {object} input.manifest normalized manifest
|
|
62
61
|
* @param {string} input.out output directory
|
|
63
|
-
* @returns {void}
|
|
64
62
|
*/
|
|
65
63
|
function writePendingReport ({ manifest, out }) {
|
|
66
64
|
const reportPath = path.join(out, REPORT_FILENAME)
|
|
@@ -91,7 +89,6 @@ function writePendingReport ({ manifest, out }) {
|
|
|
91
89
|
* @param {object[]} input.results sanitized results
|
|
92
90
|
* @param {object} input.runSummary run summary
|
|
93
91
|
* @param {string|undefined} input.staticDiagnosisPath static diagnosis path
|
|
94
|
-
* @returns {string} Markdown
|
|
95
92
|
*/
|
|
96
93
|
function renderReport ({ manifest, out, reportPath, results, runSummary, staticDiagnosisPath }) {
|
|
97
94
|
const lines = [
|
|
@@ -190,7 +187,6 @@ function renderReport ({ manifest, out, reportPath, results, runSummary, staticD
|
|
|
190
187
|
*
|
|
191
188
|
* @param {string} out validation output directory
|
|
192
189
|
* @param {string|undefined} approvedPlanSha256 approved plan digest
|
|
193
|
-
* @returns {boolean} whether the current plan is safe to label as approved
|
|
194
190
|
*/
|
|
195
191
|
function hasCurrentExecutionPlan (out, approvedPlanSha256) {
|
|
196
192
|
if (!APPROVAL_DIGEST_PATTERN.test(String(approvedPlanSha256 || ''))) return false
|
|
@@ -442,7 +438,6 @@ function compactEvidence (evidence = {}) {
|
|
|
442
438
|
* Renders JSON without allowing evidence strings to close the Markdown fence.
|
|
443
439
|
*
|
|
444
440
|
* @param {object} value structured evidence
|
|
445
|
-
* @returns {string} fenced JSON body
|
|
446
441
|
*/
|
|
447
442
|
function fencedJson (value) {
|
|
448
443
|
return JSON.stringify(value, null, 2).replaceAll('```', String.raw`\u0060\u0060\u0060`)
|
|
@@ -454,7 +449,6 @@ function fencedJson (value) {
|
|
|
454
449
|
* @param {object[]} results validation results
|
|
455
450
|
* @param {object} runSummary run summary
|
|
456
451
|
* @param {string} reportPath report path
|
|
457
|
-
* @returns {string} console text
|
|
458
452
|
*/
|
|
459
453
|
function renderConsole (results, runSummary, reportPath) {
|
|
460
454
|
const lines = [
|
|
@@ -478,7 +472,6 @@ function renderConsole (results, runSummary, reportPath) {
|
|
|
478
472
|
* Returns whether a result lacks a conclusive pass/fail.
|
|
479
473
|
*
|
|
480
474
|
* @param {object|undefined} result validation result
|
|
481
|
-
* @returns {boolean} whether incomplete
|
|
482
475
|
*/
|
|
483
476
|
function isIncomplete (result) {
|
|
484
477
|
return Boolean(result && (
|
|
@@ -492,7 +485,6 @@ function isIncomplete (result) {
|
|
|
492
485
|
* Returns a display status.
|
|
493
486
|
*
|
|
494
487
|
* @param {object} result validation result
|
|
495
|
-
* @returns {string} status
|
|
496
488
|
*/
|
|
497
489
|
function getDisplayStatus (result) {
|
|
498
490
|
if (result.scenario === 'ci-wiring' && result.status === 'fail') {
|
|
@@ -520,7 +512,6 @@ function getVisibleResults (results) {
|
|
|
520
512
|
* Returns whether detailed debugging context should be shown.
|
|
521
513
|
*
|
|
522
514
|
* @param {object} result validation result
|
|
523
|
-
* @returns {boolean} whether details are useful
|
|
524
515
|
*/
|
|
525
516
|
function shouldRenderDiagnostics (result) {
|
|
526
517
|
return result.status === 'fail' || result.status === 'error' || isIncomplete(result)
|
|
@@ -578,7 +569,6 @@ function getArtifactDirectory (artifacts = [], out) {
|
|
|
578
569
|
*
|
|
579
570
|
* @param {string} root root path
|
|
580
571
|
* @param {string} filename candidate path
|
|
581
|
-
* @returns {boolean} containment
|
|
582
572
|
*/
|
|
583
573
|
function isPathInside (root, filename) {
|
|
584
574
|
const value = path.relative(root, filename)
|
|
@@ -589,7 +579,6 @@ function isPathInside (root, filename) {
|
|
|
589
579
|
* Formats an execution status.
|
|
590
580
|
*
|
|
591
581
|
* @param {string|undefined} status status id
|
|
592
|
-
* @returns {string} display status
|
|
593
582
|
*/
|
|
594
583
|
function formatExecutionStatus (status) {
|
|
595
584
|
return String(status || 'incomplete').replaceAll('_', ' ').toUpperCase()
|
|
@@ -628,7 +617,6 @@ function formatCleanupStatus (cleanup) {
|
|
|
628
617
|
* Returns a display scenario name.
|
|
629
618
|
*
|
|
630
619
|
* @param {string} scenario scenario id
|
|
631
|
-
* @returns {string} display name
|
|
632
620
|
*/
|
|
633
621
|
function getScenarioName (scenario) {
|
|
634
622
|
return SCENARIO_NAMES[scenario] || scenario
|
|
@@ -638,7 +626,6 @@ function getScenarioName (scenario) {
|
|
|
638
626
|
* Formats a Markdown table cell.
|
|
639
627
|
*
|
|
640
628
|
* @param {unknown} value cell value
|
|
641
|
-
* @returns {string} escaped text
|
|
642
629
|
*/
|
|
643
630
|
function cell (value) {
|
|
644
631
|
return plain(value).replaceAll('|', String.raw`\|`)
|
|
@@ -648,7 +635,6 @@ function cell (value) {
|
|
|
648
635
|
* Formats inline code.
|
|
649
636
|
*
|
|
650
637
|
* @param {unknown} value code value
|
|
651
|
-
* @returns {string} Markdown code
|
|
652
638
|
*/
|
|
653
639
|
function code (value) {
|
|
654
640
|
return `\`${plain(value).replaceAll('`', String.raw`\u0060`)}\``
|
|
@@ -658,7 +644,6 @@ function code (value) {
|
|
|
658
644
|
* Sanitizes one line of report text.
|
|
659
645
|
*
|
|
660
646
|
* @param {unknown} value text
|
|
661
|
-
* @returns {string} safe text
|
|
662
647
|
*/
|
|
663
648
|
function plain (value) {
|
|
664
649
|
return sanitizeString(String(value ?? '')).replaceAll(/\p{Cc}+/gu, ' ').trim()
|
|
@@ -669,7 +654,6 @@ function plain (value) {
|
|
|
669
654
|
*
|
|
670
655
|
* @param {string} root base directory
|
|
671
656
|
* @param {string} filename file path
|
|
672
|
-
* @returns {string} relative path
|
|
673
657
|
*/
|
|
674
658
|
function relative (root, filename) {
|
|
675
659
|
return path.relative(root, filename) || '.'
|
|
@@ -121,7 +121,6 @@ function getManifestInputFiles (manifest, { includeLocal = true } = {}) {
|
|
|
121
121
|
*
|
|
122
122
|
* @param {string} scenarioId generated scenario id
|
|
123
123
|
* @param {string|null} requestedScenario selected validator scenario
|
|
124
|
-
* @returns {boolean} whether to include the command
|
|
125
124
|
*/
|
|
126
125
|
function shouldIncludeGeneratedScenario (scenarioId, requestedScenario) {
|
|
127
126
|
if (!requestedScenario) return true
|
|
@@ -241,7 +240,6 @@ function getRunnerEnv (framework) {
|
|
|
241
240
|
*
|
|
242
241
|
* @param {Set<string>} files collected files
|
|
243
242
|
* @param {string|undefined} filename candidate file
|
|
244
|
-
* @returns {void}
|
|
245
243
|
*/
|
|
246
244
|
function addExistingFile (files, filename) {
|
|
247
245
|
if (typeof filename !== 'string') return
|
|
@@ -254,7 +252,6 @@ function addExistingFile (files, filename) {
|
|
|
254
252
|
* Formats a framework name for command descriptions.
|
|
255
253
|
*
|
|
256
254
|
* @param {string} framework framework name
|
|
257
|
-
* @returns {string} display name
|
|
258
255
|
*/
|
|
259
256
|
function formatFrameworkName (framework) {
|
|
260
257
|
return framework.charAt(0).toUpperCase() + framework.slice(1)
|