diff --git a/docs/apps-module-migrations.json b/docs/apps-module-migrations.json index 31d58fbb2..0b419c817 100644 --- a/docs/apps-module-migrations.json +++ b/docs/apps-module-migrations.json @@ -528,5 +528,86 @@ "tests/harness/test_parallel_round.py", "tools/parallel_round.py" ] + }, + { + "old": "inferrsi.apps.artifacts", + "canonical": "inferrsi.apps.storage.artifacts", + "exports": [ + "REPLACE_ATTEMPTS", + "REPLACE_DELAY_SECONDS", + "atomic_write_json", + "digest", + "file_lock", + "sha256", + "write_json" + ], + "consumers": [ + "docs/skill-evaluation/local-skill-evaluation.md", + "src/inferrsi/apps/artifacts.py", + "src/inferrsi/apps/delivery/__init__.py", + "src/inferrsi/apps/delivery/projection.py", + "src/inferrsi/apps/delivery/snapshot.py", + "src/inferrsi/harness/artifact_primitives.py", + "src/inferrsi/harness/atomic_json.py", + "src/inferrsi/harness/input_binding.py", + "tests/_gate_policy_support.py", + "tests/apps/test_anthropic_agent.py", + "tests/apps/test_goal_checkpoint.py", + "tests/apps/test_inspection.py", + "tests/apps/test_legacy_run_split.py", + "tests/apps/test_result_delivery.py", + "tests/apps/test_yibuapi_runtime.py", + "tests/benchmark/test_image_modules.py", + "tests/campaigns/test_qwen21_task.py", + "tests/check_installed.py", + "tests/fixtures/harness_improvement_demo.py", + "tests/fixtures/service_reuse.py", + "tests/fixtures/skill_eval_compare_support.py", + "tests/fixtures/skill_eval_pr_support.py", + "tests/harness/test_session_lock_across_processes.py", + "tests/repository/test_target_module_import_gate.py", + "tests/session_lock_probe.py", + "tests/skill_eval/test_skill_eval_compare.py", + "tests/skill_eval/test_skill_eval_diagnostic.py", + "tests/skill_eval/test_skill_eval_feedback.py", + "tests/skill_eval/test_skill_eval_generation.py", + "tests/skill_eval/test_skill_eval_historical_job.py", + "tests/skill_eval/test_skill_eval_local.py", + "tests/skill_eval/test_skill_eval_pipeline.py", + "tests/skill_eval/test_skill_eval_planned_guidance.py", + "tests/skill_eval/test_skill_eval_planning_boundaries.py", + "tests/skill_eval/test_skill_eval_pr.py", + "tests/skill_eval/test_skill_eval_pr_diagnostic.py", + "tests/skill_eval/test_skill_eval_retention.py", + "tests/skill_eval/test_skill_eval_review_guidance.py", + "tests/skill_eval/test_skill_evaluation.py", + "tests/test_artifact_helper_copies.py", + "tools/goal_checkpoint.py", + "tools/skill_eval_auto.py", + "tools/skill_eval_cloud_export.py", + "tools/skill_eval_compare.py", + "tools/skill_eval_historical_job.py", + "tools/skill_eval_improve.py", + "tools/skill_eval_local.py", + "tools/skill_eval_pilot.py", + "tools/skill_eval_pr.py" + ] + }, + { + "old": "inferrsi.apps.inspection", + "canonical": "inferrsi.apps.host.prepared_environment", + "exports": [ + "inspect_environment" + ], + "consumers": [ + "docs/contracts/current-design.md", + "docs/module-layout.md", + "src/inferrsi/apps/cli/__init__.py", + "src/inferrsi/apps/inspection.py", + "tests/apps/test_inspection.py", + "tests/check_installed.py", + "tests/repository/test_architecture_closed_loop.py", + "tests/repository/test_first_wave_isolation_policy.py" + ] } ] diff --git a/docs/contracts/current-design.md b/docs/contracts/current-design.md index b99dd9b38..33f75a917 100644 --- a/docs/contracts/current-design.md +++ b/docs/contracts/current-design.md @@ -25,7 +25,7 @@ Historical candidate text, review dispositions, and the earlier Proposed drafts ## D001 — One distribution, three cores plus Apps, document contracts rather than shared business DTOs -Decision: keep Knowledge, Harness, and Benchmark as sibling independent cores; Apps is the only assembler. Each core owns its types. Cross-boundary traffic uses versioned JSON envelopes with explicit conversion; there is no shared business `contracts` package. The technical-only `inferrsi.contracts` package re-exports only `RunSpec`, defined once in `contracts/runspec.py`; `contracts/claim.py` owns the same Verdict enum re-exported by Harness. These are not shared business DTOs. The old root `contracts.py`, `runspec.py`, `claim.py`, and `_json_v1.py` files are retired without forwarding shells, and so are the old root `_repo_pack_data.py` and `evidence_paths.py`. R1 (#412) retired eleven more root modules the same way: the seven Knowledge compatibility shells, the three old-run forwarders `evaluation.py`, `execution.py` and `reporting.py`, and root `inspection.py`, whose host binding is now `inferrsi.apps.inspection` over the facts API in `inferrsi.apps.host.inspection`. [`CHANGELOG.md`](../../CHANGELOG.md) maps every retired path to its replacement and states the import and pickle impact. +Decision: keep Knowledge, Harness, and Benchmark as sibling independent cores; Apps is the only assembler. Each core owns its types. Cross-boundary traffic uses versioned JSON envelopes with explicit conversion; there is no shared business `contracts` package. The technical-only `inferrsi.contracts` package re-exports only `RunSpec`, defined once in `contracts/runspec.py`; `contracts/claim.py` owns the same Verdict enum re-exported by Harness. These are not shared business DTOs. The old root `contracts.py`, `runspec.py`, `claim.py`, and `_json_v1.py` files are retired without forwarding shells, and so are the old root `_repo_pack_data.py` and `evidence_paths.py`. R1 (#412) retired eleven more root modules the same way: the seven Knowledge compatibility shells, the three old-run forwarders `evaluation.py`, `execution.py` and `reporting.py`, and root `inspection.py`, whose host binding is now `inferrsi.apps.host.prepared_environment` over the facts API in `inferrsi.apps.host.inspection`. [`CHANGELOG.md`](../../CHANGELOG.md) maps every retired path to its replacement and states the import and pickle impact. Permitted shared technical leaves are only: @@ -143,7 +143,7 @@ Decision: see [`gate-policy-runstore-and-first-prs.md`](gate-policy-runstore-and Decision: old entry points, arguments, `Path`, stdout, stderr, and old run 0/1/2 stay byte-for-byte compatible. New Apps naming/envelope/exit mapping is fixed by D022, but K01/H01 do not implement a CLI. -Current reading: this covers the CLI commands and the `inferrsi` and `python -m inferrsi` entry points. It no longer covers old root Python module paths. The revised delivery decision in #412, #451 and #408 retires those paths without aliases, in the change that moves their last consumers. R1 (#412) removed the old-run root modules `evaluation`, `execution` and `reporting` together with root `inspection`; the old run is `inferrsi.apps.legacy` and the host inspection binding is `inferrsi.apps.inspection`. A1 (#408) then moved root `cli.py` and `arguments.py` to `inferrsi.apps.cli` and `inferrsi.apps.cli.arguments` and deleted both root files; the console script and `python -m inferrsi` call `inferrsi.apps.cli:main`. +Current reading: this covers the CLI commands and the `inferrsi` and `python -m inferrsi` entry points. It no longer covers old root Python module paths. The revised delivery decision in #412, #451 and #408 retires those paths without aliases, in the change that moves their last consumers. R1 (#412) removed the old-run root modules `evaluation`, `execution` and `reporting` together with root `inspection`; the old run is `inferrsi.apps.legacy` and the host inspection binding is `inferrsi.apps.host.prepared_environment`. A1 (#408) then moved root `cli.py` and `arguments.py` to `inferrsi.apps.cli` and `inferrsi.apps.cli.arguments` and deleted both root files; the console script and `python -m inferrsi` call `inferrsi.apps.cli:main`. ## D014 — events remain local, not a new shared event schema diff --git a/docs/module-layout.md b/docs/module-layout.md index ea85a5848..7f1e7594c 100644 --- a/docs/module-layout.md +++ b/docs/module-layout.md @@ -496,10 +496,10 @@ R1 (#412) deleted these eleven root modules with no forwarding shell, | `inferrsi.evaluation` | `inferrsi.apps.legacy.evaluation` | | `inferrsi.execution` | `inferrsi.apps.legacy.run` | | `inferrsi.reporting` | `inferrsi.apps.legacy.reporting` | -| `inferrsi.inspection` | `inferrsi.apps.inspection` | +| `inferrsi.inspection` | `inferrsi.apps.host.prepared_environment` | Root `inspection.py` was not an alias. It bound the Infra facts API to the -host, and `apps/inspection.py` now holds that binding: `_command` is +host, and `apps/host/prepared_environment.py` now holds that binding: `_command` is `apps.host.commands.probe_command` and `repository_identity` is `apps.host.targets.repository_identity`, both read from the module on each call, so a test replaces either name there. `apps/host/inspection.py`, moved from diff --git a/docs/skill-evaluation/local-skill-evaluation.md b/docs/skill-evaluation/local-skill-evaluation.md index 19a7ce2a0..9c6a8ab11 100644 --- a/docs/skill-evaluation/local-skill-evaluation.md +++ b/docs/skill-evaluation/local-skill-evaluation.md @@ -59,7 +59,7 @@ without silently changing its contract: ```python from inferrsi.benchmark.skill_eval_engineering import REQUEST -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json write_json("cases.json", [{ "id": "serving-response-v1", "split": "development", @@ -75,6 +75,10 @@ python tools/skill_eval_compare.py prepare --repo /path/to/repo \ Keep the returned frozen-plan SHA externally with the acceptance record. This freezes task, schema, starter, verifier/controllers and both selected bundles. +Every later operation on that plan, including `report`, must use its original +checkout and controller revision. When an upgrade moves or changes a controller, +reopen retained results with the original wheel or checkout recorded by the plan; +do not substitute the current controller or bypass `plan/freeze.json` verification. Before any real agent call separately establish trustworthy **whole-run cost bounds**, model identity, tool access, isolated environment, run order/repeats, timeout and treatment of failed/retried attempts. A plan hash is not permission diff --git a/src/inferrsi/apps/artifacts.py b/src/inferrsi/apps/artifacts.py index ac7153e56..469880418 100644 --- a/src/inferrsi/apps/artifacts.py +++ b/src/inferrsi/apps/artifacts.py @@ -1,93 +1,21 @@ -# Apps-owned file digests, file locks and JSON evidence writes. The function bodies equal -# those in the other cores' copies; tests/test_artifact_helper_copies.py keeps them equal. -# Apps imports no other inferrsi module here. - -import errno -import hashlib -import json -import os -import time -import uuid -from contextlib import contextmanager -from pathlib import Path - -# Windows refuses os.replace while another handle holds the destination open. -# A bounded retry covers the observed contention without hiding a real failure. -REPLACE_ATTEMPTS = 8 -REPLACE_DELAY_SECONDS = 0.05 - - -@contextmanager -def file_lock(path: Path): - """Hold a nonblocking OS file lock, released even if the process crashes.""" - with path.open("a+b", buffering=0) as stream: - stream.seek(0) - if os.name == "nt": - import msvcrt - - try: - msvcrt.locking(stream.fileno(), msvcrt.LK_NBLCK, 1) - except PermissionError as error: - if error.errno != errno.EACCES: - raise - # LK_NBLCK reports a lock violation as EACCES. - raise BlockingIOError(errno.EAGAIN, "File lock is held", path) from error - else: - import fcntl - - fcntl.flock(stream.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) - try: - # Windows can lock past EOF. Only the owner may initialize byte zero. - if os.fstat(stream.fileno()).st_size == 0: - stream.write(b"0") - yield - finally: - stream.seek(0) - if os.name == "nt": - msvcrt.locking(stream.fileno(), msvcrt.LK_UNLCK, 1) - else: - fcntl.flock(stream.fileno(), fcntl.LOCK_UN) - - -def digest(value): - return hashlib.sha256( - json.dumps( - value, sort_keys=True, separators=(",", ":"), ensure_ascii=False, allow_nan=False - ).encode() - ).hexdigest() - - -def sha256(path): - hasher = hashlib.sha256() - with Path(path).open("rb") as stream: - for block in iter(lambda: stream.read(1024 * 1024), b""): - hasher.update(block) - return hasher.hexdigest() - - -def write_json(path, value): - Path(path).parent.mkdir(parents=True, exist_ok=True) - Path(path).write_text( - json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n", encoding="utf-8" - ) - - -def atomic_write_json(path: Path, value: object) -> None: - path = Path(path) - # A per-writer temporary name keeps two writers from sharing one file. - temporary = path.with_name(f"{path.name}.{os.getpid()}.{uuid.uuid4().hex[:8]}.tmp") - temporary.write_text( - json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n", encoding="utf-8" - ) - try: - for attempt in range(REPLACE_ATTEMPTS): - try: - temporary.replace(path) - return - except PermissionError: - if attempt + 1 == REPLACE_ATTEMPTS: - raise - time.sleep(REPLACE_DELAY_SECONDS) - finally: - if temporary.exists(): - temporary.unlink() +"""Compatibility exports for :mod:`inferrsi.apps.storage.artifacts`.""" + +from .storage.artifacts import ( + REPLACE_ATTEMPTS, + REPLACE_DELAY_SECONDS, + atomic_write_json, + digest, + file_lock, + sha256, + write_json, +) + +__all__ = [ + "REPLACE_ATTEMPTS", + "REPLACE_DELAY_SECONDS", + "atomic_write_json", + "digest", + "file_lock", + "sha256", + "write_json", +] diff --git a/src/inferrsi/apps/cli/__init__.py b/src/inferrsi/apps/cli/__init__.py index e33a8633a..45b2b146a 100644 --- a/src/inferrsi/apps/cli/__init__.py +++ b/src/inferrsi/apps/cli/__init__.py @@ -14,7 +14,7 @@ from ...knowledge.catalog import get_knowledge, search_knowledge from ...knowledge.knowledge_operations import KnowledgeReader from ...knowledge.research import research_knowledge -from ..inspection import inspect_environment +from ..host.prepared_environment import inspect_environment from ..legacy.reporting import write_report from ..workflows.campaign import capture_context, create_campaign from ..workflows.knowledge import knowledge_reader diff --git a/src/inferrsi/apps/delivery/__init__.py b/src/inferrsi/apps/delivery/__init__.py index 2ed812349..71cf4c457 100644 --- a/src/inferrsi/apps/delivery/__init__.py +++ b/src/inferrsi/apps/delivery/__init__.py @@ -9,8 +9,8 @@ from tempfile import TemporaryDirectory from ... import __version__ -from ..artifacts import file_lock from ..storage import archive +from ..storage.artifacts import file_lock from . import adapters from .projection import iterative from .render import reports diff --git a/src/inferrsi/apps/delivery/projection.py b/src/inferrsi/apps/delivery/projection.py index 21bfd68ac..a8db9337b 100644 --- a/src/inferrsi/apps/delivery/projection.py +++ b/src/inferrsi/apps/delivery/projection.py @@ -3,7 +3,7 @@ import re from ...harness.usage import normalize_usage -from ..artifacts import digest +from ..storage.artifacts import digest from .schema import gap, number, timestamp diff --git a/src/inferrsi/apps/delivery/snapshot.py b/src/inferrsi/apps/delivery/snapshot.py index 02f728bda..22a2733c0 100644 --- a/src/inferrsi/apps/delivery/snapshot.py +++ b/src/inferrsi/apps/delivery/snapshot.py @@ -6,7 +6,7 @@ from pathlib import Path, PurePosixPath from ...harness import candidates -from ..artifacts import sha256 +from ..storage.artifacts import sha256 from .schema import decode MAX_DOCUMENT_BYTES = 8 * 1024 * 1024 diff --git a/src/inferrsi/apps/host/prepared_environment.py b/src/inferrsi/apps/host/prepared_environment.py new file mode 100644 index 000000000..d3525b4b9 --- /dev/null +++ b/src/inferrsi/apps/host/prepared_environment.py @@ -0,0 +1,33 @@ +"""Prepared-environment inspection bound to this host. + +``apps.host.inspection.inspect_environment`` is the facts API: it takes the +command probe and the repository snapshot as ports. This composition supplies the +real host probe and the Git repository identity. The facts module keeps both probes injectable. +""" + +from .commands import probe_command as _command +from .inspection import inspect_environment as _inspect_environment +from .targets import repository_identity + + +def inspect_environment( + repo: str, + repo_type: str, + backend: str, + *, + device_ids: tuple[str, ...] = (), + device_model: str | None = None, + python: str | None = None, +) -> dict: + # Both ports are read from this module on every call, so replacing + # ``_command`` or ``repository_identity`` here changes the next inspection. + return _inspect_environment( + repo, + repo_type, + backend, + device_ids=device_ids, + device_model=device_model, + python=python, + command=_command, + snapshot=repository_identity, + ) diff --git a/src/inferrsi/apps/inspection.py b/src/inferrsi/apps/inspection.py index 47a643342..d64dac46b 100644 --- a/src/inferrsi/apps/inspection.py +++ b/src/inferrsi/apps/inspection.py @@ -1,34 +1,9 @@ -"""Prepared-environment inspection bound to this host. +"""Compatibility exports for :mod:`inferrsi.apps.host.prepared_environment`.""" -``apps.host.inspection.inspect_environment`` is the facts API: it takes the -command probe and the repository snapshot as ports. This composition supplies the -real host probe and the Git repository identity. The host package imports nothing -from here. -""" +from .host.prepared_environment import ( + inspect_environment, +) -from .host.commands import probe_command as _command -from .host.inspection import inspect_environment as _inspect_environment -from .host.targets import repository_identity - - -def inspect_environment( - repo: str, - repo_type: str, - backend: str, - *, - device_ids: tuple[str, ...] = (), - device_model: str | None = None, - python: str | None = None, -) -> dict: - # Both ports are read from this module on every call, so replacing - # ``_command`` or ``repository_identity`` here changes the next inspection. - return _inspect_environment( - repo, - repo_type, - backend, - device_ids=device_ids, - device_model=device_model, - python=python, - command=_command, - snapshot=repository_identity, - ) +__all__ = [ + "inspect_environment", +] diff --git a/src/inferrsi/apps/storage/artifacts.py b/src/inferrsi/apps/storage/artifacts.py new file mode 100644 index 000000000..ac7153e56 --- /dev/null +++ b/src/inferrsi/apps/storage/artifacts.py @@ -0,0 +1,93 @@ +# Apps-owned file digests, file locks and JSON evidence writes. The function bodies equal +# those in the other cores' copies; tests/test_artifact_helper_copies.py keeps them equal. +# Apps imports no other inferrsi module here. + +import errno +import hashlib +import json +import os +import time +import uuid +from contextlib import contextmanager +from pathlib import Path + +# Windows refuses os.replace while another handle holds the destination open. +# A bounded retry covers the observed contention without hiding a real failure. +REPLACE_ATTEMPTS = 8 +REPLACE_DELAY_SECONDS = 0.05 + + +@contextmanager +def file_lock(path: Path): + """Hold a nonblocking OS file lock, released even if the process crashes.""" + with path.open("a+b", buffering=0) as stream: + stream.seek(0) + if os.name == "nt": + import msvcrt + + try: + msvcrt.locking(stream.fileno(), msvcrt.LK_NBLCK, 1) + except PermissionError as error: + if error.errno != errno.EACCES: + raise + # LK_NBLCK reports a lock violation as EACCES. + raise BlockingIOError(errno.EAGAIN, "File lock is held", path) from error + else: + import fcntl + + fcntl.flock(stream.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) + try: + # Windows can lock past EOF. Only the owner may initialize byte zero. + if os.fstat(stream.fileno()).st_size == 0: + stream.write(b"0") + yield + finally: + stream.seek(0) + if os.name == "nt": + msvcrt.locking(stream.fileno(), msvcrt.LK_UNLCK, 1) + else: + fcntl.flock(stream.fileno(), fcntl.LOCK_UN) + + +def digest(value): + return hashlib.sha256( + json.dumps( + value, sort_keys=True, separators=(",", ":"), ensure_ascii=False, allow_nan=False + ).encode() + ).hexdigest() + + +def sha256(path): + hasher = hashlib.sha256() + with Path(path).open("rb") as stream: + for block in iter(lambda: stream.read(1024 * 1024), b""): + hasher.update(block) + return hasher.hexdigest() + + +def write_json(path, value): + Path(path).parent.mkdir(parents=True, exist_ok=True) + Path(path).write_text( + json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n", encoding="utf-8" + ) + + +def atomic_write_json(path: Path, value: object) -> None: + path = Path(path) + # A per-writer temporary name keeps two writers from sharing one file. + temporary = path.with_name(f"{path.name}.{os.getpid()}.{uuid.uuid4().hex[:8]}.tmp") + temporary.write_text( + json.dumps(value, ensure_ascii=False, indent=2, allow_nan=False) + "\n", encoding="utf-8" + ) + try: + for attempt in range(REPLACE_ATTEMPTS): + try: + temporary.replace(path) + return + except PermissionError: + if attempt + 1 == REPLACE_ATTEMPTS: + raise + time.sleep(REPLACE_DELAY_SECONDS) + finally: + if temporary.exists(): + temporary.unlink() diff --git a/src/inferrsi/harness/artifact_primitives.py b/src/inferrsi/harness/artifact_primitives.py index af0e74533..68cef6253 100644 --- a/src/inferrsi/harness/artifact_primitives.py +++ b/src/inferrsi/harness/artifact_primitives.py @@ -1,5 +1,5 @@ # Harness-owned digest, file hash and file lock. Each function body equals the one in -# inferrsi.apps.artifacts, so digests, hashes and lock files are byte-identical and the two +# inferrsi.apps.storage.artifacts, so digests, hashes and lock files are byte-identical and the two # locks exclude each other on the same path; Harness does not import that module here. # tests/test_artifact_helper_copies.py keeps the copies equal. diff --git a/src/inferrsi/harness/atomic_json.py b/src/inferrsi/harness/atomic_json.py index 788feeffd..42d3606ac 100644 --- a/src/inferrsi/harness/atomic_json.py +++ b/src/inferrsi/harness/atomic_json.py @@ -1,5 +1,5 @@ # Harness-owned atomic JSON evidence writes. The bytes equal those written by -# inferrsi.apps.artifacts.atomic_write_json; Harness does not import that module here. +# inferrsi.apps.storage.artifacts.atomic_write_json; Harness does not import that module here. import json import os diff --git a/src/inferrsi/harness/input_binding.py b/src/inferrsi/harness/input_binding.py index 7d63cea4c..9b2c0705d 100644 --- a/src/inferrsi/harness/input_binding.py +++ b/src/inferrsi/harness/input_binding.py @@ -8,8 +8,8 @@ from typing import BinaryIO # H input capture and byte-equivalent copies. H owns these digests and writes and never -# imports inferrsi.apps.artifacts. A source is read once into a snapshot; every later copy comes -# from that snapshot, never again from the mutable source. +# imports inferrsi.apps.storage.artifacts. A source is read once into a snapshot; +# every later copy comes from that snapshot, never again from the mutable source. _CHUNK = 1024 * 1024 # Schema ``Path``: relative and slash-separated; no '.'/'..' segment, backslash, colon, # or control character. diff --git a/tests/_gate_policy_support.py b/tests/_gate_policy_support.py index 045048ba6..1bf4cf6d2 100644 --- a/tests/_gate_policy_support.py +++ b/tests/_gate_policy_support.py @@ -97,7 +97,7 @@ # ``inferrsi.harness.serving`` and removed the emptied ``inferrsi.model.protocols``. # Each name covers everything below it. A file under one fails, and so does any import # that names one, even when its target is absent. -# Slices 3b, 4 and 5 moved the artifact helpers to ``inferrsi.apps.artifacts`` and the +# Slices 3b, 4 and 5 moved the artifact helpers to ``inferrsi.apps.storage.artifacts`` and the # provider modules to ``inferrsi.apps.integrations.anthropic``, and deleted both packages, # so the two package names are retired as a whole. # #558 moved ``inferrsi.harness.scenarios`` to ``inferrsi.harness.trials``, with no diff --git a/tests/apps/test_anthropic_agent.py b/tests/apps/test_anthropic_agent.py index 866488940..d90059bac 100644 --- a/tests/apps/test_anthropic_agent.py +++ b/tests/apps/test_anthropic_agent.py @@ -6,8 +6,8 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json from inferrsi.apps.integrations.anthropic import anthropic_agent as agent +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows import skill_evaluation as evaluation from inferrsi.harness import skill_evaluation as harness from tests.fixtures.skill_eval_compare_support import configuration diff --git a/tests/apps/test_goal_checkpoint.py b/tests/apps/test_goal_checkpoint.py index ff844df8c..219614eac 100644 --- a/tests/apps/test_goal_checkpoint.py +++ b/tests/apps/test_goal_checkpoint.py @@ -5,7 +5,7 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from tests.fixtures.skill_eval_compare_support import FixedOutputClient, configuration from tools import goal_checkpoint as checkpoint from tools import skill_eval_compare as compare diff --git a/tests/apps/test_inspection.py b/tests/apps/test_inspection.py index 54da77b1e..68091763c 100644 --- a/tests/apps/test_inspection.py +++ b/tests/apps/test_inspection.py @@ -15,12 +15,12 @@ import pytest -from inferrsi.apps import inspection as host_inspection -from inferrsi.apps.artifacts import atomic_write_json from inferrsi.apps.host import commands, targets from inferrsi.apps.host import inspection as facts -from inferrsi.apps.inspection import inspect_environment +from inferrsi.apps.host import prepared_environment as host_inspection +from inferrsi.apps.host.prepared_environment import inspect_environment from inferrsi.apps.legacy.reporting import write_report +from inferrsi.apps.storage.artifacts import atomic_write_json ROCM_INFO = ( "=====================\n" @@ -68,10 +68,10 @@ def command(argv): with ( patch( - "inferrsi.apps.inspection.repository_identity", + "inferrsi.apps.host.prepared_environment.repository_identity", return_value={"available": True, "head": "test"}, ), - patch("inferrsi.apps.inspection._command", side_effect=command), + patch("inferrsi.apps.host.prepared_environment._command", side_effect=command), ): return inspect_environment(".", "vllm_omni", "cuda", device_ids=ids, device_model=model) @@ -110,10 +110,10 @@ def command(argv): with ( patch( - "inferrsi.apps.inspection.repository_identity", + "inferrsi.apps.host.prepared_environment.repository_identity", return_value={"available": True, "head": "test"}, ), - patch("inferrsi.apps.inspection._command", side_effect=command), + patch("inferrsi.apps.host.prepared_environment._command", side_effect=command), ): return inspect_environment( ".", "vllm_omni", backend, device_ids=ids, device_model=model @@ -249,7 +249,7 @@ def test_canonical_binding_is_the_real_host_probe_and_git_identity(): assert host_inspection._command is commands.probe_command assert host_inspection.repository_identity is targets.repository_identity assert host_inspection._inspect_environment is facts.inspect_environment - assert inspect_environment.__module__ == "inferrsi.apps.inspection" + assert inspect_environment.__module__ == "inferrsi.apps.host.prepared_environment" assert str(inspect.signature(inspect_environment)) == ( "(repo: str, repo_type: str, backend: str, *, device_ids: tuple[str, ...] = (), " "device_model: str | None = None, python: str | None = None) -> dict" @@ -349,7 +349,7 @@ def test_retired_root_inspection_is_gone_and_host_facts_load_no_core(): "assert not apps, apps\n" # The retired root binding reached the snapshot through the old run. The # canonical one loads no Benchmark module and no old-run composition. - "import inferrsi.apps.inspection\n" + "import inferrsi.apps.host.prepared_environment\n" "old_run = ('inferrsi.benchmark', 'inferrsi.apps.legacy', 'inferrsi.execution')\n" "loaded = [name for name in sys.modules if name.startswith(old_run)]\n" "assert not loaded, loaded\n" diff --git a/tests/apps/test_legacy_run_split.py b/tests/apps/test_legacy_run_split.py index d3dbd7466..0fe8ac2e7 100644 --- a/tests/apps/test_legacy_run_split.py +++ b/tests/apps/test_legacy_run_split.py @@ -13,11 +13,11 @@ import pytest -from inferrsi.apps import artifacts from inferrsi.apps.host import targets from inferrsi.apps.legacy import evaluation as legacy_evaluation from inferrsi.apps.legacy import reporting as legacy_reporting from inferrsi.apps.legacy import run as legacy_run +from inferrsi.apps.storage import artifacts from inferrsi.benchmark import legacy_run_v0, metrics, sampling from inferrsi.contracts import RunSpec, claim from inferrsi.harness import atomic_json diff --git a/tests/apps/test_result_delivery.py b/tests/apps/test_result_delivery.py index 40450c3e7..3ff3981f5 100644 --- a/tests/apps/test_result_delivery.py +++ b/tests/apps/test_result_delivery.py @@ -6,12 +6,12 @@ import pytest from inferrsi.apps import delivery -from inferrsi.apps.artifacts import atomic_write_json, sha256 from inferrsi.apps.cli import main from inferrsi.apps.delivery.projection import metric from inferrsi.apps.delivery.schema import decode, validate_result from inferrsi.apps.delivery.snapshot import MAX_DOCUMENT_BYTES, Snapshot from inferrsi.apps.storage import archive +from inferrsi.apps.storage.artifacts import atomic_write_json, sha256 from inferrsi.apps.storage.result import preparation_result from inferrsi.harness import optimization from tests.diagnosis_support import diagnosis_evidence diff --git a/tests/apps/test_yibuapi_runtime.py b/tests/apps/test_yibuapi_runtime.py index 3b57a57a9..54264d29a 100644 --- a/tests/apps/test_yibuapi_runtime.py +++ b/tests/apps/test_yibuapi_runtime.py @@ -7,8 +7,8 @@ import pytest import yaml -from inferrsi.apps.artifacts import write_json from inferrsi.apps.integrations.anthropic import anthropic_agent as agent +from inferrsi.apps.storage.artifacts import write_json from inferrsi.harness import skill_evaluation as harness from tests.apps.test_anthropic_agent import ANSWER, MODEL, SCHEMA_SMALL, read, submit from tests.fixtures.skill_eval_compare_support import DATA diff --git a/tests/benchmark/test_image_modules.py b/tests/benchmark/test_image_modules.py index a378bf129..81a5b3557 100644 --- a/tests/benchmark/test_image_modules.py +++ b/tests/benchmark/test_image_modules.py @@ -7,7 +7,7 @@ import pytest -from inferrsi.apps.artifacts import sha256 +from inferrsi.apps.storage.artifacts import sha256 from inferrsi.benchmark.sampling import collect_samples from inferrsi.benchmark.validators.image import ImageQualityGate, compare_images from inferrsi.harness.serving.image import ImageProtocol diff --git a/tests/campaigns/test_qwen21_task.py b/tests/campaigns/test_qwen21_task.py index 0863c44f0..31ccc35bb 100644 --- a/tests/campaigns/test_qwen21_task.py +++ b/tests/campaigns/test_qwen21_task.py @@ -982,7 +982,7 @@ def test_candidate_cannot_change_the_recorded_case_configuration(tmp_path): def test_harness_continues_only_after_attributed_contract_rejection(tmp_path, failure): """Round 1 is the real CPU worker and Qwen assessor; later rows are synthetic stand-ins.""" pytest.importorskip("torch") - from inferrsi.apps.artifacts import atomic_write_json, sha256 + from inferrsi.apps.storage.artifacts import atomic_write_json, sha256 from inferrsi.harness import optimization from tests.diagnosis_support import diagnosis_evidence diff --git a/tests/campaigns/test_qwen_gvo_diagnostic.py b/tests/campaigns/test_qwen_gvo_diagnostic.py index d7765305d..30c968b35 100644 --- a/tests/campaigns/test_qwen_gvo_diagnostic.py +++ b/tests/campaigns/test_qwen_gvo_diagnostic.py @@ -58,7 +58,15 @@ def test_protocol_identity_checked_before_loading(tmp_path, monkeypatch): checker = module("validator/check.py") task = tmp_path / "task" shutil.copytree(task_resources("qwen21-denoise-npu"), task) + plan = tmp_path / "plan" + shutil.copytree(checker.PLAN, plan) + spec = json.loads((plan / "runspec.json").read_text()) + spec["packaged_task_sha256"] = { + name: checker.sha(task / name) for name in spec["packaged_task_sha256"] + } + (plan / "runspec.json").write_text(json.dumps(spec)) (task / "optimization.py").write_text("this is deliberately invalid Python source.") + monkeypatch.setattr(checker, "PLAN", plan) monkeypatch.setattr(checker, "task_resources", lambda _: task) with pytest.raises(ValueError, match="optimization.py"): checker.main(tmp_path / "trial", tmp_path / "failed") diff --git a/tests/check_installed.py b/tests/check_installed.py index 78eda6163..b85aa18a0 100644 --- a/tests/check_installed.py +++ b/tests/check_installed.py @@ -764,7 +764,7 @@ def _inventory(root, prefix): "evaluation": "inferrsi.apps.legacy.evaluation", "execution": "inferrsi.apps.legacy.run", "reporting": "inferrsi.apps.legacy.reporting", - "inspection": "inferrsi.apps.inspection", + "inspection": "inferrsi.apps.host.prepared_environment", } assert len(r1_retired) == 11 for retired, canonical in r1_retired.items(): @@ -811,7 +811,7 @@ def _inventory(root, prefix): assert import_module("inferrsi.apps.views.summary_chart").main.__module__ == ( "inferrsi.apps.views.summary_chart" ) -host_inspection = import_module("inferrsi.apps.inspection") +host_inspection = import_module("inferrsi.apps.host.prepared_environment") assert host_inspection._command is import_module("inferrsi.apps.host.commands").probe_command assert host_inspection.repository_identity is ( import_module("inferrsi.apps.host.targets").repository_identity @@ -981,7 +981,7 @@ def assert_not_importable(name): # #498 slice 2: the serving helpers ship only under inferrsi.harness.serving, with no # forwarder for the old Infra and Model paths. Slice 3c deleted the infra.campaign facade, # slice 3a moved the host bindings to inferrsi.apps.host, and slices 3b, 4 and 5 moved the -# artifact helpers to inferrsi.apps.artifacts and the provider modules to +# artifact helpers to inferrsi.apps.storage.artifacts and the provider modules to # inferrsi.apps.integrations.anthropic. Both packages are gone from the wheel. for retired in ("inferrsi.infra", "inferrsi.infra.artifacts", "inferrsi.infra.processes", "inferrsi.infra.http", "inferrsi.infra.campaign", "inferrsi.infra.commands", @@ -997,7 +997,7 @@ def assert_not_importable(name): "inferrsi.harness.serving.http", "inferrsi.harness.serving.image", "inferrsi.apps.host.commands", "inferrsi.apps.host.inspection", "inferrsi.apps.host.environment", "inferrsi.apps.host.platforms", - "inferrsi.apps.host.targets", "inferrsi.apps.artifacts", + "inferrsi.apps.host.targets", "inferrsi.apps.storage.artifacts", "inferrsi.apps.integrations.anthropic.anthropic_agent", "inferrsi.apps.integrations.anthropic.anthropic_edit_agent", "inferrsi.apps.integrations.anthropic.request_guard"): diff --git a/tests/fixtures/harness_improvement_demo.py b/tests/fixtures/harness_improvement_demo.py index 152e8115f..7633bd0d5 100644 --- a/tests/fixtures/harness_improvement_demo.py +++ b/tests/fixtures/harness_improvement_demo.py @@ -7,7 +7,7 @@ import tempfile from pathlib import Path -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tests.fixtures.skill_eval_compare_support import DATA, ROOT, source_repo from tools import skill_eval_compare as compare from tools import skill_eval_improve as improve diff --git a/tests/fixtures/service_reuse.py b/tests/fixtures/service_reuse.py index 3257d6adf..dc1404c00 100644 --- a/tests/fixtures/service_reuse.py +++ b/tests/fixtures/service_reuse.py @@ -8,8 +8,8 @@ import pytest -from inferrsi.apps import artifacts from inferrsi.apps.cli import main +from inferrsi.apps.storage import artifacts from inferrsi.harness import artifact_primitives from inferrsi.harness.records import evidence, knowledge_capture from inferrsi.knowledge import knowledge_operations diff --git a/tests/fixtures/skill_eval_compare_support.py b/tests/fixtures/skill_eval_compare_support.py index fb2add4d4..723a792d9 100644 --- a/tests/fixtures/skill_eval_compare_support.py +++ b/tests/fixtures/skill_eval_compare_support.py @@ -4,7 +4,7 @@ import sys from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json ROOT = Path(__file__).resolve().parents[2] DATA = json.loads((ROOT / "tests/fixtures/skill_eval_grading.json").read_text(encoding="utf-8")) diff --git a/tests/fixtures/skill_eval_pr_support.py b/tests/fixtures/skill_eval_pr_support.py index f6572ae70..8d344e7e2 100644 --- a/tests/fixtures/skill_eval_pr_support.py +++ b/tests/fixtures/skill_eval_pr_support.py @@ -3,7 +3,7 @@ import zipfile from urllib.parse import parse_qs, urlsplit -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tests.fixtures.skill_eval_compare_support import configuration, git from tools import skill_eval_compare as compare from tools import skill_eval_pr as integration diff --git a/tests/harness/test_session_lock_across_processes.py b/tests/harness/test_session_lock_across_processes.py index 73e5fa77f..41e4fb053 100644 --- a/tests/harness/test_session_lock_across_processes.py +++ b/tests/harness/test_session_lock_across_processes.py @@ -35,7 +35,7 @@ if side == "harness": from inferrsi.harness.artifact_primitives import file_lock else: - from inferrsi.apps.artifacts import file_lock + from inferrsi.apps.storage.artifacts import file_lock with file_lock(lock): ready.write_text("held", encoding="utf-8") deadline = time.monotonic() + 60 @@ -54,7 +54,7 @@ if side == "harness": from inferrsi.harness.artifact_primitives import file_lock else: - from inferrsi.apps.artifacts import file_lock + from inferrsi.apps.storage.artifacts import file_lock try: with file_lock(lock): outcome = {"acquired": True} diff --git a/tests/repository/test_architecture_closed_loop.py b/tests/repository/test_architecture_closed_loop.py index 2a567a4ee..dcb49fc41 100644 --- a/tests/repository/test_architecture_closed_loop.py +++ b/tests/repository/test_architecture_closed_loop.py @@ -429,8 +429,8 @@ def test_seam_guard_exempts_only_the_two_exact_seams(self) -> None: ("import inferrsi.knowledge.knowledge_operations_v2\n", "inferrsi.knowledge.knowledge_operations_v2"), # Another Apps or Knowledge module that is no seam of this assembler. - ("from inferrsi.apps.inspection import inspect_environment\n", - "inferrsi.apps.inspection"), + ("from inferrsi.apps.host.prepared_environment import inspect_environment\n", + "inferrsi.apps.host.prepared_environment"), ("from inferrsi.apps.api import read_attempt_view\n", "inferrsi.apps.api"), ("from inferrsi.knowledge.skill_catalog import get_skill\n", "inferrsi.knowledge.skill_catalog"), diff --git a/tests/repository/test_first_wave_isolation_policy.py b/tests/repository/test_first_wave_isolation_policy.py index f22a710f0..7444a99fb 100644 --- a/tests/repository/test_first_wave_isolation_policy.py +++ b/tests/repository/test_first_wave_isolation_policy.py @@ -421,7 +421,8 @@ def test_another_importer_fails(self) -> None: paths = ( "infra/other.py", "infra/inspection_helpers.py", "infra/__init__.py", "infra/platforms/__init__.py", "harness/api.py", "harness/runner.py", - "benchmark/probe.py", "apps/main.py", "apps/inspection.py", "model/probe.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", "benchmark_operations.py", "apps/benchmark_operations.py", "summary_chart.py", "apps/views/summary_chart.py", "mindie_project.py", "apps/mindie/project.py", diff --git a/tests/repository/test_target_module_import_gate.py b/tests/repository/test_target_module_import_gate.py index d60d897b4..f5ebe2d91 100644 --- a/tests/repository/test_target_module_import_gate.py +++ b/tests/repository/test_target_module_import_gate.py @@ -246,12 +246,12 @@ def test_the_modules_that_replaced_the_retired_packages_are_not_retired(tmp_path # #498 retired the whole Infra and Model packages. Every module that took over from # them must stay importable by name under the new owner. report = _report(tmp_path, { - "apps/artifacts.py": "VALUE = 1\n", + "apps/storage/artifacts.py": "VALUE = 1\n", "apps/integrations/__init__.py": "", "apps/integrations/anthropic/__init__.py": "", "apps/integrations/anthropic/request_guard.py": "VALUE = 1\n", "apps/runner.py": ( - "from inferrsi.apps.artifacts import sha256\n" + "from inferrsi.apps.storage.artifacts import sha256\n" "from inferrsi.apps.integrations.anthropic import request_guard\n" ), "harness/runner.py": ( @@ -329,7 +329,7 @@ def test_clean_scan_is_not_isolation(self) -> None: name = module.removeprefix("inferrsi.") self.assertFalse((ROOT / f"{name}.py").exists(), name) self.assertFalse((ROOT / name).exists(), name) - self.assertTrue((ROOT / "apps" / "inspection.py").is_file()) + self.assertTrue((ROOT / "apps" / "host" / "prepared_environment.py").is_file()) self.assertEqual( support.CONTRACTS_MODULES, { diff --git a/tests/session_lock_probe.py b/tests/session_lock_probe.py index c6271da8b..c31ca4e63 100644 --- a/tests/session_lock_probe.py +++ b/tests/session_lock_probe.py @@ -19,7 +19,7 @@ import inferrsi from inferrsi.apps import delivery -from inferrsi.apps.artifacts import atomic_write_json, sha256 +from inferrsi.apps.storage.artifacts import atomic_write_json, sha256 from inferrsi.harness import optimization # The child runs with -I and imports inferrsi from the same location as this process. diff --git a/tests/skill_eval/test_skill_eval_compare.py b/tests/skill_eval/test_skill_eval_compare.py index d6f73df64..ca15e3090 100644 --- a/tests/skill_eval/test_skill_eval_compare.py +++ b/tests/skill_eval/test_skill_eval_compare.py @@ -9,7 +9,7 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.knowledge.knowledge_operations import KnowledgeReader, RevisionConflict from tests.fixtures.skill_eval_compare_support import ( DATA, @@ -1010,7 +1010,7 @@ def test_changed_runtime_controllers_reject_execution_and_report_without_calls(t module.report(output) saved = (output / "report.json").read_bytes(), (output / "report.md").read_bytes() assert "src/inferrsi/harness/local_process.py" in module.CONTROLLERS - assert "src/inferrsi/apps/artifacts.py" in module.CONTROLLERS + assert "src/inferrsi/apps/storage/artifacts.py" in module.CONTROLLERS assert "src/inferrsi/apps/integrations/anthropic/request_guard.py" in module.CONTROLLERS assert "tools/skill_eval_artifact_guidance.py" in module.CONTROLLERS # Each owner of the split trial path is frozen: composed entry, rules and host. diff --git a/tests/skill_eval/test_skill_eval_diagnostic.py b/tests/skill_eval/test_skill_eval_diagnostic.py index ef14b0279..ef23c6d4e 100644 --- a/tests/skill_eval/test_skill_eval_diagnostic.py +++ b/tests/skill_eval/test_skill_eval_diagnostic.py @@ -7,7 +7,7 @@ import unittest from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.benchmark import skill_eval_diagnostic as diagnostic from tests.fixtures.skill_eval_compare_support import FixedOutputClient, configuration, git from tools import skill_eval_compare as compare diff --git a/tests/skill_eval/test_skill_eval_feedback.py b/tests/skill_eval/test_skill_eval_feedback.py index e25506943..63ccb9eaa 100644 --- a/tests/skill_eval/test_skill_eval_feedback.py +++ b/tests/skill_eval/test_skill_eval_feedback.py @@ -6,7 +6,7 @@ from pathlib import Path from unittest.mock import Mock, patch -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.benchmark import skill_eval_diagnostic as diagnostic from tests.fixtures.skill_eval_compare_support import FixedOutputClient from tests.fixtures.skill_eval_pr_support import approval, setup diff --git a/tests/skill_eval/test_skill_eval_generation.py b/tests/skill_eval/test_skill_eval_generation.py index 3e5200631..e68606b57 100644 --- a/tests/skill_eval/test_skill_eval_generation.py +++ b/tests/skill_eval/test_skill_eval_generation.py @@ -6,8 +6,8 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json from inferrsi.apps.integrations.anthropic import anthropic_agent as agent +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows import skill_eval_engineering as artifact_check from inferrsi.apps.workflows import skill_evaluation as evaluation from inferrsi.benchmark import skill_eval_engineering as engineering diff --git a/tests/skill_eval/test_skill_eval_historical_job.py b/tests/skill_eval/test_skill_eval_historical_job.py index 1a06c5a15..1658f3e22 100644 --- a/tests/skill_eval/test_skill_eval_historical_job.py +++ b/tests/skill_eval/test_skill_eval_historical_job.py @@ -8,7 +8,7 @@ import pytest import yaml -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from tools import skill_eval_historical_job as job diff --git a/tests/skill_eval/test_skill_eval_local.py b/tests/skill_eval/test_skill_eval_local.py index 67cbc0dbc..c4db184e2 100644 --- a/tests/skill_eval/test_skill_eval_local.py +++ b/tests/skill_eval/test_skill_eval_local.py @@ -6,7 +6,7 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows import skill_eval_engineering as artifact_check from inferrsi.benchmark import skill_eval_engineering as engineering from inferrsi.harness import artifact_sandbox as sandbox diff --git a/tests/skill_eval/test_skill_eval_pipeline.py b/tests/skill_eval/test_skill_eval_pipeline.py index 01c49f396..3ed483092 100644 --- a/tests/skill_eval/test_skill_eval_pipeline.py +++ b/tests/skill_eval/test_skill_eval_pipeline.py @@ -8,7 +8,7 @@ import pytest -from inferrsi.apps.artifacts import atomic_write_json, sha256 +from inferrsi.apps.storage.artifacts import atomic_write_json, sha256 from inferrsi.apps.workflows.skill_evaluation import run_trial, summarize from tools import skill_eval_pilot diff --git a/tests/skill_eval/test_skill_eval_planned_guidance.py b/tests/skill_eval/test_skill_eval_planned_guidance.py index 2e9061e97..b57222f1b 100644 --- a/tests/skill_eval/test_skill_eval_planned_guidance.py +++ b/tests/skill_eval/test_skill_eval_planned_guidance.py @@ -8,7 +8,7 @@ import pytest -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tests.fixtures.skill_eval_compare_support import git from tests.fixtures.skill_eval_pr_support import setup from tests.skill_eval.test_skill_eval_pr_summary import visible diff --git a/tests/skill_eval/test_skill_eval_planning_boundaries.py b/tests/skill_eval/test_skill_eval_planning_boundaries.py index c08325a60..9f2aaa39e 100644 --- a/tests/skill_eval/test_skill_eval_planning_boundaries.py +++ b/tests/skill_eval/test_skill_eval_planning_boundaries.py @@ -7,7 +7,7 @@ import pytest -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tests.fixtures.skill_eval_compare_support import git from tests.fixtures.skill_eval_pr_support import SimulatedGitHub, setup from tests.skill_eval.test_skill_eval_pr import dispatch_event diff --git a/tests/skill_eval/test_skill_eval_pr.py b/tests/skill_eval/test_skill_eval_pr.py index a9a6b8c98..5e505bf0b 100644 --- a/tests/skill_eval/test_skill_eval_pr.py +++ b/tests/skill_eval/test_skill_eval_pr.py @@ -11,7 +11,7 @@ import pytest import yaml -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from tests.fixtures.skill_eval_compare_support import ROOT, FixedOutputClient, git from tests.fixtures.skill_eval_pr_support import ( SimulatedGitHub, diff --git a/tests/skill_eval/test_skill_eval_pr_diagnostic.py b/tests/skill_eval/test_skill_eval_pr_diagnostic.py index a118a658b..96c9f5e53 100644 --- a/tests/skill_eval/test_skill_eval_pr_diagnostic.py +++ b/tests/skill_eval/test_skill_eval_pr_diagnostic.py @@ -3,7 +3,7 @@ import unittest from pathlib import Path -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from inferrsi.benchmark import skill_eval_diagnostic as diagnostic from tests.fixtures.skill_eval_compare_support import FixedOutputClient from tests.fixtures.skill_eval_pr_support import setup diff --git a/tests/skill_eval/test_skill_eval_retention.py b/tests/skill_eval/test_skill_eval_retention.py index 40dd887d5..c775e9fd3 100644 --- a/tests/skill_eval/test_skill_eval_retention.py +++ b/tests/skill_eval/test_skill_eval_retention.py @@ -5,7 +5,7 @@ import pytest -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tests.fixtures.skill_eval_compare_support import FixedOutputClient from tests.fixtures.skill_eval_pr_support import SimulatedGitHub, approval, setup from tests.skill_eval import test_skill_eval_auto as auto_tests diff --git a/tests/skill_eval/test_skill_eval_review_guidance.py b/tests/skill_eval/test_skill_eval_review_guidance.py index c1e16b530..5fc655d8d 100644 --- a/tests/skill_eval/test_skill_eval_review_guidance.py +++ b/tests/skill_eval/test_skill_eval_review_guidance.py @@ -5,7 +5,7 @@ import pytest -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from tests.fixtures.skill_eval_compare_support import FixedOutputClient from tests.fixtures.skill_eval_pr_support import SimulatedGitHub, approval, setup from tools import skill_eval_pr as integration diff --git a/tests/skill_eval/test_skill_evaluation.py b/tests/skill_eval/test_skill_evaluation.py index 66ce942ec..c3ff021bd 100644 --- a/tests/skill_eval/test_skill_evaluation.py +++ b/tests/skill_eval/test_skill_evaluation.py @@ -299,7 +299,7 @@ def verdict(execution, trace, output, checks): def test_harness_owned_writes_and_digests_match_apps_bytes(tmp_path): - from inferrsi.apps import artifacts + from inferrsi.apps.storage import artifacts from inferrsi.harness import atomic_json, input_binding value = {"b": [1.5, None, True, 1e-07, 1e16], "a": "非 ASCII", "nested": {"z": 0.1 + 0.2}} @@ -321,7 +321,7 @@ def test_harness_artifact_primitives_match_apps_bytes_and_semantics(tmp_path): import ast import inspect - from inferrsi.apps import artifacts as infra + from inferrsi.apps.storage import artifacts as infra from inferrsi.harness import artifact_primitives as harness for name in ("digest", "sha256", "file_lock"): diff --git a/tests/test_artifact_helper_copies.py b/tests/test_artifact_helper_copies.py index c8841f06a..fc2580975 100644 --- a/tests/test_artifact_helper_copies.py +++ b/tests/test_artifact_helper_copies.py @@ -19,13 +19,13 @@ # Each helper name and the modules that hold a copy. #498 slice 3b added the Apps copy # and slice 5 deleted the Infra one, so Harness, Benchmark and Apps hold the three. COPIES = { - "sha256": ("inferrsi.apps.artifacts", "inferrsi.harness.artifact_primitives", + "sha256": ("inferrsi.apps.storage.artifacts", "inferrsi.harness.artifact_primitives", "inferrsi.benchmark.artifacts"), - "write_json": ("inferrsi.apps.artifacts", "inferrsi.benchmark.artifacts"), - "atomic_write_json": ("inferrsi.apps.artifacts", "inferrsi.harness.atomic_json", + "write_json": ("inferrsi.apps.storage.artifacts", "inferrsi.benchmark.artifacts"), + "atomic_write_json": ("inferrsi.apps.storage.artifacts", "inferrsi.harness.atomic_json", "inferrsi.benchmark.artifacts"), - "digest": ("inferrsi.apps.artifacts", "inferrsi.harness.artifact_primitives"), - "file_lock": ("inferrsi.apps.artifacts", "inferrsi.harness.artifact_primitives"), + "digest": ("inferrsi.apps.storage.artifacts", "inferrsi.harness.artifact_primitives"), + "file_lock": ("inferrsi.apps.storage.artifacts", "inferrsi.harness.artifact_primitives"), } CONSTANTS = ("REPLACE_ATTEMPTS", "REPLACE_DELAY_SECONDS") VALUE = {"b": [1.5, None, True, 1e-07, 1e16], "a": "非 ASCII", "nested": {"z": 0.1 + 0.2}} diff --git a/tools/goal_checkpoint.py b/tools/goal_checkpoint.py index ca673dbbe..8c3a0ffc9 100644 --- a/tools/goal_checkpoint.py +++ b/tools/goal_checkpoint.py @@ -8,7 +8,7 @@ from pathlib import Path from typing import Literal -from inferrsi.apps.artifacts import digest, sha256 +from inferrsi.apps.storage.artifacts import digest, sha256 from tools.skill_eval_compare import CONTROLLERS, ROLES, ROOT, read_report Action = Literal[ diff --git a/tools/skill_eval_auto.py b/tools/skill_eval_auto.py index 3b6508046..ca6581b5f 100644 --- a/tools/skill_eval_auto.py +++ b/tools/skill_eval_auto.py @@ -11,7 +11,7 @@ from pathlib import Path from urllib.parse import quote -from inferrsi.apps.artifacts import write_json +from inferrsi.apps.storage.artifacts import write_json from tools import skill_eval_pr as pr from tools.skill_eval_budget import ( Binding, diff --git a/tools/skill_eval_cloud_export.py b/tools/skill_eval_cloud_export.py index 176551d85..c4a605a78 100644 --- a/tools/skill_eval_cloud_export.py +++ b/tools/skill_eval_cloud_export.py @@ -4,7 +4,7 @@ import json from pathlib import Path -from inferrsi.apps.artifacts import sha256 +from inferrsi.apps.storage.artifacts import sha256 from inferrsi.benchmark import skill_eval_engineering as engineering from inferrsi.harness import artifact_sandbox from tools import skill_eval_compare as compare diff --git a/tools/skill_eval_compare.py b/tools/skill_eval_compare.py index d622ce0a4..8530dfc7b 100644 --- a/tools/skill_eval_compare.py +++ b/tools/skill_eval_compare.py @@ -12,7 +12,6 @@ from dataclasses import replace from pathlib import Path -from inferrsi.apps.artifacts import atomic_write_json, sha256, write_json from inferrsi.apps.integrations.anthropic.anthropic_agent import ( FULL_CONTEXT_KIND, AnthropicAgentClient, @@ -21,6 +20,7 @@ ) from inferrsi.apps.integrations.anthropic.anthropic_agent import SOURCE as AGENT_SOURCE from inferrsi.apps.integrations.anthropic.request_guard import SOURCE as GUARD_SOURCE +from inferrsi.apps.storage.artifacts import atomic_write_json, sha256, write_json from inferrsi.apps.workflows import skill_eval_engineering as artifact_check from inferrsi.apps.workflows.skill_evaluation import export_bundle, run_trial, summarize from inferrsi.benchmark import skill_eval_diagnostic as diagnostic @@ -47,7 +47,7 @@ "src/inferrsi/harness/skill_evaluation.py", "src/inferrsi/harness/artifact_sandbox.py", "tools/skill_eval_snapshot.py", "src/inferrsi/harness/local_process.py", "src/inferrsi/harness/atomic_json.py", - "src/inferrsi/harness/input_binding.py", "src/inferrsi/apps/artifacts.py") + "src/inferrsi/harness/input_binding.py", "src/inferrsi/apps/storage/artifacts.py") EVIDENCE = ("execution.json", "agent/stdout.log", "agent/stderr.log", "verification/result.json", "verification/stdout.log", "verification/stderr.log") NUMBER = (int, float) diff --git a/tools/skill_eval_historical_job.py b/tools/skill_eval_historical_job.py index 6ca33d0a8..57b73056b 100644 --- a/tools/skill_eval_historical_job.py +++ b/tools/skill_eval_historical_job.py @@ -11,7 +11,7 @@ import urllib.request from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.benchmark import skill_eval_engineering as engineering from inferrsi.harness import artifact_sandbox from tools import skill_eval_auto as auto diff --git a/tools/skill_eval_improve.py b/tools/skill_eval_improve.py index eddc999bf..d6a858459 100644 --- a/tools/skill_eval_improve.py +++ b/tools/skill_eval_improve.py @@ -12,7 +12,7 @@ import time from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows.improvement import ( assessment, choose, diff --git a/tools/skill_eval_local.py b/tools/skill_eval_local.py index 8a5a74a4a..dce023d33 100644 --- a/tools/skill_eval_local.py +++ b/tools/skill_eval_local.py @@ -12,7 +12,7 @@ import stat from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows import skill_eval_engineering as artifact_check from inferrsi.benchmark import skill_eval_engineering as engineering from inferrsi.harness import artifact_sandbox diff --git a/tools/skill_eval_pilot.py b/tools/skill_eval_pilot.py index 844b96cd4..a1aefa3fb 100644 --- a/tools/skill_eval_pilot.py +++ b/tools/skill_eval_pilot.py @@ -7,7 +7,7 @@ import time from pathlib import Path -from inferrsi.apps.artifacts import sha256, write_json +from inferrsi.apps.storage.artifacts import sha256, write_json from inferrsi.apps.workflows.skill_evaluation import export_bundle, run_trial, summarize from inferrsi.harness.skill_evaluation import CodexClient from inferrsi.harness.usage import normalize_usage diff --git a/tools/skill_eval_pr.py b/tools/skill_eval_pr.py index 31ce3be21..628321fcb 100644 --- a/tools/skill_eval_pr.py +++ b/tools/skill_eval_pr.py @@ -14,8 +14,8 @@ from pathlib import Path, PurePosixPath from urllib.error import HTTPError -from inferrsi.apps.artifacts import sha256, write_json from inferrsi.apps.integrations.anthropic.anthropic_agent import money, reservation +from inferrsi.apps.storage.artifacts import sha256, write_json from tools import skill_eval_compare as compare from tools.check_knowledge_model_policy import GitHubHTTPError from tools.skill_eval_feedback import (