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

[EventGrid] Mappings for new ACS Events #14410

Merged
merged 4 commits into from
Mar 23, 2021
Merged

Conversation

ellismg
Copy link
Member

@ellismg ellismg commented Mar 22, 2021

Two things going on here, one simple, the other a little more complex:

  • Add a mapping for the ACS RecordingFileStatusUpdated event. This is a new event that was added after our code freeze for GA. In addition, the ACS team has added a new property to some existing events.

  • The ACS team discovered that the documentation for two of their events listed the wrong event type, and so our mappings were incorrect. I have added the new names to our list and mapped them to their corresponding shapes. I did not remove the older names, but added a @deprecated comment to them, pointing at the new names.

@xirzec @bterlson @ramya-rao-a The current status here is somewhat unfortunate. Code which was using the older names was never going to be correct (i.e. isSystemEvent("Microsoft.Communication.ChatParticipantRemovedFromThread", e) will never return true, because no events use that event type name. But you can legally write that code today, which is somewhere surprising, since we try to constrain the first parameter to a known system event type. I think we have two options:

  1. Add some code to isSystemEvent that would handle this case (i.e. treat isSystemEvent("Microsoft.Communication.ChatParticipantRemovedFromThread", e) as if you had written `isSystemEvent("ChatThreadParticipantRemoved") and do the same for the Added case. This would allow the code to behave as a user might expect.

  2. Remove Microsoft.Communication.ChatParticipantRemovedFromThread and Microsoft.Communication.ChatParticipantAddedToThread from our System Event Mappings. This would be a compile time breaking change for folks using TypeScript, but the break would point them at code which was logically incorrect, because the test they are doing will never return true.

My preference is (2), on the basis that we've only had this library released for a week or so and the fact that this never actually worked the way customers who wrote the code expected. But I wouldn't want to bump the major version, per semver. I am not sure if this very localized break for TS users is something where we believe a good note in the CHANGELOG.md about what we're doing (coupled with a bump to 4.1.0 instead of just 4.0.1) would be sufficient.

The Azure Communication Services team noticed that some of their event
shapes were wrong and have [updated the
swagger](Azure/azure-rest-api-specs#13485) to
address this.

This commit pulls these changes into our SDK.

Fixes Azure#14345
@ellismg
Copy link
Member Author

ellismg commented Mar 22, 2021

(coupled with a bump to 4.1.0 instead of just 4.0.1) would be sufficient.

Actually, after thinking about this more, I expect we are going to go to 4.1.0 even if we don't do a break, as we've added new members to the KnownSystemEvent enums and mapped a new event.

After discussion, we are comfortable removing these two event names
from our mapping. The rationale here is that the service never sent
events using these names (they made a typo when documenting the event
names in Swagger) and so any code using them was going to be wrong. In
this case, we like that if you're using TypeScript you'll see a
compile time issue here because it will be pointing to place in your
code where things were never going to behave as you might have
expected.

The `CHANGELOG.md` has been updated to provide a little more
perscriptive guidence on what to do here, and we feel OK about not
doing a major version bump.
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

Approved with a minor engsys-related comment.

@ellismg ellismg merged commit fa38e08 into Azure:master Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants