Skip to content

Add typing for AppSec::Response#to_rack, HashCoercion, and Forking#5456

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

Add typing for AppSec::Response#to_rack, HashCoercion, and Forking#5456
marcotc wants to merge 1 commit intomasterfrom
marcotc/type-appsec-core-small

Conversation

@marcotc
Copy link
Copy Markdown
Member

@marcotc marcotc commented Mar 13, 2026

What does this PR do?

  • AppSec::Response#to_rack: ::Array[untyped] → precise [::Integer, ::Hash[::String, ::String], ::Array[::String]] tuple matching the status/headers/body attribute types
  • AppSec::Utils::HashCoercion#coerce: parameter and hash types use any (accepts any Ruby object, returns any hash)
  • Core::Utils::Forking: included/extended accept ::Module and return void (standard included/extended hook pattern)

How to test the change?

bundle exec steep check \
  lib/datadog/appsec/response.rb \
  lib/datadog/appsec/utils/hash_coercion.rb \
  lib/datadog/core/utils/forking.rb

Changelog

None.

- Response#to_rack: Array[untyped] -> precise [Integer, Hash, Array] tuple
- HashCoercion#coerce: parameters and hash types use any (intentionally open)
- Forking: included/extended use ::Module parameter and void return

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 13, 2026
@github-actions
Copy link
Copy Markdown

👋 Hey @marcotc, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2026-03-13 20:32:20 UTC

@github-actions
Copy link
Copy Markdown

Typing analysis

Note: Ignored files are excluded from the next sections.

Untyped methods

This PR clears 2 partially typed methods. It increases the percentage of typed methods from 61.19% to 61.29% (+0.1%).

Partially typed methods (+0-2)Cleared:
sig/datadog/appsec/response.rbs:12
└── def to_rack: () -> ::Array[untyped]
sig/datadog/appsec/utils/hash_coercion.rbs:5
└── def self.coerce: (untyped) -> ::Hash[untyped, untyped]?

@datadog-official
Copy link
Copy Markdown

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 95.16% (+0.01%)

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

marcotc added a commit that referenced this pull request Mar 13, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Strech
Copy link
Copy Markdown
Member

Strech commented Mar 16, 2026

@marcotc advice learned by failure - you have to run steep with all project files, otherwise changes might break contracts that will be not verified on few files run.

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