Skip to content

Commit c41defe

Browse files
jgravelleclaude
andcommitted
test: a fixture helper named _state was outranking the _State replay anchor
The retrieval-quality replay gate failed on 89f9042 with mrr 0.95: the new test module's _state() helper took top rank for the golden query '_State', pushing token_tracker._State to rank 2. Corpus pollution from a fixture name, not a ranking regression — the helper is now _tree_state_v181. Replay is back to 10/10 top-1 locally. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 89f9042 commit c41defe

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/test_v1_108_181.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_backslashes_are_normalised():
6868

6969
# --- the five states ---------------------------------------------------------
7070

71-
def _state(monkeypatch, dirty, *, scope=None, mtimes=None, root="/repo", freshness=None):
71+
def _tree_state_v181(monkeypatch, dirty, *, scope=None, mtimes=None, root="/repo", freshness=None):
7272
monkeypatch.setattr(
7373
subj, "_working_tree_reading", lambda r: ("fp", tuple(dirty)) if dirty is not None else None
7474
)
@@ -78,28 +78,28 @@ def _state(monkeypatch, dirty, *, scope=None, mtimes=None, root="/repo", freshne
7878

7979

8080
def test_a_subject_without_revision_control_is_not_applicable(monkeypatch):
81-
s = _state(monkeypatch, ["a.py"], freshness="not_tracked")
81+
s = _tree_state_v181(monkeypatch, ["a.py"], freshness="not_tracked")
8282
assert s == {"state": "not_applicable", "blocks": False}
8383

8484

8585
def test_an_unreadable_tree_is_unknown(monkeypatch):
86-
assert _state(monkeypatch, None)["state"] == "unknown"
86+
assert _tree_state_v181(monkeypatch, None)["state"] == "unknown"
8787

8888

8989
def test_nothing_uncommitted_is_clean(monkeypatch):
90-
s = _state(monkeypatch, [])
90+
s = _tree_state_v181(monkeypatch, [])
9191
assert s["state"] == "clean" and s["blocks"] is False
9292

9393

9494
def test_work_outside_the_scope_does_not_invalidate_a_narrow_proof(monkeypatch):
95-
s = _state(monkeypatch, ["docs/x.md"], scope="src/*.py")
95+
s = _tree_state_v181(monkeypatch, ["docs/x.md"], scope="src/*.py")
9696
assert s["state"] == "dirty_outside_scope"
9797
assert s["blocks"] is False
9898
assert s["files_dirty"] == 1
9999

100100

101101
def test_work_inside_the_scope_that_the_index_never_saw_blocks(monkeypatch):
102-
s = _state(monkeypatch, ["src/new.py"], scope="src/*.py", mtimes={})
102+
s = _tree_state_v181(monkeypatch, ["src/new.py"], scope="src/*.py", mtimes={})
103103
assert s["state"] == "dirty_in_scope"
104104
assert s["files_not_in_index"] == 1
105105
assert s["blocks"] is True
@@ -112,7 +112,7 @@ def test_an_edit_the_index_has_already_read_does_not_block(tmp_path, monkeypatch
112112
f = tmp_path / "mod.py"
113113
f.write_text("x")
114114
mtimes = {"mod.py": f.stat().st_mtime_ns + 1_000_000_000} # indexed after the edit
115-
s = _state(monkeypatch, ["mod.py"], mtimes=mtimes, root=tmp_path)
115+
s = _tree_state_v181(monkeypatch, ["mod.py"], mtimes=mtimes, root=tmp_path)
116116
assert s["state"] == "dirty_in_scope"
117117
assert s["files_not_in_index"] == 0
118118
assert s["blocks"] is False
@@ -123,13 +123,13 @@ def test_a_file_newer_on_disk_than_in_the_index_blocks(tmp_path, monkeypatch):
123123
f = tmp_path / "mod.py"
124124
f.write_text("x")
125125
mtimes = {"mod.py": f.stat().st_mtime_ns - 1_000_000_000} # indexed before the edit
126-
s = _state(monkeypatch, ["mod.py"], mtimes=mtimes, root=tmp_path)
126+
s = _tree_state_v181(monkeypatch, ["mod.py"], mtimes=mtimes, root=tmp_path)
127127
assert s["blocks"] is True
128128

129129

130130
def test_a_deletion_under_the_index_blocks(tmp_path, monkeypatch):
131131
mtimes = {"gone.py": 1}
132-
s = _state(monkeypatch, ["gone.py"], mtimes=mtimes, root=tmp_path)
132+
s = _tree_state_v181(monkeypatch, ["gone.py"], mtimes=mtimes, root=tmp_path)
133133
assert s["files_not_in_index"] == 1
134134

135135

0 commit comments

Comments
 (0)