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:
+8
-12
@@ -305,12 +305,10 @@ def test_wrong_year_hint_never_drives_a_version(client):
|
||||
def test_run_resolve_saves_progress_when_token_missing(tmp_path):
|
||||
"""Cached titles resolve; uncached ones wait for the token instead of
|
||||
crashing the run and losing everything."""
|
||||
import shutil as _shutil
|
||||
|
||||
partial_cache = tmp_path / "cache"
|
||||
partial_cache.mkdir()
|
||||
for f in FIXTURES.glob("search_query=Catan-*"):
|
||||
_shutil.copy(f, partial_cache / f.name)
|
||||
shutil.copy(f, partial_cache / f.name)
|
||||
|
||||
data_dir = tmp_path / "data"
|
||||
data_dir.mkdir()
|
||||
@@ -478,16 +476,14 @@ def test_run_resolve_dedupes_and_keeps_all_rows(tmp_path):
|
||||
client = BGGClient(cache_dir=cache, transport=httpx.MockTransport(_no_network))
|
||||
|
||||
run_resolve(cfg, client=client)
|
||||
from bggpipe.resolve import read_matches as _rm
|
||||
|
||||
saved = {r["title_raw"]: r for r in _rm(cfg.matches_path)}
|
||||
saved = {r["title_raw"]: r for r in read_matches(cfg.matches_path)}
|
||||
assert len(saved) == 2 # no row disappeared
|
||||
assert saved["Wingspan"]["match_status"] == "auto"
|
||||
assert saved["WINGSPAN!"]["match_status"] == "merged"
|
||||
assert saved["WINGSPAN!"]["merged_into"] == "Wingspan"
|
||||
|
||||
|
||||
# -- audit-fix regressions ----------------------------------------------
|
||||
# -- re-run and --force behavior ----------------------------------------
|
||||
|
||||
|
||||
def test_run_resolve_force_rebuilds_from_scratch(client, tmp_path):
|
||||
@@ -595,8 +591,6 @@ def test_empty_normalized_title_never_matches(client):
|
||||
def test_blocked_same_title_entry_defers_the_whole_group(tmp_path):
|
||||
# entry1 of a two-edition title is blocked (no token); entry2 must NOT
|
||||
# resolve, or its row would occupy entry1's pairing slot next run
|
||||
import httpx as _httpx
|
||||
|
||||
data_dir = tmp_path / "data"
|
||||
data_dir.mkdir()
|
||||
(data_dir / "titles.json").write_text(
|
||||
@@ -618,8 +612,8 @@ def test_blocked_same_title_entry_defers_the_whole_group(tmp_path):
|
||||
cfg = Config(data_dir=data_dir)
|
||||
blocked_client = BGGClient(
|
||||
cache_dir=tmp_path / "empty_cache",
|
||||
transport=_httpx.MockTransport(
|
||||
lambda req: _httpx.Response(401, text="Unauthorized")
|
||||
transport=httpx.MockTransport(
|
||||
lambda req: httpx.Response(401, text="Unauthorized")
|
||||
),
|
||||
sleep=lambda s: None,
|
||||
)
|
||||
@@ -630,7 +624,9 @@ def test_blocked_same_title_entry_defers_the_whole_group(tmp_path):
|
||||
def test_truncation_separator_chosen_by_position():
|
||||
heads = _truncation_heads("Blorvath: Quest of the Zzyzx - 2nd Edition")
|
||||
assert heads[0] == "Blorvath"
|
||||
assert "Blorvath: Quest" not in heads # the comment's guarantee, now true
|
||||
assert (
|
||||
"Blorvath: Quest" not in heads
|
||||
) # two-word fallback uses the pre-subtitle head
|
||||
|
||||
|
||||
def test_reordered_titles_json_cannot_mispair_editions(client, tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user