fix: rank orphaned and moved pins first in triage

drift_score ignored orphaned pins and moved repositories although triage_state says they are fixed before any ref is read: pcem ranked last at 0 with an upstream_commit on no branch. Each now weighs more than a GONE ref.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:27:36 +01:00
1 parent a3c853316a
commit 651cabf412
2 files changed
+17

No files matched your search

+5
View File
@@ -2627,6 +2627,7 @@ def tree_diff(result: CompareResult, ref_dirs: set[str]) -> list[str]:
DRIFT_WEIGHTS = {"GONE": 40, "CHANGED": 30, "AMBIGUOUS": 15, "SHIFTED": 1}
PIN_WEIGHT = 50
def drift_score(
@@ -2644,6 +2645,10 @@ def drift_score(
if version is not None and not version.tag_matches_declared:
if version.latest_release and version.latest_release != version.declared:
score += 10
# A pin off its branch or a repository answering under another name is
# set again before any ref can be read, so each outranks a GONE ref:
# pcem ranked last at 0 with an orphaned upstream_commit.
score += PIN_WEIGHT * (len(report.orphaned) + len(report.moved_repos))
score += min(commits, 20) // 4
return score