From 420162c79b78ae698f25d0d6cd9aea47bb07ff4b Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 08:37:36 +0100 Subject: [PATCH] fix: rank uncheckable profiles first in triage --strict fails on a profile no declared repository answers for, yet --triage scored it 0 under the clean profiles and left it out of the count to review. It now weighs as a pin to set again and is counted. --- scripts/profile_sync.py | 5 ++++- tests/test_profile_sync.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/profile_sync.py b/scripts/profile_sync.py index 9c4471dfd..5a90476ae 100644 --- a/scripts/profile_sync.py +++ b/scripts/profile_sync.py @@ -2665,6 +2665,9 @@ def drift_score( # 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)) + # A profile no repository answers for cannot be read at all, and + # --strict fails on it: it ranked at 0 under the clean profiles. + score += PIN_WEIGHT * report.uncheckable() score += min(commits, 20) // 4 return score @@ -5034,7 +5037,7 @@ def _print_triage( state = triage_state(report) if refused: state += f", {refused}" - pending += bool(report.needs_review()) + pending += bool(report.needs_review() or report.uncheckable()) print(f"{score:5d} {report.name:30s} {state}") print(f"{len(ranked)} profiles, {pending} with something to review") diff --git a/tests/test_profile_sync.py b/tests/test_profile_sync.py index 9a0fb5241..95879c00a 100644 --- a/tests/test_profile_sync.py +++ b/tests/test_profile_sync.py @@ -6027,6 +6027,25 @@ class TheTriageCountsWhatBlocksThePin(unittest.TestCase): self.assertEqual(lines[-1], "2 profiles, 1 with something to review") self.assertEqual(len(err.getvalue().splitlines()), 1, err.getvalue()) + def test_an_uncheckable_profile_ranks_first_and_counts(self): + """simple64 and teknoparrot answered 404 and --strict failed on them, + while the triage put them at 0 under the clean profiles.""" + gone = ProfileReport( + name="gone", pin="p", skipped="no declared repository answers (o/n)", + ) + reports = [self._report("clean", 1), gone] + selected = {r.name: {"source": "https://github.com/o/n"} for r in reports} + args = argparse.Namespace(cache_dir="unused", offline=True) + out = io.StringIO() + with mock.patch.object(profile_sync, "check_version", return_value=None), \ + mock.patch.object(profile_sync.upstream, "commits_touching", + return_value=0), \ + contextlib.redirect_stdout(out), contextlib.redirect_stderr(io.StringIO()): + profile_sync._print_triage(args, selected, reports) + lines = out.getvalue().splitlines() + self.assertIn("gone", lines[1]) + self.assertEqual(lines[-1], "2 profiles, 1 with something to review") + class TestBranchProfiles(unittest.TestCase): """--changed and --added name the profiles a branch brings, not by hand."""