Answer stability round 1: refuse two more seats once the first two agree, compare scores as decimals, read only ASCII digits as item IDs, refuse a shallow clone's base search, and sort release candidates below their release; also holds product-owner round 1's fixes

This commit is contained in:
2026-10-09 01:32:19 +02:00
parent e2cb4a26f8
commit 56ac929634
7 changed files with 59 additions and 24 deletions
+7 -1
View File
@@ -65,6 +65,11 @@ def file_at(revision: str, path: str) -> str | Failure:
def history_changes(default: str) -> list[HistoryChange] | Failure:
"""Each merged change on the default branch that touched the history, newest first; a merge commit counts as one change against its first parent."""
shallow = git("rev-parse", "--is-shallow-repository")
if isinstance(shallow, Failure):
return shallow
if shallow.strip() == "true":
return Failure("a shallow clone lacks the commits the base search reads; run `git fetch --unshallow origin`")
commits = git("log", "--first-parent", "--format=%H", default, "--", HISTORY)
if isinstance(commits, Failure):
return commits
@@ -82,7 +87,8 @@ def history_changes(default: str) -> list[HistoryChange] | Failure:
def landed_since_release(default: str) -> bool | Failure:
"""Whether the default branch holds a commit after its newest `v*` tag, or any commit when it has none."""
tags = git("tag", "--list", "v*", "--merged", default, "--sort=-v:refname")
# Sorts v1.0.0-rc.1 below v1.0.0.
tags = git("-c", "versionsort.suffix=-", "tag", "--list", "v*", "--merged", default, "--sort=-v:refname")
if isinstance(tags, Failure):
return tags
newest = tags.split()[:1]