From 6cc564085601da1c58a944ede6c4e97f6efafcb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 8 Oct 2026 17:03:21 -0400 Subject: [PATCH] Keep the ablation arms inside the line budget the repo enforces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit copy_store() moved into bench/scratch.py: systems.py had reached 512 lines and bench/filesize_check fails anything over 500. The move is behaviour identical, so the scale reports keep the commit stamp they were generated against — the code they describe is complete at that commit. --- bench/dense_scale.py | 3 ++- bench/leg_check.py | 3 ++- bench/scale_check.py | 3 ++- bench/scratch.py | 24 ++++++++++++++++++++++++ bench/systems.py | 16 +--------------- bench/term_sweep.py | 3 ++- 6 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 bench/scratch.py diff --git a/bench/dense_scale.py b/bench/dense_scale.py index e2a3f37..4b6ee59 100644 --- a/bench/dense_scale.py +++ b/bench/dense_scale.py @@ -21,7 +21,8 @@ import numpy as np from bench.query_set import load_queries, scale_probes from bench.report import git_commit from bench.run import latency -from bench.systems import DENSE_MODEL, MODELS, copy_store, machine_facts +from bench.scratch import copy_store +from bench.systems import DENSE_MODEL, MODELS, machine_facts if TYPE_CHECKING: from ely_eye.db import Database diff --git a/bench/leg_check.py b/bench/leg_check.py index 12a22d8..2d05bac 100644 --- a/bench/leg_check.py +++ b/bench/leg_check.py @@ -25,7 +25,8 @@ from bench.metrics import aggregate, score_query from bench.query_set import load_queries, scale_probes from bench.report import git_commit from bench.run import latency -from bench.systems import copy_store, machine_facts +from bench.scratch import copy_store +from bench.systems import machine_facts DEFAULT_HOME = Path("bench/runs/dense_scale") DEFAULT_SCRATCH = Path("bench/runs/leg_check") diff --git a/bench/scale_check.py b/bench/scale_check.py index 4bdb937..0e8e875 100644 --- a/bench/scale_check.py +++ b/bench/scale_check.py @@ -17,7 +17,8 @@ from typing import Any from bench.query_set import load_queries, scale_probes from bench.report import git_commit from bench.run import latency -from bench.systems import copy_store, machine_facts +from bench.scratch import copy_store +from bench.systems import machine_facts DEFAULT_HOME = Path("bench/runs/baseline") DEFAULT_SCRATCH = Path("bench/runs/scale") diff --git a/bench/scratch.py b/bench/scratch.py new file mode 100644 index 0000000..032b5b5 --- /dev/null +++ b/bench/scratch.py @@ -0,0 +1,24 @@ +"""Every harness measures a copy. The frozen baseline store is cited evidence, and the product +migrates whatever database it opens.""" + +from __future__ import annotations + +import shutil +import time +from pathlib import Path + + +def copy_store(home: Path, scratch: Path) -> tuple[Path, float]: + """Work on a copy: the baseline store is frozen evidence and must not be migrated in place.""" + source = home / "data" / "ely_eye.sqlite" + if not source.is_file(): + raise SystemExit( + f"{source}: no product database, build it with python -m bench.ingest_baseline" + ) + data = scratch / "data" + data.mkdir(parents=True, exist_ok=True) + began = time.perf_counter() + for suffix in ("", "-wal", "-shm"): + if (path := Path(str(source) + suffix)).is_file(): + shutil.copyfile(path, data / (source.name + suffix)) + return scratch, time.perf_counter() - began diff --git a/bench/systems.py b/bench/systems.py index 033d0d2..afc934d 100644 --- a/bench/systems.py +++ b/bench/systems.py @@ -13,7 +13,6 @@ import json import os import platform import re -import shutil import sqlite3 import time from collections.abc import Sequence @@ -24,6 +23,7 @@ from typing import TYPE_CHECKING, Any import numpy as np from bench.ingest_baseline import source_map +from bench.scratch import copy_store if TYPE_CHECKING: from ely_eye.db import Database @@ -446,20 +446,6 @@ def _corpus_ids(database: Database) -> dict[str, str]: return ids -def copy_store(home: Path, scratch: Path) -> tuple[Path, float]: - """Work on a copy: the baseline store is frozen evidence and must not be migrated in place.""" - source = home / "data" / "ely_eye.sqlite" - if not source.is_file(): - raise SystemExit(f"{source}: no product database, build it with python -m bench.ingest_baseline") - data = scratch / "data" - data.mkdir(parents=True, exist_ok=True) - began = time.perf_counter() - for suffix in ("", "-wal", "-shm"): - if (path := Path(str(source) + suffix)).is_file(): - shutil.copyfile(path, data / (source.name + suffix)) - return scratch, time.perf_counter() - began - - def live_product_rankings( db_home: Path, queries: Sequence[str], diff --git a/bench/term_sweep.py b/bench/term_sweep.py index 4c7b28a..0ae7cae 100644 --- a/bench/term_sweep.py +++ b/bench/term_sweep.py @@ -20,7 +20,8 @@ from bench.metrics import aggregate, score_query from bench.query_set import load_queries, scale_probes from bench.report import git_commit from bench.run import latency -from bench.systems import copy_store, live_product_rankings, machine_facts +from bench.scratch import copy_store +from bench.systems import live_product_rankings, machine_facts FRACTIONS = [0.20, 0.10, 0.05, 0.02, 0.01, 0.005] TOP_K = 10