fix(sre): queue null-created_at sort order
PRs with null created_at were sorting FIRST (empty string < any ISO date), jumping ahead of older PRs. Fix by using \xff sort key so null timestamps sort LAST. mc#1099 follow-up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
e791d2b6a1
commit
e4bdcf0b76
@ -185,7 +185,12 @@ def choose_next_queued_issue(
|
||||
if "pull_request" not in issue:
|
||||
continue
|
||||
candidates.append(issue)
|
||||
candidates.sort(key=lambda issue: (issue.get("created_at") or "", int(issue["number"])))
|
||||
# Sort ascending: oldest first. Null created_at sorts LAST (not first) by
|
||||
# using \xff as a sort key above any ISO timestamp. Prevents PRs with
|
||||
# missing timestamps from jumping the queue ahead of older PRs (mc#1099
|
||||
# follow-up: null created_at was sorting as "" which is < any real date).
|
||||
_MAX_KEY = "\xff" * 30
|
||||
candidates.sort(key=lambda issue: (issue.get("created_at") or _MAX_KEY, int(issue["number"])))
|
||||
return candidates[0] if candidates else None
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user