Skip to content

Add typing for Core::VariableHelpers and Core::Chunker#5443

Draft
marcotc wants to merge 1 commit intomasterfrom
marcotc/type-core-env-utils
Draft

Add typing for Core::VariableHelpers and Core::Chunker#5443
marcotc wants to merge 1 commit intomasterfrom
marcotc/type-core-env-utils

Conversation

@marcotc
Copy link
Copy Markdown
Member

@marcotc marcotc commented Mar 12, 2026

What does this PR do?
Types Core::Environment::VariableHelpers and Core::Chunker.

Motivation:
Replaces untyped parameters and return types with precise types derived from the method implementations.

Change log entry
None.

Additional Notes:

  • VariableHelpers#env_to_bool: var typed as String | Array[String] (the two documented forms), default as bool?, deprecation_warning: keyword arg added to the sig, return is bool?.
  • VariableHelpers#decode_array: private method that finds a matching env key; returns String?.
  • Chunker.chunk_by_size: list is Array[untyped] (elements need .size but no interface exists), max_chunk_size is Numeric, returns Enumerator[Array[untyped], untyped] (from slice_before).

How to test the change?

bundle exec steep check lib/datadog/core/environment/variable_helpers.rb lib/datadog/core/chunker.rb

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marcotc marcotc added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Mar 12, 2026
@github-actions
Copy link
Copy Markdown

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR introduces 1 partially typed method, and clears 1 untyped method.

Untyped methods (+0-1)Cleared:
sig/datadog/core/chunker.rbs:4
└── def self?.chunk_by_size: (untyped list, untyped max_chunk_size) -> untyped
Partially typed methods (+1-0)Introduced:
sig/datadog/core/chunker.rbs:4
└── def self?.chunk_by_size: (::Array[untyped] list, ::Numeric max_chunk_size) -> ::Enumerator[::Array[untyped], untyped]

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

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Mar 12, 2026

Benchmarks

Benchmark execution time: 2026-03-12 09:22:29

Comparing candidate commit 18faeb9 in PR branch marcotc/type-core-env-utils with baseline commit 6b340a0 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 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 ----------------------------------'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant