diff --git a/CHANGELOG.md b/CHANGELOG.md index 6384c20ae..0f413ba7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ ### Changed +- Import the four-port AB/BA loop with `from inferrsi.harness.manager import run_experiment`. + The former `inferrsi.harness.runner` module was removed. The `inferrsi run` CLI and + `inferrsi.apps.legacy.run.run_experiment` continue to supply the four port bindings. + - Apps module retirement (0.3.4). Use the [documented replacements](docs/apps-module-migrations.json). The public evaluation API remains at `inferrsi.apps.api`. See the [migration instructions](docs/guides/module-layout.md#apps-modules-and-retired-imports) for diff --git a/docs/architecture.md b/docs/architecture.md index f98d7dea2..874d77254 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -298,7 +298,7 @@ synthetic contract fixtures, not accelerator measurements. `apps.legacy.run.run_experiment(spec, environment, *, execute, snapshot)` composes the old run and accepts small callable adapters. It passes them, the Benchmark v0 -gates and the report to `harness.runner.run_experiment`, whose four ports +gates and the report to `harness.manager.run_experiment`, whose four ports (`execute`, `snapshot`, `assess`, `report`) have no defaults. An omitted `execute` or `snapshot` is read from `apps.legacy.run` when the run starts (`execute_trial` and `repository_identity`), which is the two-argument call diff --git a/docs/assets/modular-directory-map-en.svg b/docs/assets/modular-directory-map-en.svg index 4d4113b8d..c406246a7 100644 --- a/docs/assets/modular-directory-map-en.svg +++ b/docs/assets/modular-directory-map-en.svg @@ -26,7 +26,7 @@ harness/ - runner.py + manager/ AB/BA trials local_process.py Deadlines and cleanup diff --git a/docs/contracts/function-owners.md b/docs/contracts/function-owners.md index f21630d39..5963d7157 100644 --- a/docs/contracts/function-owners.md +++ b/docs/contracts/function-owners.md @@ -12,7 +12,7 @@ Status: **Proposed baseline**; individually **adopted** entries are identified b | `skill_eval_diagnostic` task definition/`validate_task`/`expected`/`verify` | B task/pure criteria; `main` as a B-defined worker entry | worker started by H; prepare/assess do not execute `main` | | `skill_eval_engineering` task/vectors/`validate_task` | B task-owned definition and pure vector judgment | `verify` must be split from process start; offline assess does not re-measure through an execution port | | same file `materialize_generated_artifact`/`read_regular`/`input_hashes`/`SandboxUnavailable`/`RUNNER`/`sandbox_command`/`_invoke` | H input capture/sandbox execution capability | real capability/control domain tested in the later H02 PR; B consumes fixed output only | -| `harness/runner` execution/termination/directory/state events | H execution and facts; AB/BA/repetitions → B protocol/worker; `write_report` → Apps | old run unchanged; migrating old `evaluate` decouples the runner first; new H scoring cannot be retained by attaching a `legacy` label | +| `harness.manager.run_experiment` execution/termination/directory/state events | H execution and facts; AB/BA/repetitions → B protocol/worker; `write_report` → Apps | old run unchanged; migrating old `evaluate` decouples the runner first; new H scoring cannot be retained by attaching a `legacy` label | | `harness/improvement` `usage_totals`/`assessment`/`holdout_accepts`/`rerun_assessment` | B experiment validity/comparison/acceptance rules; budget admission/reservation/charging reconciliation remains H | read normalized facts only; provider parsing does not move because of import convenience | | same file `choose` | H search progression; `SelectionPolicy` split into B threshold rules and H progression/stop policy | no shared business `Policy` class; Apps does not create a retry loop | | `harness/knowledge_capture` `assemble_context_text`/`_item` | K pure knowledge text projection | Apps connects K/H; Apps gives H the fixed expected text/hash; H stores the actually delivered text/hash; `verify_capture` byte integrity belongs to H and does not call K assembly in reverse; it is not a task-benefit verdict | @@ -23,7 +23,7 @@ Status: **Proposed baseline**; individually **adopted** entries are identified b | `harness/records/profile_timeline` `attach_profile`, `_compile` (builds the bounded dashboard overview stored with the record), fixed-byte verification, and digest reads (`read_profiles`/`profile_event_table`) (added with the OBS dissolve; **adopted owner: H records; RSI-master architecture decision 2026-11-14 Asia/Shanghai, recorded in the [D008 wave-2 ownership decision](d008-wave2-ownership-decision.md#profile-records-and-overview); independent PR review remains separate**) | H records: attach a reviewed profile, compile the stored overview from those bytes, and verify stored bytes | Record, overview-compile and byte-integrity paths stay in H because the overview is record content: it is computed once at attach from a bounded trace and published content-addressed, so the stored bytes cannot depend on who renders them. Its top-lane, longest-event and top-kernel selection reduces one trace for a bounded record; it ranks no candidate, run or claim and produces no verdict. UI route decoration, including `events_url`, belongs to Apps views, not H. Issue #413's broad timeline-to-Apps placement is refined here: persisted factual records and bounded overview encoding stay in H; UI projections and route decoration belong to Apps. The route decoration is removed from H in this PR, preserving stored bytes, digest verification and the external view response. | | `apps/views/profile_searches` `pre_profile_searches` (added with the OBS dissolve; **adopted owner: Apps views; RSI-master architecture decision 2026-11-14 Asia/Shanghai, recorded in the [D008 wave-2 ownership decision](d008-wave2-ownership-decision.md#pre-profile-searches); independent PR review remains separate**) | Apps views: Dashboard-consumed presentation list relating a profile capture to named searches completed before it | It joins an H record with ledger read models, which only Apps may assemble. Its `verified`/`not_before`/`unknown_time` values are display annotations over an existing search state; they are not evidence for a claim, and using them that way needs a new owner decision. | | `benchmark/sampling` `collect_samples` (moved out of `harness/scenarios/media` by the old-run split; **ownership disposition: B sampling; RSI-master [adopted decision, 2026-11-14 Asia/Shanghai](d008-wave2-ownership-decision.md#benchmark-sampling); independent PR review remains separate**) | B sampling: seed ordering, timing records and artifact hashes | Request transport stays with the caller's injected `request(item, path)` callback; Benchmark hashes artifacts with its own `_sha256`, pinned to `apps.artifacts.sha256` by `tests/apps/test_legacy_run_split.py::test_sampling_sha256_matches_the_apps_hasher` (the Infra hasher and its test name were retired by #498), and imports no H or Apps module. The per-group progress line on stdout is the old `run` protocol output kept for D022 and is a protocol constraint, not a presentation owner. | -| `harness/runner` `snapshot` port `(repo, exclude) -> dict` (separated from the runner by the old-run split; **ownership disposition: H port contract, Apps legacy binding, `apps/host/targets` implementation (moved from `infra/targets` by #498); RSI-master [adopted decision, 2026-11-14 Asia/Shanghai](d008-wave2-ownership-decision.md#snapshot-port); independent PR review remains separate**) | H owns the port and its contract; the Apps legacy composition owns the binding; `apps/host/targets` owns the Git identity implementation | H keeps the port required and keyword-only with no default and holds no copy of the implementation. `apps/legacy/run.py` binds `snapshot=repository_identity` for the old run; the root `execution.py` forwarder was deleted by #412 R1, and the CLI imports `apps/legacy/` itself. A change of the binding owner needs its own review. Out-of-tree callers that used the removed H defaults are not covered by this row. | +| `harness.manager.run_experiment` `snapshot` port `(repo, exclude) -> dict` (separated from the runner by the old-run split; **ownership disposition: H port contract, Apps legacy binding, `apps/host/targets` implementation (moved from `infra/targets` by #498); RSI-master [adopted decision, 2026-11-14 Asia/Shanghai](d008-wave2-ownership-decision.md#snapshot-port); independent PR review remains separate**) | H owns the port and its contract; the Apps legacy composition owns the binding; `apps/host/targets` owns the Git identity implementation | H keeps the port required and keyword-only with no default and holds no copy of the implementation. `apps/legacy/run.py` binds `snapshot=repository_identity` for the old run; the root `execution.py` forwarder was deleted by #412 R1, and the CLI imports `apps/legacy/` itself. A change of the binding owner needs its own review. Out-of-tree callers that used the removed H defaults are not covered by this row. | D008 rows are architecture decisions under the delegation recorded at the top of this file. An independent reviewer verifies the cited code, tests and dependency direction and may block on a missing adoption record; a reviewer does not choose the owner, and a PR approval is not the D008 adoption record. The architecture owner records adoption in the governed contract or decision record; the rows cite that decision record, independently of PR approval. diff --git a/docs/guides/module-layout.md b/docs/guides/module-layout.md index 4d54a42bd..f33f319fc 100644 --- a/docs/guides/module-layout.md +++ b/docs/guides/module-layout.md @@ -339,8 +339,9 @@ The leaf's own import rule and `REPO_TYPES` object identity govern it. `inferrsi.harness.run_store`, and `inferrsi.harness.errors`. Each registered entry must appear in the import graph and satisfy its dependency rules. The closure rule above applies to every Harness module. The gate rejects - imports of the ten former root-level search modules and any file that - restores one of those paths. + imports of the former root-level runner and ten search modules, and any + file that restores one of those paths. Import the four-port AB/BA loop with + `from inferrsi.harness.manager import run_experiment`. - **No residual.** The skill-evaluation split (#410) moved `export_bundle` to Apps and removed the registered `harness.skill_evaluation` → root `knowledge_operations` edge together with its exemption. Every harness diff --git a/src/inferrsi/apps/legacy/run.py b/src/inferrsi/apps/legacy/run.py index f4e2a5bc9..1134b5778 100644 --- a/src/inferrsi/apps/legacy/run.py +++ b/src/inferrsi/apps/legacy/run.py @@ -9,7 +9,7 @@ from inferrsi.benchmark.legacy_run_v0 import evaluate as _evaluate from inferrsi.benchmark.legacy_run_v0 import read_metric, trial_metric from inferrsi.contracts import RunSpec -from inferrsi.harness.runner import run_experiment as _run_experiment +from inferrsi.harness.manager import run_experiment as _run_experiment from inferrsi.harness.trials.external import execute_trial as _execute_trial from .evaluation import run_rules diff --git a/src/inferrsi/harness/README.md b/src/inferrsi/harness/README.md index 04d85417f..f301a732d 100644 --- a/src/inferrsi/harness/README.md +++ b/src/inferrsi/harness/README.md @@ -11,10 +11,6 @@ measurement and assessment rules. - [`run_store.py`](run_store.py) provides `RunStore` and `RunStoreReader` for namespaced records and content-addressed artifacts. Pass `record_version` to read a fixed record and use `open(ref)` to read retained artifact bytes. -- [`runner.py`](runner.py) owns the common AB/BA loop. It calls injected - `execute`, `snapshot`, `assess`, and `report` ports and records the returned - assessment. [`trials/external.py`](trials/external.py) runs and retains a - single command trial with the supplied metric reader. - [`optimization_session.py`](optimization_session.py) connects session commands to the budget and recovery logic in [`optimization.py`](optimization.py). [`task_protocol.py`](task_protocol.py) prepares task protocol packages and runs @@ -22,8 +18,13 @@ measurement and assessment rules. - [`skill_evaluation.py`](skill_evaluation.py) executes and retains skill-evaluation trials. [`artifact_sandbox.py`](artifact_sandbox.py) captures and replays submitted artifacts. -- [Manager](manager/__init__.py) exposes `EngineSearchPlan`, `run_engine_search` - and `read_engine_search`. It checks the budget before starting a search. +- [Manager](manager/__init__.py) exposes the common AB/BA loop as + `from inferrsi.harness.manager import run_experiment`. Apps supplies the + `execute`, `snapshot`, `assess` and `report` ports. Manager records the + returned assessment. [External trials](trials/external.py) run and retain + each command with the supplied metric reader. +- Manager also exposes `EngineSearchPlan`, `run_engine_search` and + `read_engine_search`. It checks the budget before starting a search. Its [improvement loop](manager/search/improvement.py) uses injected assessments. [VATS](manager/search/vats.py) selects edits and verification jobs. The [search campaign](manager/search/search_campaign.py) coordinates GVO updates diff --git a/src/inferrsi/harness/manager/__init__.py b/src/inferrsi/harness/manager/__init__.py index 3a77f0ba0..7ac17ee52 100644 --- a/src/inferrsi/harness/manager/__init__.py +++ b/src/inferrsi/harness/manager/__init__.py @@ -1,5 +1,6 @@ -"""Manage Harness session progression and search budgets.""" +"""Manage Harness experiments, session progression and search budgets.""" +from ._runner import run_experiment from .search._engine import EngineSearchPlan, read_engine_search, run_engine_search -__all__ = ["EngineSearchPlan", "read_engine_search", "run_engine_search"] +__all__ = ["EngineSearchPlan", "read_engine_search", "run_engine_search", "run_experiment"] diff --git a/src/inferrsi/harness/runner.py b/src/inferrsi/harness/manager/_runner.py similarity index 98% rename from src/inferrsi/harness/runner.py rename to src/inferrsi/harness/manager/_runner.py index d4f9de576..35a458f34 100644 --- a/src/inferrsi/harness/runner.py +++ b/src/inferrsi/harness/manager/_runner.py @@ -8,10 +8,10 @@ from datetime import datetime, timezone from pathlib import Path -from ..contracts import RunSpec -from ..contracts.runspec import revision_matches -from .atomic_json import atomic_write_json as _write_json -from .trials.external import collect_trial_checks +from ...contracts import RunSpec +from ...contracts.runspec import revision_matches +from ..atomic_json import atomic_write_json as _write_json +from ..trials.external import collect_trial_checks def run_experiment( diff --git a/src/inferrsi/harness/parallel_round.py b/src/inferrsi/harness/parallel_round.py index d699a76f8..ee2077802 100644 --- a/src/inferrsi/harness/parallel_round.py +++ b/src/inferrsi/harness/parallel_round.py @@ -72,6 +72,7 @@ confined_execute, ) from inferrsi.harness.device_lease import DeviceLease, LeaseError +from inferrsi.harness.manager import run_experiment as run_experiment_loop from inferrsi.harness.round_budget import ( Binding, BudgetError, @@ -85,7 +86,6 @@ ensure_open, seconds_remaining, ) -from inferrsi.harness.runner import run_experiment as run_experiment_loop _TERMINAL = frozenset({"measured", "rejected", "unsettled", "failed"}) diff --git a/src/inferrsi/harness/trials/__init__.py b/src/inferrsi/harness/trials/__init__.py index f724ec65a..e21c01b11 100644 --- a/src/inferrsi/harness/trials/__init__.py +++ b/src/inferrsi/harness/trials/__init__.py @@ -1,4 +1,4 @@ """External command trials and their retained checks, independent of model and device. -Experiment scheduling stays in harness.runner. +Harness Manager schedules experiments. """ diff --git a/tests/apps/test_legacy_run_split.py b/tests/apps/test_legacy_run_split.py index 10eb4c63f..06ed34fba 100644 --- a/tests/apps/test_legacy_run_split.py +++ b/tests/apps/test_legacy_run_split.py @@ -20,7 +20,7 @@ from inferrsi.apps.storage import artifacts from inferrsi.benchmark import legacy_run_v0, metrics, sampling from inferrsi.contracts import RunSpec, claim -from inferrsi.harness.runner import run_experiment +from inferrsi.harness.manager import run_experiment from inferrsi.harness.trials.external import execute_trial from tests.repository._gate_policy_support import ROOT, _scan, _walk @@ -38,17 +38,18 @@ def _reached(module: str) -> set[str]: def test_moved_harness_modules_are_gone_without_shells(): - for name in ("evaluation", "reporting", "scenarios.media"): + for name in ("evaluation", "reporting", "runner", "scenarios.media"): assert f"inferrsi.harness.{name}" not in GRAPH.trees + assert importlib.util.find_spec("inferrsi.harness.runner") is None def test_runner_and_external_lost_their_model_artifact_and_target_edges(): - assert _outside("inferrsi.harness.runner", "inferrsi.model", "inferrsi.infra") == set() + assert _outside("inferrsi.harness.manager._runner", "inferrsi.model", "inferrsi.infra") == set() assert _outside("inferrsi.harness.trials.external", "inferrsi.model") == set() assert _outside("inferrsi.harness.trials.external", "inferrsi.infra") <= PROCESS_DOMAIN assert _outside("inferrsi.harness.atomic_json", "inferrsi.") == {"inferrsi.harness"} # Transitively the old chain keeps only the process domain, and no new core. - for module in ("inferrsi.harness.runner", "inferrsi.harness.trials.external"): + for module in ("inferrsi.harness.manager._runner", "inferrsi.harness.trials.external"): reached = _reached(module) assert {n for n in reached if n.startswith(("inferrsi.model", "inferrsi.infra"))} <= ( PROCESS_DOMAIN diff --git a/tests/contracts/test_contracts_package.py b/tests/contracts/test_contracts_package.py index 6b66632b4..fd7e4c720 100644 --- a/tests/contracts/test_contracts_package.py +++ b/tests/contracts/test_contracts_package.py @@ -10,6 +10,7 @@ import dataclasses import importlib import importlib.util +import inspect import json import os import pickle @@ -25,7 +26,7 @@ from inferrsi.apps.legacy import evaluation as legacy_evaluation from inferrsi.apps.legacy import run as legacy_run from inferrsi.contracts import RunSpec, claim, json_v1, runspec -from inferrsi.harness import runner +from inferrsi.harness.manager import run_experiment SRC = Path(__file__).resolve().parents[2] / "src" ROOT = SRC / "inferrsi" @@ -125,8 +126,9 @@ def test_initializer_reexports_only_runspec_and_there_is_one_class() -> None: assert contracts.RunSpec is runspec.RunSpec is RunSpec assert (RunSpec.__module__, RunSpec.__qualname__) == ("inferrsi.contracts.runspec", "RunSpec") # Every consumer in the tree holds that same class object. - for consumer in (arguments, legacy_evaluation, legacy_run, runner): + for consumer in (arguments, legacy_evaluation, legacy_run): assert consumer.RunSpec is RunSpec, consumer.__name__ + assert inspect.signature(run_experiment).parameters["spec"].annotation is RunSpec def test_harness_reexports_the_same_verdict_objects() -> None: diff --git a/tests/repository/_gate_policy_support.py b/tests/repository/_gate_policy_support.py index f3837a44a..da1afa6be 100644 --- a/tests/repository/_gate_policy_support.py +++ b/tests/repository/_gate_policy_support.py @@ -102,11 +102,12 @@ # so the two package names are retired as a whole. # #558 moved ``inferrsi.harness.scenarios`` to ``inferrsi.harness.trials``, with no # forwarder, so the old package name is retired as a whole too. -# #702 moved the ten root-level search modules under the Manager. +# #702 moved the root-level runner and ten search modules under the Manager. RETIRED_MODULES = frozenset({ "inferrsi.infra", "inferrsi.model", "inferrsi.harness.scenarios", + "inferrsi.harness.runner", "inferrsi.harness.gvo", "inferrsi.harness.improvement", "inferrsi.harness.search_adapter", diff --git a/tests/repository/check_installed.py b/tests/repository/check_installed.py index 0ac6842ba..9f8d832e3 100644 --- a/tests/repository/check_installed.py +++ b/tests/repository/check_installed.py @@ -932,6 +932,38 @@ def assert_not_importable(name): raise AssertionError(f"retired module {name} must not import") +def check_installed_abba_runner(): + from inferrsi.apps.legacy.run import execute_trial + from inferrsi.harness.manager import run_experiment + + command = ( + sys.executable, "-c", + "import sys; from pathlib import Path; Path(sys.argv[1]).write_text(sys.argv[2])", + "{result}", '{"metrics":{"latency_ms":1}}', + ) + reported = [] + + def assess(baseline, candidate, validation, integrity, error): + assert [trial["metric"] for trial in baseline] == [1] + assert [trial["metric"] for trial in candidate] == [1] + assert validation is None and integrity["verified"] and error is None + return {"verdict": "INCONCLUSIVE"} + + with tempfile.TemporaryDirectory(prefix="inferrsi-installed-abba-") as cwd: + spec = RunSpec(repo=cwd, baseline_command=command, candidate_command=command, + repetitions=1, output_dir=str(Path(cwd) / "runs"), max_minutes=1) + run_dir = run_experiment( + spec, {}, execute=execute_trial, + snapshot=lambda *_: {"available": True, "snapshot_hash": "fixed"}, + assess=assess, report=reported.append, + ) + assert reported == [run_dir] + assert json.loads((run_dir / "evaluation.json").read_bytes()) == {"verdict": "INCONCLUSIVE"} + + +assert_not_importable("inferrsi.harness.runner") +check_installed_abba_runner() + # #498 slice 1: the metric contract and the quality validators ship only under # inferrsi.benchmark. The old inferrsi.model paths are not in the wheel and have no alias. # Slice 2 removed the emptied inferrsi.model.protocols package, so it stands for diff --git a/tests/repository/test_architecture_closed_loop.py b/tests/repository/test_architecture_closed_loop.py index 5ff387dd1..e07b9e0be 100644 --- a/tests/repository/test_architecture_closed_loop.py +++ b/tests/repository/test_architecture_closed_loop.py @@ -30,6 +30,8 @@ "inferrsi.cli", "inferrsi.arguments", "inferrsi.harness.runner", + "inferrsi.harness.manager._runner", + "inferrsi.harness.manager.run_experiment", "inferrsi.apps", "inferrsi.knowledge", "inferrsi.benchmark", @@ -483,6 +485,10 @@ def test_seam_guard_keeps_the_cli_parser_runner_and_benchmark_bans(self) -> None ("import inferrsi.arguments as options\n", "inferrsi.arguments"), ("from inferrsi import arguments\n", "inferrsi.arguments"), ("from inferrsi.harness.runner import run_experiment\n", "inferrsi.harness.runner"), + ("from inferrsi.harness.manager import run_experiment\n", + "inferrsi.harness.manager.run_experiment"), + ("import inferrsi.harness.manager._runner as loop\n", + "inferrsi.harness.manager._runner"), ("import inferrsi.harness.runner as loop\n", "inferrsi.harness.runner"), ("from inferrsi.harness import runner\n", "inferrsi.harness.runner"), ("from inferrsi.benchmark.legacy_run_v0 import evaluate\n", @@ -513,8 +519,8 @@ def test_real_assembler_fails_the_same_guard_once_a_coupling_is_added(self) -> N "inferrsi.knowledge.catalog"), (text + "\nfrom inferrsi.cli import main\n", "inferrsi.cli"), (text + "\nfrom inferrsi.arguments import parser\n", "inferrsi.arguments"), - (text + "\nfrom inferrsi.harness.runner import run_experiment\n", - "inferrsi.harness.runner"), + (text + "\nfrom inferrsi.harness.manager import run_experiment\n", + "inferrsi.harness.manager.run_experiment"), (text + "\nfrom inferrsi.benchmark.legacy_run_v0 import evaluate\n", "inferrsi.benchmark.legacy_run_v0"), ) diff --git a/tests/repository/test_first_wave_isolation_policy.py b/tests/repository/test_first_wave_isolation_policy.py index a1f826fe5..f1c019a42 100644 --- a/tests/repository/test_first_wave_isolation_policy.py +++ b/tests/repository/test_first_wave_isolation_policy.py @@ -420,7 +420,7 @@ def test_another_importer_fails(self) -> None: line = "from inferrsi.resources.repository_packs import repository_pack\n" paths = ( "infra/other.py", "infra/inspection_helpers.py", "infra/__init__.py", - "infra/platforms/__init__.py", "harness/api.py", "harness/runner.py", + "infra/platforms/__init__.py", "harness/api.py", "harness/parallel_round.py", "benchmark/probe.py", "apps/main.py", "apps/inspection.py", "apps/host/prepared_environment.py", "model/probe.py", "cli.py", "arguments.py", "apps/cli/__init__.py", "apps/cli/arguments.py", @@ -1006,16 +1006,16 @@ def test_non_entry_harness_module_cannot_reach_an_old_leaf(self) -> None: cases = ( ( "from ..knowledge_operations import KnowledgeReader\n", - "inferrsi.harness.runner reaches inferrsi.knowledge_operations", + "inferrsi.harness.parallel_round reaches inferrsi.knowledge_operations", ), ( "from inferrsi.catalog import search_knowledge\n", - "inferrsi.harness.runner reaches inferrsi.catalog", + "inferrsi.harness.parallel_round reaches inferrsi.catalog", ), ) for source, expected in cases: with self.subTest(expected=expected): - report = _report({"harness/runner.py": source}) + report = _report({"harness/parallel_round.py": source}) self.assertTrue(_violated(report, expected), report.violations) def test_former_residual_edge_fails_for_its_importer_and_dependents(self) -> None: @@ -1072,7 +1072,7 @@ def test_submodule_import_traverses_parent_package_init(self) -> None: def test_transitive_path_through_root_helpers_fails(self) -> None: report = _report( { - "harness/runner.py": "from inferrsi import helper_a\n", + "harness/parallel_round.py": "from inferrsi import helper_a\n", "helper_a.py": "from inferrsi import helper_b\n", "helper_b.py": ( "from inferrsi.knowledge_operations import KnowledgeReader\n" @@ -1080,8 +1080,8 @@ def test_transitive_path_through_root_helpers_fails(self) -> None: } ) self.assertIn( - "inferrsi.harness.runner reaches inferrsi.knowledge_operations: " - "inferrsi.harness.runner -> inferrsi.helper_a -> inferrsi.helper_b" + "inferrsi.harness.parallel_round reaches inferrsi.knowledge_operations: " + "inferrsi.harness.parallel_round -> inferrsi.helper_a -> inferrsi.helper_b" " -> inferrsi.knowledge_operations", report.violations, ) @@ -1100,12 +1100,12 @@ def test_old_leaf_detection_is_not_sort_dependent(self) -> None: **direct, "knowledge_operations.py": _shell("inferrsi.knowledge_operations"), f"{name}.py": "from . import knowledge_operations\n", - "harness/runner.py": ( + "harness/parallel_round.py": ( f"from . import skill_evaluation\nfrom .. import {name}\n" ), } ) - for module in ("runner", "skill_evaluation"): + for module in ("parallel_round", "skill_evaluation"): self.assertTrue( _violated( report, @@ -1150,11 +1150,11 @@ def test_non_entry_own_parent_init_is_walked(self) -> None: "from ..knowledge_operations import KnowledgeReader\n" ), "harness/__init__.py": "from . import skill_evaluation\n", - "harness/runner.py": "VALUE = 1\n", + "harness/parallel_round.py": "VALUE = 1\n", "harness/api.py": "VALUE = 1\n", } ) - for module in ("runner", "api"): + for module in ("parallel_round", "api"): self.assertIn( f"inferrsi.harness.{module} reaches inferrsi.knowledge_operations: " f"inferrsi.harness.{module} -> inferrsi.harness -> " @@ -1280,7 +1280,10 @@ def test_returning_r2_harness_infra_edges_fail(self) -> None: self.assertFalse(report.isolation_complete) def test_mixed_harness_tree_is_not_an_isolated_core(self) -> None: - tree = {"__init__.py": "", "harness/__init__.py": "", "harness/runner.py": "VALUE = 1\n"} + tree = { + "__init__.py": "", "harness/__init__.py": "", + "harness/parallel_round.py": "VALUE = 1\n", + } report = _report({}, base=tree) self.assertEqual(report.violations, ()) self.assertFalse(report.new_core_closure_isolated) @@ -1318,23 +1321,23 @@ def test_each_trigger_alone_keeps_overall_false(self) -> None: EMPTY_ALLOWLIST, ), ( - "harness reaches model/infra: inferrsi.harness.runner -> inferrsi.infra", + "harness reaches model/infra: inferrsi.harness.parallel_round -> inferrsi.infra", { "infra/__init__.py": "", "infra/local.py": "", - "harness/runner.py": "from inferrsi.infra import local\n", + "harness/parallel_round.py": "from inferrsi.infra import local\n", }, EMPTY_ALLOWLIST, ), ( - "harness reaches model/infra: inferrsi.harness.runner -> inferrsi.bridge" + "harness reaches model/infra: inferrsi.harness.parallel_round -> inferrsi.bridge" " -> inferrsi.model", { # A root helper that is not a retired name: the path alone blocks. "bridge.py": "from inferrsi.model import metrics\n", "model/__init__.py": "", "model/metrics.py": "", - "harness/runner.py": "from inferrsi import bridge\n", + "harness/parallel_round.py": "from inferrsi import bridge\n", }, EMPTY_ALLOWLIST, ), diff --git a/tests/repository/test_legacy_run_forwarder_gate.py b/tests/repository/test_legacy_run_forwarder_gate.py index 07967d7c5..95b706dea 100644 --- a/tests/repository/test_legacy_run_forwarder_gate.py +++ b/tests/repository/test_legacy_run_forwarder_gate.py @@ -70,15 +70,15 @@ def test_no_former_pair_is_still_registered(name): "helper.py imports inferrsi.apps"), # No core passes through a forwarder: the walk now stops at the retired # module itself, before it reaches Apps. Apps does not loop back. - ({"harness/runner.py": "from ..evaluation import VALUE\n"}, - "inferrsi.harness.runner reaches inferrsi.evaluation"), + ({"harness/manager/_runner.py": "from ...evaluation import VALUE\n"}, + "inferrsi.harness.manager._runner reaches inferrsi.evaluation"), ({"benchmark/rules.py": "from ..evaluation import VALUE\n"}, "inferrsi.benchmark.rules reaches inferrsi.evaluation"), ({"apps/legacy/run.py": "from ...evaluation import VALUE\n"}, "inferrsi.apps.legacy.run reaches inferrsi.evaluation"), # A retired name is refused even with no file behind it. - ({"harness/runner.py": "from ..execution import run_experiment\n"}, - "inferrsi.harness.runner reaches inferrsi.execution"), + ({"harness/manager/_runner.py": "from ...execution import run_experiment\n"}, + "inferrsi.harness.manager._runner reaches inferrsi.execution"), ({"apps/legacy/run.py": "from ...reporting import write_report\n"}, "inferrsi.apps.legacy.run reaches inferrsi.reporting"), ], diff --git a/tests/repository/test_target_module_import_gate.py b/tests/repository/test_target_module_import_gate.py index c76993f0f..e30913480 100644 --- a/tests/repository/test_target_module_import_gate.py +++ b/tests/repository/test_target_module_import_gate.py @@ -175,7 +175,7 @@ def test_by_path_loading_is_admitted_nowhere_else(tmp_path, relative): ("benchmark/runner.py", "from inferrsi.infra.processes import launch_server\n", "inferrsi.infra.processes"), ("apps/runner.py", "from inferrsi.infra import http\n", "inferrsi.infra.http"), - ("harness/runner.py", "from ..model.protocols.image import ImageProtocol\n", + ("harness/manager/_runner.py", "from ...model.protocols.image import ImageProtocol\n", "inferrsi.model.protocols.image"), ("apps/runner.py", "import inferrsi.model.protocols\n", "inferrsi.model.protocols"), # #498 slice 3c: the campaign facade is gone. @@ -194,13 +194,14 @@ def test_by_path_loading_is_admitted_nowhere_else(tmp_path, relative): # #558: the trial runner moved to inferrsi.harness.trials. ("apps/runner.py", "from inferrsi.harness.scenarios.external import execute_trial\n", "inferrsi.harness.scenarios.external"), - ("harness/runner.py", "from .scenarios.external import collect_trial_checks\n", + ("harness/manager/_runner.py", "from ..scenarios.external import collect_trial_checks\n", "inferrsi.harness.scenarios.external"), - ("harness/runner.py", "from .scenarios import external\n", + ("harness/manager/_runner.py", "from ..scenarios import external\n", "inferrsi.harness.scenarios.external"), + ("apps/runner.py", "from inferrsi.harness import runner\n", "inferrsi.harness.runner"), ("apps/runner.py", "from inferrsi.harness import search_tree\n", "inferrsi.harness.search_tree"), - ("harness/runner.py", "from .gvo import examples\n", "inferrsi.harness.gvo"), + ("harness/manager/_runner.py", "from ..gvo import examples\n", "inferrsi.harness.gvo"), ]) def test_retired_model_paths_fail_to_import(tmp_path, importer, source, target): report = _report(tmp_path, {importer: source}) @@ -239,6 +240,7 @@ def test_retired_model_paths_fail_from_a_package_initializer(tmp_path, importer, "harness/scenarios/__init__.py", "harness/scenarios/external.py", "harness/work_control.py", + "harness/runner.py", ]) def test_retired_model_files_fail_when_they_return(tmp_path, relative): report = _report(tmp_path, {relative: "VALUE = 1\n"}) @@ -258,9 +260,9 @@ def test_the_modules_that_replaced_the_retired_packages_are_not_retired(tmp_path "from inferrsi.apps.storage.artifacts import sha256\n" "from inferrsi.apps.integrations.anthropic import request_guard\n" ), - "harness/runner.py": ( + "harness/manager/_runner.py": ( "from inferrsi.harness.serving.image import ImageProtocol\n" - "from .trials.external import collect_trial_checks\n" + "from ..trials.external import collect_trial_checks\n" ), "harness/trials/__init__.py": "", "harness/trials/external.py": "def collect_trial_checks():\n return []\n",