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

Naive implementation of a backwards-compatible function_name decorator #202

Merged
merged 5 commits into from
Feb 6, 2024

Conversation

davidmrdavid
Copy link
Contributor

@davidmrdavid davidmrdavid commented Jan 12, 2024

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

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

❗ 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
@@           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 Coverage Δ
unittests 93.06% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidmrdavid davidmrdavid changed the title [WIP] naive first implementation of a backwards-compat layer for function_name Naive implementation of a backwards-compatible function_name decorator Jan 12, 2024
Comment on lines +493 to +495
class LegacyBluePrint(TriggerApi, BindingApi):
pass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

notice this doesn't inherit from SettingsApi :)

@YunchuWang
Copy link
Contributor

YunchuWang commented Jan 24, 2024

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

Copy link
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the fix. :)

@davidmrdavid
Copy link
Contributor Author

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

@gavin-aguiar gavin-aguiar merged commit eb279bf into dev Feb 6, 2024
11 checks passed
@gavin-aguiar gavin-aguiar deleted the dajusto/backwards-compat branch February 6, 2024 19:55
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.

None yet

5 participants