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-7728 Add Wild Card Syntax #15591

Merged
merged 6 commits into from
Nov 5, 2024
Merged

Conversation

saintentropy
Copy link
Contributor

@saintentropy saintentropy commented Nov 5, 2024

Purpose

This PR adds wildcard support for version compatibility calculation. Based on the current scheme explained here.

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

Release Notes

  • Asterisk(*) support
  • new WildCardParse method
  • test coverage

Reviewers

@zeusongit
@QilongTang

FYIs

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


if (splitVersion.Length == 2)
{
var newVersion = splitVersion[0] + ".1000.0";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe 1000 is not enough.... Could be more

Copy link
Collaborator

Choose a reason for hiding this comment

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

I pulled that value into a separate const so that we can change this later more easily. I don't know if this should be '1000' or '9999' though - here is a screenshot of a few packages with minor versions outside that range, for reference:
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

With that said, this is what we expect (from the current wiki, link in the description above) "For year based versions like in revit, civil3d etc:
Major version should be a 4 digit number (<= 9999)
Minor version should be at most a 2 digit number (<= 99)
Patch version should be at most a 2 digit number (<=99)
For dynamo versions:
Major/Minor/Patch versions should be at most a 2 digit number (<= 99)"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh we should probably bump this to a bit higher just to be really out of range. Maybe 99999?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zeusongit maybe we need to adjust the rules on versions

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to confirm here in writing and for posterity @saintentropy - the major/minor/patch maximum value for .Net is 2,147,483,647. The revision is 65,535.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are validating Revit/Civil and other hosts versions, not the package versions itself, so this does not apply.

- more tests added to cover edge cases
- added the new wildcard static method to the API
- extracted the '1000' max wildcard version value into a separate const variable to allow for ease of access later on (based on comment if value should be higher)
- added small utility method to append wildcard version
Copy link
Collaborator

@dnenov dnenov left a comment

Choose a reason for hiding this comment

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

@saintentropy you have done everything! I only added a few minor edge-case tests, and a couple more things like:

Assert.IsTrue(PackageManagerSearchElement.IsVersionCompatible(compatibility, compatibleVersion),
"Expected compatibility to be true when version is within the min and max wildcard range.");

Assert.IsFalse(PackageManagerSearchElement.IsVersionCompatible(compatibility, incompatibleVersion),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I added this test to also highlight the fact that, differentiating between the minor and build wildcard values covers the respective 'domain' of that wildcard. Meaning .. well, meaning the above case is currently valid, I just wanted to make this explicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be updated when we start updating compatibility from client, it is fine for now.

Copy link

github-actions bot commented Nov 5, 2024

UI Smoke Tests

Test: success. 11 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests

@saintentropy saintentropy changed the title WIP Quick try at wildcard DYN-7341 Quick try at wildcard Nov 5, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-7341

@QilongTang QilongTang added this to the 3.4 milestone Nov 5, 2024
@saintentropy saintentropy changed the title DYN-7341 Quick try at wildcard DYN-7341 Add Wild Card Syntax Nov 5, 2024
/// <summary>
/// The maximum version we check against when substituting a wildcard
/// </summary>
private const string WILDCARD_MAX_VERSION = "99999";
Copy link
Contributor

Choose a reason for hiding this comment

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

This is different for major and minor versions. Also for Dynamo versions, this is too large.
Is this part of the defensive coding? @saintentropy
This makes 2.9999 valid, but it will be rejected by the server

Copy link
Contributor Author

@saintentropy saintentropy Nov 5, 2024

Choose a reason for hiding this comment

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

The goal here is just to transform an asterisk into a Version object that obviously larger then the data in the system. This is only for the comparison syntax. The idea is we make a fake Max version that is just a really really big version vs coding the logic for actual infinity. We could actually push it to the theoretical max you pointed out -> 2,147,483,647 and then we would be good.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, I think we are just displaying//comparing the data at this point so not a problem.

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 did push it to the max.... Also had to fix the test. This way it's at the theoretical limit.

/// <summary>
/// The maximum version we check against when substituting a wildcard
/// </summary>
private const string WILDCARD_MAX_VERSION = "2147483647";
Copy link
Contributor

Choose a reason for hiding this comment

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

use int.MaxValue.ToString() instead?

@zeusongit zeusongit changed the title DYN-7341 Add Wild Card Syntax DYN-7728 Add Wild Card Syntax Nov 5, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-7728

@zeusongit zeusongit merged commit ccac495 into DynamoDS:master Nov 5, 2024
25 of 26 checks passed
zeusongit pushed a commit to zeusongit/Dynamo that referenced this pull request Nov 5, 2024
Co-authored-by: Deyan Nenov <dnenov@archilizer.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