-
Notifications
You must be signed in to change notification settings - Fork 29.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: destructuring assignment instead of require whole module #22748
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Do we want to semver-major this? This no longer allows monkey-patched util._extend
to take effect when createSocket
is called, for example.
Yes, if this impacts the ability to monkey-patch, then it really should be semver-major and we should make sure we run CITGM. |
Last CI run was not successful for unrelated reasons (nodejs/build#1495). |
CITGM results are no longer available so I guess this needs another CITGM run... |
@Trott Ah...Is there something wrong ? I'm willing to fix it. |
Not necessarily. CI is green. CITGM is red, but it always is and requires a bit of care and/or domain knowledge to interpret. It might be totally fine. @nodejs/citgm |
If CITGM is good, then this is ready to land. @nodejs/citgm https://ci.nodejs.org/job/citgm-smoker/1631/ |
It needs a rebase @ZYSzys |
@antsmartian Done:) |
Post-rebase CI: https://ci.nodejs.org/job/node-test-pull-request/19758/ ✔️ |
@nodejs/tsc PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Is removing the ability to monkey-patch a desirable feature or an incidental side-effect? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d like a review from @nodejs/diagnostics. Is this used by APMs to instrument http?
|
We don't have the need to patch But please be aware that monkey patching is the only entry point for APMs this time as javascript has nothing like JVMTI. Therefore changes like this have the ability to break several APMs - with the risk that there are no workarounds available (marking it as semver-major doesn't add workarounds). Besides that I find |
TBH I find most (but not all) changes to destructuring problematic for exactly that reason. Not enough for me to block them, though. We don't know that this will break anyone's code but we can't be sure. Unless this is a definite improvement, I would be inclined to not do it for that reason. It's why I asked "Is removing the ability to monkey-patch a desirable feature or an incidental side-effect?" If a feature, great. If a side-effect, let's not do this. Aesthetic/cosmetic changes that might break someone's code seems like a bad trade-off. /ping @addaleax as I believe she has opinions on this type of thing. (And apologies if I'm wrong about that.) |
@Trott I don’t think I have much to add to what you were saying here. 👍 |
It’s probably a good idea to not do this change at all. |
Hey, everyone, thanks all of you for your reviews firstly. Learn a lot from the discussion, so if It’s not a suitable change, feel free to close this PR. Thank you sincerely again.👍 |
Minor refactor: Use
destructuring assignment
instead of require the whole module.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes