unseen: configurable pool size and slice count (--pool-size / --slices)

The draw hardcoded 300 repos / 3 slices. At the measured lazy-fetch rate
the full 300 projects ~2.5 days; a 100-repo single slice (slice 1, all
the G0 baseline needs) is ~20h. Add --pool-size (default 300) and
--slices (default 3), validated (>=1, slices<=pool_size, evenly
divisible). Generalize assign_slices' stratified allocation from a
literal 3 to `slices`, the run() break / insufficient check / report
(changes = pool_size*13) to pool_size, and record both in the journal
inputs. Remove bisect's three-slice assumption; freeze reads the size
from the draft. Defaults (300/3) reproduce prior output exactly.

With --pool-size 100 --slices 1 the pool is the first 100 accepted repos
in seed order, all in slice 1 (deterministic, byte-identical across
worker counts). 280 unseen tests pass, ruff clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Marius Ciepluch
2026-10-10 07:54:49 +02:00
co-authored by Claude Opus 4.8
parent f0bcbe08b5
commit 5ea28ca9f8
5 changed files with 170 additions and 29 deletions
+27
View File
@@ -195,3 +195,30 @@ def test_freeze_cli_redacts_failure_and_reports_only_record(tmp_path, capsys):
report.write_text(rows[0]["url"])
assert f.main(["--root", str(root), "--used-report", str(report)]) == 1
assert capsys.readouterr() == ('{"status": "freeze_refused"}\n', "")
@pytest.mark.parametrize("slices", [1, 4])
def test_hundred_repository_draft_bisects_and_freezes(tmp_path, slices):
root, draft, rows = draft_pair(tmp_path, count=100, slices=slices)
from test_unseen_bisect import staged
seen = []
def guard(root):
current = staged(root)
seen.append(len(current))
return 0
receipt = b.run(root, draft, guard_runner=guard)
assert receipt["input_count"] == 100 and receipt["dropped_count"] == 0
assert 100 in seen and staged(root) == rows
directory = root / "benchmarks/unseen"
(directory / "protocol-p1.md").write_bytes(Path("benchmarks/unseen/protocol-p1.md").read_bytes())
record = f.run(root, used_report=used())
public = tomllib.loads((directory / "pool-p1.toml").read_text())
private = tomllib.loads((directory / "private/pool-p1.toml").read_text())
assert len(public["repository"]) == 100 and len(private["repository"]) == 50
assert {row["slice"] for row in public["repository"]} == set(range(1, slices + 1))
assert record["freeze_digest"] == hashlib.sha256(d.canonical(public)).hexdigest()
assert sum(record["label_check_counts"].values()) == 100
assert f.run(root, used_report=used()) == record