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

DelegateParameters inherit their source's settable/gettable/snapshot_value/unit/label #6648

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

samantha-ho
Copy link
Contributor

This PR fixes a bug observed when chaining multiple DelegateParameters, and changing the source at the bottom of the chain.

In the previous implementation, a DelegateParameter only updated it's internal _settable and _gettable attributes when the source was changed. But it is possible to set up a chain of DelegateParameters and then change the 'root' source Parameter. This updates the bottom-most DelegateParameter, but all of the other DelegateParameters in the chain will not update.

This PR changes the implementation to override the ParameterBase implementation of the gettable and settable properties, so that they reflect the underlying source parameter, no matter what it may be.

@samantha-ho samantha-ho requested a review from a team as a code owner November 20, 2024 19:37
@samantha-ho
Copy link
Contributor Author

@jenshnielsen
One possible issue... there is a seemingly rarely used _SetParamContext manager in the ParameterBase module that directly sets the parameter._settable attribute. This implementation will not properly handle that case, as the internal _settable and _gettable attributes on a DelegateParameter do not get used.

Not sure if this is a big enough issue to rethink the implementation. What are your thoughts?

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.38%. Comparing base (39d04a1) to head (a0b565b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6648      +/-   ##
==========================================
+ Coverage   69.37%   69.38%   +0.01%     
==========================================
  Files         340      340              
  Lines       31293    31310      +17     
==========================================
+ Hits        21708    21725      +17     
  Misses       9585     9585              

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


🚨 Try these New Features:

@jenshnielsen jenshnielsen force-pushed the samanthaho/delegate_inherits_settable_gettable branch from b0a2781 to a1752ba Compare November 21, 2024 12:44
@jenshnielsen jenshnielsen changed the title DelegateParameters inherit their source's settable/gettable DelegateParameters inherit their source's settable/gettable/snapshot_value/unit/label Nov 21, 2024
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.

2 participants