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

raise notification at startup if installed package targets a different host. #12990

Merged
merged 10 commits into from
Jun 15, 2022

Conversation

mjkkirschner
Copy link
Member

@mjkkirschner mjkkirschner commented Jun 9, 2022

Purpose

https://jira.autodesk.com/browse/DYN-4884
Follow up for the work @sm6srw started: https://jira.autodesk.com/browse/DYN-4880

PR does the following:

  • refactors host conflict check into package manager extension and out of package manager client view model.
  • updates some tests
  • At startup, raises notifications if the check fails for any packages that installed already. I went with notifications over message boxes to avoid irritating/overwhelming users because these notifications will show up at each startup.

Screen Shot 2022-06-09 at 6 01 17 PM
notification after install.
camber notification install
notification when adding package path.
camber notification add pack dialog

In addition to these cases, startup also generates a notification of course.

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

Release Notes

Add notifications at startup for packages that target a different host than current Dynamo context.

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

@mjkkirschner mjkkirschner changed the title raise notification at startup if installed package targets a different host. WIP raise notification at startup if installed package targets a different host. Jun 9, 2022
@mjkkirschner mjkkirschner changed the title WIP raise notification at startup if installed package targets a different host. raise notification at startup if installed package targets a different host. Jun 10, 2022
@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Jun 13, 2022

Last question, can we perform these checks for case (2) When a new package directory is added pointed out by Jorgen here https://jira.autodesk.com/browse/DYN-4884?

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Jun 13, 2022

Last question, can we perform these checks for case (2) When a new package directory is added pointed out by Jorgen here https://jira.autodesk.com/browse/DYN-4884?

yes, I think theres no reason we can't perform these same checks then, I would likely do it at late package load instead of directly tying it to path updates, so that PackageManagerViewExtension doesn't need to know about the preferences dialog, or package path updates - it just does these checks whenever a package is loaded, this has one consequences I can think of.

  1. we'll get some notifications added even if a user already got a message box telling them about the potential issue, I guess this isn't so bad, because now there will be a logged record of the package for us to find the dynamo log.

I'll give this a shot.

@mjkkirschner
Copy link
Member Author

@aparajit-pratap PTAL - implemented notifications when adding package paths.

@@ -3229,4 +3229,13 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="TrustLocationSkippedNotification" xml:space="preserve">
<value>No trusted location has been added.</value>
</data>
<data name="MessagePackageTargetOtherHosts2" xml:space="preserve">
<value>The package or one of its dependencies targets a different environment, such as Revit, Civil 3D, Advance Steel, Alias or FormIt. This can cause instability and unexpected problems.</value>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we be specific about which host specifically the package is targeting rather than saying it could be one of the many?

Copy link
Member Author

@mjkkirschner mjkkirschner Jun 14, 2022

Choose a reason for hiding this comment

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

That will require refactoring the functions which check what the targets are - I think it gets a bit complicated for two reasons.

  1. In some instances we are checking a package and all its dependencies - I guess it's unlikely they depend on different hosts. Probably a strange edge case.
  2. The current implementation just bails when it finds any issue, so we can return that first reason for failure I think fairly easily, but building up the complete list of different targets could possibly make the search quite slow in some cases (lots of dependencies) - and potentially confusing.

Is it okay to just return something like:

The package or one of its dependencies targets {X} which is different from the current Dynamo environment.This can cause instability and unexpected problems.

Or do we need to ensure the list is complete to include all targets which we reasoned were a failure?

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we have that information already? Isn't it how we are calculating stuff in CheckIfPackagesTargetOtherHosts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think I meant just the first host.

{
add
{
notificationLogged+=value;
Copy link
Contributor

Choose a reason for hiding this comment

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

formatting

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

@mjkkirschner thanks for responding to my questions. As far as the message is concerned about the non-matching host, feel free to disregard it if it's too difficult a refactor. It's a minor point as I thought it might be nice to have that additional info for the user as to what host their downloaded package is actually targeting.

@mjkkirschner
Copy link
Member Author

@aparajit-pratap @QilongTang given the timing, I will merge this, and cherry pick to 2.15 given this task is scoped for release in jira.

I can attempt to make improvements to the message in master.

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Jun 15, 2022

pass here:
https://master-5.jenkins.autodesk.com/job/Dynamo/job/DynamoSelfServe/job/pullRequestValidation/6375/

I ran it a few more times and sometimes it looks like another one of those issues with checking ContextMenuPopUp.IsOpen being flaky... it does not fail consistently, fairly certain we've seen this failure before.
I don't think it's related to these changes.

@mjkkirschner mjkkirschner merged commit f928a6f into DynamoDS:master Jun 15, 2022
@mjkkirschner mjkkirschner deleted the customnodefail branch June 15, 2022 17:23
mjkkirschner added a commit to mjkkirschner/Dynamo that referenced this pull request Jun 15, 2022
…t host. (DynamoDS#12990)

* add notifications for packages with other host at startup time
refactor where check is
fix existing tests

* fix and better notification

* add test

* fix tests

* comments

* Update PackageManagerExtension.cs

* Update PackageManagerViewExtensionTests.cs

* typo

* also check hosts at package load
add test
mjkkirschner added a commit that referenced this pull request Jun 15, 2022
…t host. (#12990) (#13010)

* add notifications for packages with other host at startup time
refactor where check is
fix existing tests

* fix and better notification

* add test

* fix tests

* comments

* Update PackageManagerExtension.cs

* Update PackageManagerViewExtensionTests.cs

* typo

* also check hosts at package load
add test
@mzjensen
Copy link

mzjensen commented Dec 1, 2022

Hi @mjkkirschner,

I noticed this new notification now that Dynamo Core 2.15 is shipped with the latest Civil 3D update (2023.1). It's convenient that you were doing your testing with my package as well! I find the message a little confusing because it says that my package targets a different host, which would be true if it was installed for Sandbox. But why does this message show in Dynamo for Civil 3D? Is it a bug, or do I need to change something in my pkg.json file? My ultimate goal is for this notification to not appear for Civil 3D users so they don't wonder if they did something wrong.

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Dec 1, 2022

Hi @mzjensen that sounds like a bug because it looks like your package already marks a host dependency on Civil3d. I will file a bug to investigate.

@mzjensen
Copy link

mzjensen commented Dec 1, 2022

@mjkkirschner - sounds good, thanks. FWIW, I also see the same message when installing the IronPython 2.7 package, which doesn't seem right.

@mjkkirschner
Copy link
Member Author

yes, I think if you were to debug you would see that Civil 3D is providing an unexpected host name...

@mjkkirschner
Copy link
Member Author

at the moment I'm not clear if this will work - but as a workaround you could try not setting the host dependencies to anything, and publishing locally to see if that works to avoid the notification.

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.

5 participants