Use the fully correct delegation pattern for the Process.spawn monkey patch#5791
Conversation
Typing analysisNote: Ignored files are excluded from the next sections.
|
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 0e7fd56 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65248d7d77
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
b6b5671 to
888f37d
Compare
|
Let's merge #5790 first to have a clearer history (and possibly rebase after) |
* Before this, all mock expectations would be ignored, since they are checked after the `after` hooks run, but the fork only ran the passed block and stopped before any `after` hook. * RSpec::Mocks.with_temporary_scope creates a separate scope so only child process mock expectations are checked there. RSpec::Mocks.with_temporary_scope does the same RSpec::Mocks.verify after calling the block.
* We cannot confuse the last Hash with the env Hash as there is always a command to run in between. * The check was somewhat brittle as it assumed specific types for the keys.
… patch
* RSpec mock expectations check this properly, example failures with incorrect delegation:
On 4.0 when delegating with just (*args)
expected: ({"DD_LINEAGE_PROBE" => "lineage-value-zzz"}, ["echo", "test"], {2 => 1, out: "/dev/null"}) (keyword arguments)
got: ({"DD_LINEAGE_PROBE" => "lineage-value-zzz"}, ["echo", "test"], {2 => 1, out: "/dev/null"}) (options hash)
On 2.7 when delegating with just (*args) and no ruby2_keywords:
expected: ({"DD_LINEAGE_PROBE"=>"lineage-value-zzz"}, ["echo", "test"], {2=>1, :out=>"/dev/null"})
got: ({"DD_LINEAGE_PROBE"=>"lineage-value-zzz"}, ["echo", "test"], {2=>1}, {:out=>"/dev/null"})
d117d8d to
0e7fd56
Compare
BenchmarksBenchmark execution time: 2026-05-21 09:53:07 Comparing candidate commit 0e7fd56 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
On top of #5790 because it needs that fix to test properly.
What does this PR do?
Use the fully correct delegation pattern for the Process.spawn monkey patch
Motivation:
Correctness even if someone else monkey patches Process.spawn and they expect to receive keyword arguments if the original caller passed some.
Change log entry
None
Additional Notes:
The good old way (no AI)
How to test the change?
Test added.