Azure / azure-functions-python-library

Azure Functions Python SDK
MIT License
147 stars 61 forks source link

Naive implementation of a backwards-compatible `function_name` decorator #202

Closed davidmrdavid closed 5 months ago

davidmrdavid commented 6 months ago

This PR (https://github.com/Azure/azure-functions-python-library/pulls?q=is%3Apr+is%3Aclosed+settingsapi) seems to have made a breaking change prevent DF BluePrints from using the function_name decorator in versions < 1.2.8 of azure-functions-durable.

This PR mitigates that breaking change by creating a backwards compatibility layer that allows anything that inherits from TriggerAPI to continue using function_name. I also keep the implementation of SettingsApi's function_name to be the same as this TriggerAPI backwards compat layer by unifying the implementations under a _function_name private method inherited from DecoratorAPI. The approach isn't perfect, but I think it's sufficiently clean given the circumstances.

I also added a test to validate this worked

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (4b6c9eb) 93.09% compared to head (c338f9a) 93.09%.

:exclamation: Current head c338f9a differs from pull request most recent head 39f3a57. Consider uploading reports for the commit 39f3a57 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #202 +/- ## ======================================= Coverage 93.09% 93.09% ======================================= Files 56 56 Lines 3243 3243 Branches 665 665 ======================================= Hits 3019 3019 Misses 137 137 Partials 87 87 ``` | [Flag](https://app.codecov.io/gh/Azure/azure-functions-python-library/pull/202/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/Azure/azure-functions-python-library/pull/202/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure) | `93.06% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Azure#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

YunchuWang commented 5 months ago

Hi David @davidmrdavid , wonder what error customer has seen from this breaking change? and is this starting to happen just recently?

davidmrdavid commented 5 months ago

@gavin-aguiar: I noticed the tests are failing, any ideas on what happened?