Skip to content
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

Merged

Conversation

AVaksman
Copy link
Contributor

@AVaksman AVaksman commented Sep 5, 2019

Related to #836

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

As per #839 (comment)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 5, 2019
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(
Copy link
Contributor

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.

Copy link
Contributor

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!

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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:

As with all things, final say here is deferred to @bcoe

Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link

codecov bot commented Sep 5, 2019

Codecov Report

Merging #841 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/file.ts 98.15% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27fa02f...ad6b919. Read the comment docs.

@AVaksman AVaksman added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 12, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 12, 2019
Copy link
Contributor

@bcoe bcoe left a 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.

@AVaksman AVaksman added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 17, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 17, 2019
@JustinBeckwith JustinBeckwith changed the title chore: add warning for unsupported keepAcl param in file#copy fix: add warning for unsupported keepAcl param in file#copy Sep 17, 2019
@JustinBeckwith
Copy link
Contributor

LGTM - only ask is that we land this as a fix since it has a material change to the behavior of the API

@JustinBeckwith JustinBeckwith merged commit 473bda0 into googleapis:master Sep 17, 2019
@AVaksman AVaksman deleted the add_warning_for_unsupported_param branch September 18, 2019 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants