Re-audit round 3: 5 blind reviewers, 15 fixes, +18 tests — converging

Round 3's two HIGHs: _fill_version resolved versions with the LAST
same-title entry's cues (photo-aware lookup existed since round 1 but
this caller never used it), and the round-2 diff rework let an earlier
row's disagreement consume the exact-version copy a later row matched.
Diff claims now settle strongest-first across all rows (exact matches,
then versionless upgrades, then disagreement/second-copy), unvetoed
bare duplicates stay owned per spec, and updates are withheld with a
manual-fix note whenever any copy of the game already carries a version
(the row edit targets by name and could hit the wrong copy).

Also: entry-to-row pairing matches by photo overlap before position
(titles.json order churn from reshoot filenames could swap editions);
BGGQueueTimeout defers a title like a missing token; DismissStore
writes atomically, mutates memory only after the write, and
quarantines a torn file instead of bricking the server; version-picker
page-limit exhaustion stays retryable; verify's copy-count shortfall
reports once per game (the old guard was dead code); the upload log
header is created atomically; transient version-lookup failures record
a retryable version_error, not terminal version_unknown; extract
isolates per-photo failures and salvages JSON followed by prose; a
state revision counter stops stale poll responses reverting decisions;
plus the shared-predicate/fsio/docstring consolidation and CLI wiring,
live-diff, verify-wiring, and search-guard tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-02 14:55:04 -04:00
parent 65d4cdd5ec
commit 92aaa91a49
24 changed files with 719 additions and 187 deletions
+64
View File
@@ -0,0 +1,64 @@
"""CLI flag-wiring smoke tests: every option must reach its run_* kwarg.
The commands lazily import their stage modules, so each test monkeypatches
the stage function at its source module and asserts the received kwargs —
a transposed or dropped pass-through fails HERE, not on a real run.
"""
from __future__ import annotations
from typer.testing import CliRunner
from bggpipe.cli import app
runner = CliRunner()
def _capture(monkeypatch, module: str, func: str) -> dict:
received: dict = {}
def fake(cfg, **kwargs):
received.update(kwargs)
received["cfg"] = cfg
return []
monkeypatch.setattr(f"bggpipe.{module}.{func}", fake)
return received
def test_extract_flags(monkeypatch):
received = _capture(monkeypatch, "extract", "run_extract")
result = runner.invoke(app, ["extract", "--only", "x.jpg", "--force"])
assert result.exit_code == 0
assert received["only"] == "x.jpg" and received["force"] is True
def test_resolve_force(monkeypatch):
received = _capture(monkeypatch, "resolve", "run_resolve")
assert runner.invoke(app, ["resolve", "--force"]).exit_code == 0
assert received["force"] is True
def test_diff_wiring(monkeypatch):
received = _capture(monkeypatch, "diff", "run_diff")
assert runner.invoke(app, ["diff"]).exit_code == 0
assert "cfg" in received
def test_upload_flags(monkeypatch):
received = _capture(monkeypatch, "upload", "run_upload")
result = runner.invoke(
app, ["upload", "--dry-run", "--retry-failed", "--limit", "3", "--headless"]
)
assert result.exit_code == 0
assert received["dry_run"] is True
assert received["retry_failed"] is True
assert received["limit"] == 3
assert received["headless"] is True
assert received["verify"] is False
def test_enrich_refresh(monkeypatch):
received = _capture(monkeypatch, "enrich", "run_enrich")
assert runner.invoke(app, ["enrich", "--refresh"]).exit_code == 0
assert received["refresh"] is True