Add typing for core utils, encoding, and AppSec::CompressedJson#5453
Add typing for core utils, encoding, and AppSec::CompressedJson#5453
Conversation
- OnlyOnce: initialize/ran?/reset_ran_once_state_for_tests -> void/bool/void - Sequence: initialize -> void, next -> ::Integer - TagNormalizer: normalize/normalize_process_value accept any (calls .to_s) - Encoding: encode/decode use any (intentionally open serialization), join uses ::Array[::String], add :: prefixes throughout - CompressedJson: dump accepts any (JSON-serializable payload) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
👋 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 19:45:53 UTC |
Typing analysisNote: Ignored files are excluded from the next sections. Untyped methodsThis PR clears 4 untyped methods and 4 partially typed methods. It increases the percentage of typed methods from 61.14% to 61.52% (+0.38%). Untyped methods (+0-4)✅ Cleared:Partially typed methods (+0-4)✅ Cleared: |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 536b793 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
BenchmarksBenchmark execution time: 2026-03-13 20:20:03 Comparing candidate commit 536b793 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
What does this PR do?
Types several small utility files:
OnlyOnce:initialize→void,ran?→bool,reset_ran_once_state_for_tests→voidSequence:initialize→void,next→::IntegerTagNormalizer:normalize/normalize_process_valueacceptany(method calls.to_son input, so intentionally open)Encoding:encode/decodeuseany(intentionally open serialization API);joinuses::Array[::String]; added::prefixes to all stdlib typesCompressedJson:dumpacceptsany(JSON-serializable payload)Also applies the project
anyvsuntypedconvention:anyfor intentionally open types,untypedfor undecided signatures.How to test the change?
bundle exec steep check \ lib/datadog/core/utils/only_once.rb \ lib/datadog/core/utils/sequence.rb \ lib/datadog/core/tag_normalizer.rb \ lib/datadog/core/encoding.rb \ lib/datadog/appsec/compressed_json.rbChangelog
None.