Skip to content

Conversation

@jesusalvino
Copy link
Contributor

Purpose

Fixing the bug https://jira.autodesk.com/browse/DYN-6259 handling the creation/assignation of the Preferences in the Dynamic Model ctor bearing in mind the PathManager info.
A host doesn't need to pass any Preferences instance because it will be created in the Dynamo side considering the PathManager has the proper paths to do it.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Reviewers

@QilongTang
@reddyashish

@avidit avidit changed the title Fix Handling preferences bearing in mind the hosts DYN-6259 Fix Handling preferences bearing in mind the hosts Sep 20, 2023
{
PreferenceSettings preferences = null;
if (!config.StartInTestMode)
if (config.Preferences != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

in the D4R case, this will be false and we will go to the else block for loading the preferences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, at that point we already have a PathManager pointing to the proper paths so we will create the preferences from the expected file.

Copy link
Contributor

@reddyashish reddyashish Sep 21, 2023

Choose a reason for hiding this comment

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

Don't we want to do the same in the StartInTestMode also? What happens in test mode then?

Copy link
Contributor

Choose a reason for hiding this comment

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

For test mode, I think it depends on if Preferences was passed through start config? Can you confirm that from unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@reddyashish @QilongTang This is transparent for the TestMode. Yes, each test is responsible to pass its preferences or not.

Copy link
Member

@mjkkirschner mjkkirschner Sep 21, 2023

Choose a reason for hiding this comment

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

This seems like a foundational problem with this set of preference singleton changes - now the tests are not testing what users are experiencing and test authors ( at least me) have no idea how the different test fixtures are interacting with preferences.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we can just revert back to the previous code at https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCore/Models/DynamoModel.cs#L681 to simply be PreferenceSettings = (PreferenceSettings)CreateOrLoadPreferences(config.Preferences);

I guess to avoid confusion from @mjkkirschner , let's document what is is the difference before and after PreferenceSetting singleton change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like we can just revert back to the previous code at https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCore/Models/DynamoModel.cs#L681 to simply be PreferenceSettings = (PreferenceSettings)CreateOrLoadPreferences(config.Preferences);

I guess to avoid confusion from @mjkkirschner , let's document what is is the difference before and after PreferenceSetting singleton change

Done.

@QilongTang QilongTang added this to the 3.0 milestone Sep 20, 2023
@QilongTang QilongTang mentioned this pull request Sep 20, 2023
5 tasks
@mjkkirschner
Copy link
Member

How will you test this change?

@QilongTang
Copy link
Contributor

How will you test this change?

I think we can unit test this. Passing in preferences v.s. rely on path manager to load a settings file. I was going to propose adding a unit test after this PR.

@QilongTang QilongTang merged commit 8a39ec1 into DynamoDS:master Sep 22, 2023
QilongTang pushed a commit that referenced this pull request Sep 22, 2023
* Fix Handling preferences bearing in mind the hosts

* Creating the Preferences on demand

---------

Co-authored-by: Jesus Alfredo Alviño <jesus.alfredo.alvino@autodesk.com>
QilongTang added a commit that referenced this pull request Sep 22, 2023
…14431)

* Fix Handling preferences bearing in mind the hosts

* Creating the Preferences on demand

---------

Co-authored-by: jesusalvino <96534278+jesusalvino@users.noreply.github.com>
Co-authored-by: Jesus Alfredo Alviño <jesus.alfredo.alvino@autodesk.com>
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