The retry badge stops offering jobs the human retired

Marking the D&D blue box "local" removed its job from the queue — but
the badge still counted its old failure and the checkbox still offered
to retry it, because the count read only upload_log.csv. A failure is
retryable only if the job is still queued AND still endorsed by
matches.csv; on Eric's data that's the difference between 2 and 1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016jXZFSTZQKzAC8fqpWSz9g
This commit is contained in:
Eric Wagoner
2026-08-05 23:06:40 -04:00
co-authored by Claude Fable 5
parent 99c1fbf02d
commit 74ecd5059b
5 changed files with 73 additions and 9 deletions
+30
View File
@@ -773,3 +773,33 @@ def test_stale_queue_jobs_are_skipped(tmp_path):
assert "no longer matched" in stale["999"]
# unverifiable (no matches.csv at all) never condemns a job
assert stale_jobs(queue, []) == {}
def test_failure_badge_ignores_jobs_the_human_retired():
"""A failed job whose review decision has since changed will never run
again — offering to retry it is a lie the badge kept telling."""
from bggpipe.upload import outstanding_failures
log = [
{
"action": "add",
"bgg_id": "13",
"collid": "",
"version_id": "",
"status": "failed",
},
{
"action": "add",
"bgg_id": "140509",
"collid": "",
"version_id": "",
"status": "failed",
},
]
queue = [{"bgg_id": "13"}, {"bgg_id": "140509"}]
matches = [
{"bgg_id": "13", "match_status": "auto"},
{"bgg_id": "", "match_status": "local"}, # 140509 was made local
]
assert outstanding_failures(log) == 2 # log-only view: both look pending
assert outstanding_failures(log, queue, matches) == 1 # only the live one