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

[core-amqp] Fixing typos #8956

Merged
merged 2 commits into from
May 21, 2020
Merged

[core-amqp] Fixing typos #8956

merged 2 commits into from
May 21, 2020

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented May 16, 2020

I know this PR is kind of obnoxious, but I thought I could help.

I was able to detect these by using Code Spell Checker on VSCode.

Copy link
Member

@richardpark-msft richardpark-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: Wait to merge until we hear back from the others on the wording changes for the log messages.

Thanks for doing this though, there were some pretty egregious ones there!

sdk/core/core-amqp/src/errors.ts Show resolved Hide resolved
@@ -144,7 +144,7 @@ export class CbsClient {
} catch (err) {
err = translate(err);
logger.warning(
"[%s] An error occured while establishing the cbs links: %O",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So here's a funny situation. If a customer sends us logs and we go and search for the message in our code we won't be able to find it anymore.

Might not be a big deal as long as we're aware that misspellings have been corrected :)

CC: @ramya-rao-a , @chradek , @HarshaNalluru

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was for @azure/amqp-common, then I would have the same concerns. This is because the number of existing customers using Track 1 EH & SB in production would be much larger than the ones for Track 2 at this point in time. Right now, this concerns customers who have EH Track 2 in production, and am ok to bite the bullet and get it done.

statusCode: string;
// (undocumented)
statusDescription: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richardpark-msft I wonder if this could break anything else.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this would be a breaking change. If we are doing this, then we will have to update the major version to 2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, the curse of having an "internal" library be externally available.

Everything else in this PR is goodness, let's just leave this change out for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know...I kind of see it as a bug fix. I think the fact that no one has reported that it's typo'd as satusDescription is some indicator that probably no one is using this field yet. If we really wanted, we could create an alias in JS so anyone using that field at runtime would still see it. Though having done something like that in the past people will wonder why they both show up...

Copy link
Member

@bterlson bterlson May 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fix this - it's not super clear that this is typo'd, I might just not even realize what it is.

There is a hybrid approach here - we can support both, but have the typings (and docs) only show latest. That way JS users don't need to do anything, and TS builds break but the fix is easy - it will offer a "did you mean" error since the string is only off-by-one, and the user could just cast to any without any code changes to make the error go away and things work... or even if they just ignore the error, the emitted code will continue to work also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what do you all think of this message? CbsResponse's property "satusDescription" is deprecated, use "statusDescription" instead.

Copy link
Member

@bterlson bterlson May 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If today you have:

let obj = {
  ...
  satusDescription: str
}

you would change it to

let obj = {
  ...
  statusDescription: str
}

Object.defineProperty(obj, 'satusDescription', {
  get() {
    logger.warning(`CbsResponse's property "satusDescription" has been renamed to "statusDescription". "satusDescription" will be removed in v2.0.0.`)
    return this.statusDescription;
  },
  enumerable: false
});

and make sure you add @deprecated to the field's type definition.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While taking this approach makes sense for when we want to deprecate properties, there is not much of a return on investment here. There most likely is no user scenario to even expose the statusCode and the statusDescription in this case.

For the scope of this PR, I would recommend not making any change to satusDescription. @richardpark-msft, I would recommend we log an issue to investigate the usefulness of the status code & description when getting back the response of a claim negotiation. I am sure that a deeper dive into core-amqp may bring other things we want to change in a v2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'm undoing that specific change then.

@bterlson Thank you for that though! I haven't used defineProperty in ages 😱 amazing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richardpark-msft Here's an issue! #9031 Good luck 🌞

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either revert the change from satusDescription to statusDescription or update the major version to 2.

I'll leave the decision to @chradek, @richardpark-msft and @HarshaNalluru

@sadasant sadasant merged commit ffd9346 into Azure:master May 21, 2020
@sadasant sadasant deleted the core-amqp/typos branch May 21, 2020 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants