Credibility pass: comments state constraints, not development history

A skeptical-cloner review flagged the patterns that read as AI-iteration
residue: test comments and section headers narrating the review process
that produced them, "legacy format" framing in a days-old repo, shadow
re-imports appended without reading file headers, one genuine machine
leftover (FIXTURE_CACHE = FIXTURE_CACHE), and a few register slips.
Every history-narrating comment is rewritten as the timeless invariant
it was guarding, test sections are grouped by behavior, function-local
imports are hoisted, and the README loses its one marketing clause and
heaviest dash runs. No behavior changes; 176 tests unchanged and green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Eric Wagoner
2026-08-02 15:08:22 -04:00
parent 92aaa91a49
commit 10f65d8aba
14 changed files with 93 additions and 141 deletions
+13 -22
View File
@@ -3,11 +3,19 @@ snapshots as parsing fixtures. No network anywhere."""
from __future__ import annotations
import shutil
from pathlib import Path
from bggpipe.config import Config
from bggpipe.diff import SNAPSHOT_FILES, compute_diff, load_snapshot_collection
from bggpipe.diff import (
SNAPSHOT_FILES,
compute_diff,
load_snapshot_collection,
run_diff,
)
from bggpipe.models import CollectionItem
from bggpipe.resolve import write_matches
from bggpipe.upload import run_upload
FIXTURES = Path(__file__).parent / "fixtures"
@@ -171,16 +179,15 @@ def test_unvetoed_bare_duplicate_stays_owned():
def test_earlier_disagreement_cannot_steal_a_later_rows_exact_match():
# round-3 ordering bug: row A (v3, no match) must not consume the v2
# copy that row B exactly matches — exact matches settle first
# row A (v3, no match) must not consume the v2 copy that row B exactly
# matches — exact-version claims settle before disagreements
rows = [
_match("Catan", "13", vstatus="version_auto", vid="3", vname="v3"),
_match("Catan", "13", vstatus="version_auto", vid="2", vname="v2"),
]
result = compute_diff(rows, [_item(13, 900, version_id=2)])
assert result.already_owned == ["Catan"] # B's exact match claims the copy
# A's v3 box exists on the shelf and matches no collection entry: a
# genuine new copy — NOT a spurious v2 duplicate, NOT a false disagreement
# A's v3 box matches no collection entry: a genuine new copy
assert [r["version_id"] for r in result.to_add] == ["3"]
assert result.disagreements == []
@@ -276,11 +283,6 @@ def test_versionless_copies_exhaust_then_second_copy_becomes_add():
def test_run_diff_outputs_feed_upload_unchanged(tmp_path, monkeypatch):
# the cross-stage contract: whatever run_diff writes, run_upload must
# read — a column rename on either side has to fail HERE
import shutil
from bggpipe.diff import run_diff
from bggpipe.resolve import write_matches
from bggpipe.upload import run_upload
monkeypatch.delenv("BGG_API_TOKEN", raising=False)
cfg = Config(data_dir=tmp_path)
@@ -307,10 +309,6 @@ def test_run_diff_outputs_feed_upload_unchanged(tmp_path, monkeypatch):
def test_token_without_username_says_so(tmp_path, monkeypatch, capsys):
import shutil
from bggpipe.diff import run_diff
from bggpipe.resolve import write_matches
monkeypatch.setenv("BGG_API_TOKEN", "tok")
monkeypatch.delenv("BGG_USERNAME", raising=False)
@@ -322,7 +320,7 @@ def test_token_without_username_says_so(tmp_path, monkeypatch, capsys):
run_diff(cfg)
out = capsys.readouterr().out
assert "BGG_API_TOKEN is set but BGG_USERNAME is not" in out
assert "No BGG_API_TOKEN" not in out # the old message was a lie here
assert "No BGG_API_TOKEN" not in out # the token IS set; blame the username
class _LiveClient:
@@ -346,9 +344,6 @@ def test_live_diff_fetches_fresh_collection(tmp_path, monkeypatch):
# the branch that runs the day the token arrives: must call
# collection_full with refresh=True, not serve resolve-era cache
from bggpipe.diff import run_diff
from bggpipe.resolve import write_matches
monkeypatch.setenv("BGG_API_TOKEN", "tok")
monkeypatch.setenv("BGG_USERNAME", "eric")
cfg = Config(bgg_username="eric", data_dir=tmp_path)
@@ -360,10 +355,6 @@ def test_live_diff_fetches_fresh_collection(tmp_path, monkeypatch):
def test_live_diff_falls_back_to_snapshots_on_auth_failure(tmp_path, monkeypatch):
import shutil
from bggpipe.diff import run_diff
from bggpipe.resolve import write_matches
monkeypatch.setenv("BGG_API_TOKEN", "bad")
monkeypatch.setenv("BGG_USERNAME", "eric")