The Queue page reports what upload already did

All 36 version updates landed and all 36 still read as outstanding:
to_add.csv and to_update.csv are diff-time snapshots that never shrink,
and the page showed them without consulting the upload log. Rows now
carry their last attempt's outcome — pending / done / failed, plus
"retired" for jobs a later review decision withdrew — and each section
heads with a tally instead of a raw row count. A note explains that
finished rows persist until the next diff rebuilds the queue, and that
the log is the permanent record.

On Eric's data: to_update now reads 36 done, 0 pending.

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:23:50 -04:00
co-authored by Claude Fable 5
parent 0af9ae86c5
commit e44c7e1b92
6 changed files with 140 additions and 11 deletions
+22 -1
View File
@@ -266,10 +266,31 @@ def test_queue_endpoint_serves_all_three_ledgers(tmp_path):
cfg = _cfg(tmp_path)
(cfg.to_add_path).write_text("bgg_id,bgg_name\n13,Catan\n")
q = _app(cfg).get("/api/queue").json()
assert q["to_add"] == [{"bgg_id": "13", "bgg_name": "Catan"}]
assert q["to_add"][0]["bgg_name"] == "Catan"
assert q["to_add"][0]["state"] == "" # never attempted
assert q["to_update"] == [] and q["log"] == []
def test_queue_rows_report_what_upload_already_did(tmp_path):
"""to_add/to_update are diff-time snapshots: without the log, finished
work looks outstanding forever (all 36 updates still 'pending')."""
cfg = _cfg(tmp_path)
cfg.to_update_path.write_text(
"action,bgg_id,bgg_name,collid,version_id,version_name\n"
"update,240,Britannia,53429559,24621,AH second\n"
"update,71,Civilization,53429530,24006,AH first\n"
)
cfg.upload_log_path.write_text(
"action,bgg_id,collid,name,version_id,second_copy,status,timestamp,error\n"
"update,240,53429559,Britannia,24621,,updated,t,\n"
"update,71,53429530,Civilization,24006,,failed,t,boom\n"
)
q = _app(cfg).get("/api/queue").json()
by_name = {r["bgg_name"]: r for r in q["to_update"]}
assert by_name["Britannia"]["state"] == "done"
assert by_name["Civilization"]["state"] == "failed"
def test_library_serves_games_sorted_or_empty(tmp_path):
cfg = _cfg(tmp_path)