bench(valid): a training freeze may cap the history walk at the newest N first-parent commits

ordinary_history(limit=) walks only the newest commits; assemble.freeze(history_limit=) and
--history-limit pass it through and the record carries it. The held-out benchmark passes none.
Reason: trigger.dev's 7,109-commit walk runs for hours at the per-commit cost of the function
and generated checks; the training freeze now walks its newest 1,500.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Marius Ciepluch
2026-10-13 20:47:23 +02:00
co-authored by Claude Fable 5.1
parent 6f9613329e
commit 1d1c87f63b
4 changed files with 28 additions and 5 deletions
+9
View File
@@ -670,3 +670,12 @@ def test_partial_clone_lazy_fetch_preserves_extraction_content(history, tmp_path
assert partial.files_read > 0 and partial.bytes_read > 0
assert json.dumps(result, sort_keys=True).encode() == json.dumps(baseline, sort_keys=True).encode()
assert sum("built-in: git fetch " in line for line in trace.read_text().splitlines()) >= 12
def test_history_limit_walks_only_the_newest_commits(history):
git, *_ = history
full = e.ordinary_history(git, "HEAD")
assert len(full) > 2
assert e.ordinary_history(git, "HEAD", limit=2) == full[:2] # the newest first-parent commits, same rows
with pytest.raises(ValueError, match="positive integer"):
e.ordinary_history(git, "HEAD", limit=0)
+1 -1
View File
@@ -448,7 +448,7 @@ def test_insufficient_negatives_and_invalid_ratio(pair, tmp_path, monkeypatch):
with pytest.raises(ValueError, match="ordinary_floor"): # Rejected is a ValueError with a fixed reason code
assemble.freeze(tmp_path / "default", **kwargs)
result = assemble.freeze(tmp_path / "train", floor=20, **kwargs)
assert result["ordinary_floor"] == 20 and result["negative_ratio"] == 20
assert result["ordinary_floor"] == 20 and result["negative_ratio"] == 20 and result["history_limit"] is None
# Twenty eligible commits for a ratio of twenty: every one of them is drawn, none twice.
ordinary = [c for c in replay.load_slice(tmp_path / "train/pool-valid.toml", 1) if c["kind"] == "ordinary"]
assert len(ordinary) == 20 and len({c["head"] for c in ordinary}) == 20