@@ -439,7 +439,7 @@ def validate_lockfiles(args: argparse.Namespace) -> int:
439439 elif published_at > cutoff :
440440 hours_remaining = int ((published_at - cutoff ).total_seconds () / 3600 ) + 1
441441 group_id , artifact_id , version = gav .split (":" , 2 )
442- baseline_version = next (( c [ len ( f" { group_id } : { artifact_id } :" ):] for c in baseline_coords if c . startswith ( f" { group_id } : { artifact_id } :" )), None )
442+ baseline_version = highest_baseline_version ( baseline_coords , group_id , artifact_id )
443443 eligible = find_eligible_version (
444444 group_id = group_id , artifact_id = artifact_id ,
445445 too_new_version = version , baseline_version = baseline_version ,
@@ -678,6 +678,15 @@ def fetch_available_versions(group_id: str, artifact_id: str, repo_urls: list[st
678678 return []
679679
680680
681+ # select the highest baseline version of group:artifact present in a lockfile.
682+ def highest_baseline_version (baseline_coords : set [str ], group_id : str , artifact_id : str ) -> str | None :
683+ prefix = f"{ group_id } :{ artifact_id } :"
684+ versions = [coord [len (prefix ):] for coord in baseline_coords if coord .startswith (prefix )]
685+ if not versions :
686+ return None
687+ return max (versions , key = _version_sort_key )
688+
689+
681690# for a too-new coordinate, walk backward through available versions to find the newest one
682691# that meets the age cutoff and is newer than the baseline version
683692def find_eligible_version (
0 commit comments