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

DYN-3457: Dynamo should alert the user if there are conflicts loading packages from different locations #11554

Merged
merged 20 commits into from
Mar 25, 2021

Conversation

sm6srw
Copy link
Contributor

@sm6srw sm6srw commented Mar 18, 2021

Purpose

This pull request does:

  • Standard Library is now the first directory in the list.
  • ignore packages with invalid versions.
  • load the first version of a package found regardless of version.
  • throw a LibraryLoadFailedException for packages with invalid versions.
  • throw a `LibraryLoadFailedException' when a duplicated package is found
  • throw a `LibraryLoadFailedException' when a duplicated new package is found
  • throw a `LibraryLoadFailedException' when a duplicated old package is found

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

@sm6srw sm6srw added the WIP label Mar 18, 2021
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.

I think the intention of this task was to make Dynamo scan all package locations to see if there are going to be potential package conflicts before loading any single one. With these changes, it looks like Dynamo is going to continue loading them one by one, then when it encounters a package conflict with a second location, take appropriate action but by then it's too late - at least one package would already have been loaded.

@sm6srw
Copy link
Contributor Author

sm6srw commented Mar 22, 2021

I think the intention of this task was to make Dynamo scan all package locations to see if there are going to be potential package conflicts before loading any single one. With these changes, it looks like Dynamo is going to continue loading them one by one, then when it encounters a package conflict with a second location, take appropriate action but by then it's too late - at least one package would already have been loaded.

@aparajit-pratap The intention of this code is to always load the newest version of a package when there are version conflicts. The existing implementation is already doing a pre-scan of all packages but is only removing duplicated packages based on the package name. I extend that logic to also include the version. The actual loading happens later based on the cleaned up LocalPackages property. Lets talk at standup.

@aparajit-pratap
Copy link
Contributor

@aparajit-pratap The intention of this code is to always load the newest version of a package when there are version conflicts. The existing implementation is already doing a pre-scan of all packages but is only removing duplicated packages based on the package name. I extend that logic to also include the version. The actual loading happens later based on the cleaned up LocalPackages property. Lets talk at standup.

@sm6srw if that's the case, then it's good but I'd like to test your PR once to convince myself that it works especially with the std library.

@sm6srw
Copy link
Contributor Author

sm6srw commented Mar 22, 2021

@aparajit-pratap The intention of this code is to always load the newest version of a package when there are version conflicts. The existing implementation is already doing a pre-scan of all packages but is only removing duplicated packages based on the package name. I extend that logic to also include the version. The actual loading happens later based on the cleaned up LocalPackages property. Lets talk at standup.

@sm6srw if that's the case, then it's good but I'd like to test your PR once to convince myself that it works especially with the std library.

Sure! Go ahead.

@sm6srw sm6srw changed the title [WIP] DYN-3457: Dynamo should alert the user if there are conflicts loading packages from different locations DYN-3457: Dynamo should alert the user if there are conflicts loading packages from different locations Mar 23, 2021
@sm6srw sm6srw removed the WIP label Mar 23, 2021
@mjkkirschner
Copy link
Member

@sm6srw it doesn't look like on first glance that the tests you have added are testing the package conflicts? Am I missing it? Also does it make sense to add a failing test for the workflow when a new package dir is added?

@sm6srw
Copy link
Contributor Author

sm6srw commented Mar 23, 2021

@sm6srw it doesn't look like on first glance that the tests you have added are testing the package conflicts? Am I missing it? Also does it make sense to add a failing test for the workflow when a new package dir is added?

The last two tests are testing package conflicts (The involved packages have the same name but different versions, I am using the description field as a way to separate the packages in addition to the version number and that is probably what's confusing you. I will try to make that more obvious in the test). Yes, adding a couple of tests for covering adding/removing directories is a good idea.

src/DynamoPackages/PackageLoader.cs Outdated Show resolved Hide resolved
src/DynamoPackages/PackageLoader.cs Outdated Show resolved Hide resolved
src/DynamoPackages/PackageLoader.cs Outdated Show resolved Hide resolved
src/DynamoPackages/PackageLoader.cs Outdated Show resolved Hide resolved
@sm6srw
Copy link
Contributor Author

sm6srw commented Mar 24, 2021

Redesigned version where the first found package always wins but with enhanced notifications. PTAL!

@sm6srw sm6srw added the PTAL Please Take A Look 👀 label Mar 25, 2021
public string DefaultPackagesDirectory
{
get { return packagesDirectories[0]; }
get { return packagesDirectories[1]; }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to do something about this property but I think that should be part of @mjkkirschner's PR.

Copy link
Member

Choose a reason for hiding this comment

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

@sm6srw what were you thinking 😉 ?

throw new LibraryLoadFailedException(directory, String.Format(Properties.Resources.DulicatedPackage, discoveredPkg.Name, discoveredPkg.RootDirectory));

// Newer version found, show notification.
throw new LibraryLoadFailedException(directory, String.Format(Properties.Resources.DuplicatedNewerPackage,
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't understand this case. Are we rejecting the new version over here and keeping the old one? If so, why?

Copy link
Contributor Author

@sm6srw sm6srw Mar 25, 2021

Choose a reason for hiding this comment

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

Yes, this is the case where we keep the old one and reject the new one. This was the major change I made after the feedback yesterday. Instead of using the new version we just inform the user that we have found a newer version that we will ignore because we have already found another version of the package. That should give them enough information so they can decide what directory order they want.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about raising the existing mark for uninstall dialog here asking the user if they'd like to mark the existing package for uninstall and install the newer version upon restart or to simply ignore the new version?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or does that not make sense at this stage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should wait with that for now and add that as a separate task if we need it.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's okay, but just to clarify, I don't think this case is at startup, it's at the time you add a package path if I'm not wrong.

Copy link
Contributor Author

@sm6srw sm6srw Mar 25, 2021

Choose a reason for hiding this comment

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

It can happen at startup. Package X version 1.0.0 is installed in standard library. User download version 2.0.0. The user will get the message above every time they start after that as long as the standard library is first in the directory list. That is one of those cases when the user can't uninstall the old package because most of them will not have write access to the standard library. So lets see how this plays out and go from there.

Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt there's gonna be a case where we deliver a package in the std lib with a version that's older than that available on the PM, since that's the decision that we're making as a team, but I agree, it's not impossible. It could happen with host integrator packages, etc.

Copy link
Member

@mjkkirschner mjkkirschner Mar 25, 2021

Choose a reason for hiding this comment

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

I can imagine we might create a new version of meshtoolkit say for release to PM to get early feedback before incorporation of the new version into std.lib.

Copy link
Contributor

Choose a reason for hiding this comment

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

🙏

@sm6srw sm6srw merged commit 42eb7fa into DynamoDS:master Mar 25, 2021
@sm6srw sm6srw deleted the DYN-3457 branch March 25, 2021 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PTAL Please Take A Look 👀
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants