Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@svonworl
Copy link
Contributor

@svonworl svonworl commented Mar 4, 2025

Description
This PR enhances the default version table sorting so that it takes into account the following additional factors:

  • name of version (one of "master", "main", "develop")
  • reference type (tag or not)
  • presence of metrics
  • validity

with the goal of ranking the more relevant versions higher.

While not directly described by the ticket, this PR sprang from some experiments with UI mods that would feature metrics more prominently.

The underlying mechanism scores each version, per an equation that:

  1. calculates a base score based on the version name and whether or not it is a tag.
  2. multiplies the base score by some weights that adjust the version's score by the inverse of age (based on last modification date), double the score if the version has metrics, and triple the score if it is valid.

We calculate the age relative to the beginning of tomorrow (the upcoming midnight), so that the version ordering does not constantly change.

Generally, this PR seems to improve the ordering. The mainstem branch(es) always appear near the top, and tags and versions with metrics tend to predominate in the first page of results. Recently-modified branches can appear at the top, but will fall in rank more quickly at they age, relative to tags. Most invalid branches without metrics are clustered at the end.

See the screenshots below.

gatk/mutect2
Before:
dump 2025-03-04 at 2 24 58 PM

After:
dump 2025-03-04 at 2 25 14 PM

Review Instructions
View the versions table and make sure that it:

  • looks sane
  • the default version appears at top
  • the most relevant versions tend towards the top.
  • that the ordering is consistent with what is described above.

Issue
https://ucsc-cgl.atlassian.net/browse/DOCK-2608
#6059

Security and Privacy

If there are any concerns that require extra attention from the security team, highlight them here and check the box when complete.

  • Security and Privacy assessed

e.g. Does this change...

  • Any user data we collect, or data location?
  • Access control, authentication or authorization?
  • Encryption features?

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that you pass the basic style checks and unit tests by running mvn clean install
  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.
  • Follow the existing JPA patterns for queries, using named parameters, to avoid SQL injection
  • If you are changing dependencies, check the Snyk status check or the dashboard to ensure you are not introducing new high/critical vulnerabilities
  • Assume that inputs to the API can be malicious, and sanitize and/or check for Denial of Service type values, e.g., massive sizes
  • Do not serve user-uploaded binary images through the Dockstore API
  • Ensure that endpoints that only allow privileged access enforce that with the @RolesAllowed annotation
  • Do not create cookies, although this may change in the future
  • If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.

@codecov
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.45%. Comparing base (03f8ca5) to head (59eac17).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #6081      +/-   ##
=============================================
+ Coverage      74.41%   74.45%   +0.03%     
  Complexity      5639     5639              
=============================================
  Files            386      386              
  Lines          20206    20231      +25     
  Branches        2088     2088              
=============================================
+ Hits           15037    15062      +25     
  Misses          4170     4170              
  Partials         999      999              
Flag Coverage Δ
bitbuckettests 26.13% <0.00%> (-0.04%) ⬇️
hoverflytests 27.72% <100.00%> (+0.08%) ⬆️
integrationtests 55.99% <100.00%> (+0.05%) ⬆️
languageparsingtests 10.85% <0.00%> (-0.02%) ⬇️
localstacktests 21.38% <100.00%> (+0.09%) ⬆️
toolintegrationtests 30.00% <100.00%> (+0.08%) ⬆️
unit-tests_and_non-confidential-tests 26.38% <0.00%> (-0.04%) ⬇️
workflowintegrationtests 37.66% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@svonworl svonworl changed the title Feature/dock 2608/add metrics info to version sorting DOCK-2608: Incorporate other signals into version sorting Mar 4, 2025
.when(cb.isTrue(valid), 3.)
.otherwise(1.);
Expression<Double> metricsWeight = cb.<Double>selectCase()
.when(cb.isNotEmpty(metricsByPlatform), 2.)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CriteriaBuilder.isNotEmpty accepts a Collection argument, which metricsByPlatform is not (it's a Map, which doesn't implement Collection), but somehow this works.

.when(cb.isNotEmpty(metricsByPlatform), 2.)
.otherwise(1.);

// Calculate a base "score", which ranks "mainstem" branches highest and tags higher.
Copy link
Member

Choose a reason for hiding this comment

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

mainstream typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"mainstem" was intended, see definition here: https://en.wikipedia.org/wiki/Main_stem
Open to some other adjective to denote important branches like "main", "master", "develop"...

Copy link
Member

Choose a reason for hiding this comment

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

Ok, haven't seen that before. Maybe "evergreen"?
Will ponder


// Calculate a base "score", which ranks "mainstem" branches highest and tags higher.
Expression<Double> baseScore = cb.<Double>selectCase()
.when(cb.equal(name, "master"), 20.)
Copy link
Member

Choose a reason for hiding this comment

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

could be ticket, we could also grab what they set as the default branch for their repo, it may be in our database already

@svonworl svonworl merged commit 9ca6e75 into develop Mar 11, 2025
20 checks passed
@svonworl svonworl deleted the feature/dock-2608/add-metrics-info-to-version-sorting branch March 11, 2025 04:12
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