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

Remove failure if version not present in the reported properties response #2162

Merged

Conversation

momuno
Copy link
Contributor

@momuno momuno commented Mar 28, 2022

Remove the failure if version is not present in the reported properties response.
It will be present from IoT Hub, but absent from IoT Edge.

Mollie Munoz added 2 commits March 28, 2022 13:34
…and only set version to EMPTY in that specific error case.
Copy link
Member

@CIPop CIPop left a comment

Choose a reason for hiding this comment

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

LGTM. Please add a UT to pin down this new behavior.

@CIPop
Copy link
Member

CIPop commented Mar 28, 2022

While not an API breaking change, this is a behavior breaking change: apps relying on finding a version if the parser passed will now find an AZ_SPAN_EMPTY instead. We already know that devices connecting to Edge will fail so I believe the risk is very small. @ahsonkhan @RickWinter FYI.

@momuno
Copy link
Contributor Author

momuno commented Mar 28, 2022

While not an API breaking change, this is a behavior breaking change: apps relying on finding a version if the parser passed will now find an AZ_SPAN_EMPTY instead. We already know that devices connecting to Edge will fail so I believe the risk is very small. @ahsonkhan @RickWinter FYI.

I agree Cris and was thinking about this as well. I would say app "could" now find an AZ_SPAN_EMPTY instead. This all works if the Hub does not stop sending version in the topic. But if they stop, it could break apps that are expecting version and are only checking for AZ_OK.

@momuno momuno requested a review from preethi826 as a code owner March 29, 2022 18:42
@momuno
Copy link
Contributor Author

momuno commented Mar 29, 2022

@CIPop @danewalton UT added.

@momuno momuno merged commit 28dfc63 into Azure:main Mar 29, 2022
@momuno momuno deleted the dev/update-version-check-reported-properties-response branch March 29, 2022 20:36
Comment on lines +177 to +186
result = az_iot_message_properties_find(
&props, az_iot_hub_twin_version_prop, &out_response->version);
if (result == AZ_ERROR_ITEM_NOT_FOUND)
{
out_response->version = AZ_SPAN_EMPTY;
}
else
{
_az_RETURN_IF_FAILED(result);
}
Copy link
Contributor

@ahsonkhan ahsonkhan Mar 29, 2022

Choose a reason for hiding this comment

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

Edit: I see now, if the received topic doesn't have a version "query parameter" then we still want to succeed. Gotcha.

Are we sure this is what we want? We are changing AZ_ERROR_ITEM_NOT_FOUND return value to AZ_OK on line 195 now.

Do we need to update the docs here:

* @return An #az_result value indicating the result of the operation.
* @retval #AZ_OK The topic is meant for this feature and the \p out_response was populated
* with relevant information.
* @retval #AZ_ERROR_IOT_TOPIC_NO_MATCH The topic does not match the expected format. This could
* be due to either a malformed topic OR the message which came in on this topic is not meant for
* this feature.
*/
AZ_NODISCARD az_result az_iot_hub_client_twin_parse_received_topic(

Copy link
Contributor

Choose a reason for hiding this comment

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

I am curious to know how did we discover this?

And if we would consider this a bug fix, that we want to highlight as something relevant to the end customer, then maybe add a changelog entry.

Copy link
Contributor Author

@momuno momuno Mar 30, 2022

Choose a reason for hiding this comment

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

We were notified via a colleague on Azure RTOS who had a customer issue. Through debugging, it was found that IoT Edge did not supply the $version in the reported properties response while IoT Hub did. This was confirmed by IoT Edge.

Can you please remind me where I create the changelog entry? Thanks!

I don't think the documentation needs to be updated. We do not currently specify what is considered a valid topic within that description, only that a topic which is valid will pass with out_response populated. This is still true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please remind me where I create the changelog entry? Thanks!

Here:
https://github.com/Azure/azure-sdk-for-c/blob/main/CHANGELOG.md#bugs-fixed

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.

4 participants