Count the peers actually tried, not the attempt counter

A job carried over from before the candidate ladder has attempts=0 while
carrying a real failure in `tried`, so the summary rendered as "tried 0 peers:
1x no bytes in 20m" -- a count of zero next to the evidence contradicting it.
The live instance produced exactly that when the stall check finally cleared
its long-stuck job.

Counts distinct usernames in `tried` instead. The two agree for anything this
version enqueued; the list is the one that is right in both cases.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Aryan SinghandClaude Opus 5 committed 2026-09-02 11:44:36 -05:00
1 parent 39b0e0bb33
commit c781193ec9
2 files changed
+17 -3

No files matched your search

+7
View File
@@ -195,6 +195,13 @@ def main() -> int:
check("only fails once the ladder is exhausted", r["state"] == "failed", r["detail"])
check("failure names every attempt, not just the last",
"tried 3 peers" in (r["detail"] or ""), r["detail"])
# A row carried over from before the ladder has attempts=0 but a real
# failure recorded, which must not render as "tried 0 peers: 1x ...".
check("a migrated row counts its evidence, not its counter",
app.exhausted_detail(
[{"username": "u1", "reason": "no bytes in 20m"}], 0)
== "tried 1 peer: 1x no bytes in 20m",
app.exhausted_detail([{"username": "u1", "reason": "no bytes in 20m"}], 0))
print("\nattempt cap")
fake2 = FakeSlskd(per_query={"Creep": [