-
Notifications
You must be signed in to change notification settings - Fork 367
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
fix: add warning for unsupported keepAcl param in file#copy #841
fix: add warning for unsupported keepAcl param in file#copy #841
Conversation
src/file.ts
Outdated
@@ -984,6 +987,13 @@ class File extends ServiceObject<File> { | |||
options = optionsOrCallback; | |||
} | |||
|
|||
if (options.hasOwnProperty('keepAcl')) { | |||
// TODO: remove keepAcl from interface in next major. | |||
console.warn( |
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.
This is scary to me, because we've always considered our chance to communicate dev-only messages is pre-installation via the changelog, but not at runtime. That could potentially interrupt their users, since we are commonly a base layer in more complex applications.
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.
cc @bcoe @callmehiphop for thoughts!
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 might be misremembering, but I seem to recall using the console to warn users about deprecated methods in the auth client as well (paging @JustinBeckwith). I'm ok with this, but think we should take a hard stance of how we communicate this kind of change across the board.
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've been known to use this approach in yargs:
https://github.com/yargs/yargs/blob/5d7ad989a851398587a0349cdd15344769b4cd79/yargs.js#L1035
And haven't received many complaints; my general thinking has been.
- it's less disruptive to start by warning folks than throwing.
- it draws attention to a change that will eventually be breaking.
- Node itself has done this for a lot of features, e.g.,
Buffer
, so the community is accustomed to it.
In this case, my gut was that only a small percentage of folks would be explicitly setting keepAcl
so it's probably fairly low impact.
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 have opinions here!
https://github.com/googleapis/google-auth-library-nodejs/blob/master/src/messages.ts
A few thoughts:
- We should only emit these warnings once per process invocation
- Please use
process.emitWarning
instead ofconsole.warn
as it plays nicely with the cmd flags of nodejs. You can learn more here: https://medium.com/@jasnell/introducing-process-warnings-in-node-v6-3096700537ee - I like including error codes with these to make it easier for people to search for
As with all things, final say here is deferred to @bcoe
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.
Seems like the right move is to switch to process.emitWarning
👍 and let's land this.
For this specific case, I don't have a strong opinion about including an error code; seems smart in the case of an HTTP response or a file operation going off the rails, but not quite sure what a good option would be for this.
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.
Done, thanks
@JustinBeckwith could I trouble you to look over the switch to process.emitWarning
once per process (last commit).
Codecov Report
@@ Coverage Diff @@
## master #841 +/- ##
==========================================
+ Coverage 95.22% 95.25% +0.02%
==========================================
Files 11 11
Lines 1194 1201 +7
Branches 296 298 +2
==========================================
+ Hits 1137 1144 +7
Misses 29 29
Partials 28 28
Continue to review full report at Codecov.
|
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.
let's switch warn
to process.emitWarning
as-per @JustinBeckwith's suggestion.
LGTM - only ask is that we land this as a |
Related to #836
As per #839 (comment)