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 -3
View File
@@ -486,9 +486,15 @@ def _history_cache(git, cache_dir: Path | None):
yield cached, handle
def ordinary_history(git, head: str, *, cache_dir: Path | None = None) -> list[dict]:
"""Read first-parent history, optionally reusing completed rows from this clone."""
raw = git.run("log", "--first-parent", "--format=%H%x00%P%x00%ct%x00%an%x00%B%x1e", head)
def ordinary_history(git, head: str, *, cache_dir: Path | None = None, limit: int | None = None) -> list[dict]:
"""Read first-parent history, optionally reusing completed rows from this clone.
``limit`` walks only the newest ``limit`` first-parent commits (a training freeze's cap; the held-out
benchmark passes none)."""
if limit is not None and (type(limit) is not int or limit < 1):
raise ValueError("history limit must be a positive integer")
count = () if limit is None else ("-n", str(limit))
raw = git.run("log", "--first-parent", *count, "--format=%H%x00%P%x00%ct%x00%an%x00%B%x1e", head)
rows = []
with _history_cache(git, cache_dir) as (cached, handle):
for entry in raw.split("\x1e"):