dd-trace-rb icon indicating copy to clipboard operation
dd-trace-rb copied to clipboard

[NO-TICKET] Fix `IncompatibleAssignment` steep check

Open vpellan opened this issue 2 months ago • 3 comments

What does this PR do?

Remove IncompatibleAssignment exclusion from the Steepfile and fixes related issues.

Motivation:

Improve typing on dd-trace-rb.

Change log entry

None.

Additional Notes:

How to test the change?

bundle exec rake steep:check

vpellan avatar Oct 30 '25 18:10 vpellan

Benchmarks

Benchmark execution time: 2025-12-16 15:31:52

Comparing candidate commit c9c309ffef93bcc8b2a0ff2d25c45862d9e89bf0 in PR branch vpellan/steep-fix-incompatible-assignment with baseline commit 5b343b78305e40fb87bfa2949630cff0127c0df4 in branch master.

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

pr-commenter[bot] avatar Oct 31 '25 16:10 pr-commenter[bot]

Typing analysis

Note: Ignored files are excluded from the next sections.

steep:ignore comments

This PR introduces 27 steep:ignore comments, and clears 5 steep:ignore comments.

steep:ignore comments (+27-5)Introduced:
lib/datadog/appsec/context.rb:11
lib/datadog/core/configuration/option_definition.rb:46
lib/datadog/core/configuration/option_definition.rb:124
lib/datadog/core/configuration/options.rb:45
lib/datadog/core/configuration/options.rb:48
lib/datadog/core/configuration/options.rb:52
lib/datadog/core/configuration/options.rb:53
lib/datadog/core/configuration/options.rb:133
lib/datadog/core/rate_limiter.rb:165
lib/datadog/di/el/compiler.rb:26
lib/datadog/di/el/compiler.rb:38
lib/datadog/di/el/compiler.rb:44
lib/datadog/di/el/compiler.rb:47
lib/datadog/di/instrumenter.rb:209
lib/datadog/di/instrumenter.rb:301
lib/datadog/di/probe_builder.rb:24
lib/datadog/open_feature/evaluation_engine.rb:13
lib/datadog/open_feature/remote.rb:10
lib/datadog/profiling/collectors/code_provenance.rb:165
lib/datadog/profiling/collectors/info.rb:20
lib/datadog/profiling/http_transport.rb:19
lib/datadog/tracing/contrib/status_range_matcher.rb:12
lib/datadog/tracing/contrib/utils/quantization/hash.rb:15
lib/datadog/tracing/span_operation.rb:293
lib/datadog/tracing/span_operation.rb:320
lib/datadog/tracing/span_operation.rb:392
lib/datadog/tracing/span_operation.rb:556
Cleared:
lib/datadog/core/configuration/options.rb:47
lib/datadog/core/configuration/options.rb:51
lib/datadog/di/instrumenter.rb:212
lib/datadog/di/instrumenter.rb:304
lib/datadog/tracing/span_operation.rb:319

Untyped methods

This PR introduces 5 partially typed methods, and clears 4 partially typed methods. It decreases the percentage of typed methods from 55.39% to 55.33% (-0.06%).

Partially typed methods (+5-4)Introduced:
sig/datadog/core/configuration/option_definition.rbs:88
└── def default_proc: () ?{ (?) [self: Options::GenericSettingsClass] -> untyped } -> void
sig/datadog/core/configuration/option_definition.rbs:92
└── def helper: (Symbol name, *untyped _args) { (?) [self: Options::GenericSettingsClass] -> untyped } -> void
sig/datadog/di/instrumenter.rbs:24
└── def initialize: (untyped settings, Serializer serializer, DI::Logger logger, ?code_tracker: CodeTracker?, ?telemetry: Core::Telemetry::Component?) -> void
sig/datadog/di/serializer.rbs:13
└── def initialize: (untyped settings, untyped redactor, ?telemetry: Core::Telemetry::Component?) -> void
sig/datadog/tracing/contrib/graphql/unified_trace.rbs:94
└── def trace: (Proc callable, String trace_key, (String | nil) resource, ?(^(SpanOperation) -> void)? before, ?(^(SpanOperation) -> void)? after, **untyped kwargs) ?{ (SpanOperation) -> void } -> untyped
Cleared:
sig/datadog/core/configuration/option_definition.rbs:80
└── def helper: (Symbol name, *untyped _args) { (?) [self: Options::GenericSettingsClass] -> untyped } -> void
sig/datadog/di/instrumenter.rbs:24
└── def initialize: (untyped settings, Serializer serializer, DI::Logger logger, ?code_tracker: CodeTracker?, ?telemetry: Core::Telemetry::Component) -> void
sig/datadog/di/serializer.rbs:13
└── def initialize: (untyped settings, untyped redactor, ?telemetry: Core::Telemetry::Component) -> void
sig/datadog/tracing/contrib/graphql/unified_trace.rbs:94
└── def trace: (Proc callable, String trace_key, (String | nil) resource, ?^(SpanOperation) -> void before, ?^(SpanOperation) -> void after, **untyped kwargs) ?{ (SpanOperation) -> void } -> untyped

Untyped other declarations

This PR introduces 5 partially typed other declarations, and clears 1 untyped other declaration and 5 partially typed other declarations. It increases the percentage of typed other declarations from 69.6% to 69.65% (+0.05%).

Untyped other declarations (+0-1)Cleared:
sig/datadog/version.rbs:13
└── STRING: untyped
Partially typed other declarations (+5-5)Introduced:
sig/datadog/core/configuration/option_definition.rbs:55
└── attr_reader type_options: Hash[Symbol, untyped]
sig/datadog/core/configuration/option_definition.rbs:77
└── @type_options: Hash[Symbol, untyped]
sig/datadog/di/probe.rbs:19
└── @template_segments: Array[untyped]?
sig/datadog/di/probe.rbs:50
└── attr_reader template_segments: Array[untyped]?
sig/datadog/tracing/metadata/tagging.rbs:6
└── ENSURE_AGENT_TAGS: ::Hash[untyped, bool]
Cleared:
sig/datadog/core/configuration/option_definition.rbs:43
└── attr_reader type_options: Hash[Symbol, untyped]
sig/datadog/core/configuration/option_definition.rbs:65
└── @type_options: Hash[Symbol, untyped]
sig/datadog/di/probe.rbs:19
└── @template_segments: Array[untyped]
sig/datadog/di/probe.rbs:50
└── attr_reader template_segments: Array[untyped]
sig/datadog/tracing/metadata/tagging.rbs:6
└── ENSURE_AGENT_TAGS: ::Hash[untyped, true]

If you believe a method or an attribute is rightfully untyped or partially typed, you can add # untyped:accept to the end of the line to remove it from the stats.

github-actions[bot] avatar Oct 31 '25 18:10 github-actions[bot]

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 89.19%
Overall Coverage: 95.23% (-0.00%)
View detailed report

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

datadog-official[bot] avatar Oct 31 '25 18:10 datadog-official[bot]

I think we should use the class C < Base; end syntax if we want type checking.

Type checking works with these classes, just not on the line where we define them.

vpellan avatar Dec 16 '25 10:12 vpellan

I see. In this case I suppose there is no issue.

p-datadog avatar Dec 16 '25 14:12 p-datadog