Skip to content

Add typing for AppSec::Extensions and Gateway::Watcher#5442

Draft
marcotc wants to merge 1 commit intomasterfrom
marcotc/type-appsec-simple
Draft

Add typing for AppSec::Extensions and Gateway::Watcher#5442
marcotc wants to merge 1 commit intomasterfrom
marcotc/type-appsec-simple

Conversation

@marcotc
Copy link
Member

@marcotc marcotc commented Mar 12, 2026

What does this PR do?
Replaces -> untyped with -> void in two AppSec module methods whose return values are never used by callers.

Motivation:
void is semantically correct for methods that exist for side effects only, and communicates that callers should not depend on the return value.

Change log entry
None.

Additional Notes:

  • AppSec::Extensions.activate! calls extend for its side effect; return is unused.
  • Monitor::Gateway::Watcher.watch calls watch_user_id + watch_user_login, both already typed -> void.
  • rate_limiter.rb and compressed_json.rb unchanged: block returns and JSON.dump payload are genuinely untyped.

How to test the change?

bundle exec steep check lib/datadog/appsec/extensions.rb lib/datadog/appsec/monitor/gateway/watcher.rb

@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

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR clears 1 untyped method. It increases the percentage of typed methods from 61.16% to 61.21% (+0.05%).

Untyped methods (+0-1)Cleared:
sig/datadog/appsec/extensions.rbs:4
└── def self.activate!: () -> untyped

@datadog-prod-us1-3
Copy link

datadog-prod-us1-3 bot commented Mar 12, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 95.14% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 99362ae | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter
Copy link

pr-commenter bot commented Mar 12, 2026

Benchmarks

Benchmark execution time: 2026-03-12 09:18:36

Comparing candidate commit 99362ae in PR branch marcotc/type-appsec-simple 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 ----------------------------------'

Copy link
Member

@Strech Strech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcotc Thanks a lot for taking care. We have a ticket to restore typing and you can ignore AppSec types for now

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.

2 participants