From 6fa2078e282b0e5297b6147e28fe054dde6b0f7c Mon Sep 17 00:00:00 2001 From: Zeng Chuang Date: Tue, 24 Nov 2026 17:38:29 +0800 Subject: [PATCH] feat(apps): capture frozen CPU evidence from the evaluation CLI Agent-assisted-by: Codex (author/integrator) Signed-off-by: zengchuang --- docs/apps-evaluate-cli.md | 24 +- docs/apps-module-migrations.json | 4 + src/inferrsi/apps/cli/evaluate.py | 16 +- .../apps/handoff/production_capture.py | 36 ++ tests/check_installed.py | 1 + tests/test_apps_evaluate_cli.py | 4 +- tests/test_apps_production_cli.py | 318 ++++++++++++++++++ 7 files changed, 394 insertions(+), 9 deletions(-) create mode 100644 src/inferrsi/apps/handoff/production_capture.py create mode 100644 tests/test_apps_production_cli.py diff --git a/docs/apps-evaluate-cli.md b/docs/apps-evaluate-cli.md index d188117ef..d228ea410 100644 --- a/docs/apps-evaluate-cli.md +++ b/docs/apps-evaluate-cli.md @@ -86,10 +86,26 @@ absolute local directory without symlink traversal. assessor reads only fixed retained evidence through Apps; it does not prepare a task, construct an execution target, launch a worker or access a network. -This first adapter exposes the production task family already supported by B -on main. It does not define a worker/profile or reinterpret frozen rules. -The separate real CPU profile delivery and full three-host integration remain -tracked by the parent Apps issue. +The [CPU smoke task](contracts/p1-cpu-smoke.md) supplies the worker and frozen +rules for the production example below. + +## Opt-in production evidence + +`evaluate execute --capture-evidence` composes the existing frozen P1 proof +projection with the Apps role reader and H capture lifecycle. Candidate and +report roles come from B-validated frozen metadata for its supported single +output recipe. B decides rules/proof content; H authenticates sources, retains +bytes and commits the record. Invalid UTF-8 and missing evidence retain their +existing separate claim outcomes. A source that H cannot capture keeps H's +zero-start fixed refusal and B can assess that record offline. + +The switch is host assembly outside the saved request and both configuration +schemas. Without it, the existing execution path remains. Projection setup +and artifact reads happen only inside H's fresh callback. Registered replay, +conflict and in-progress requests do not invoke it. Enabling capture for an +already registered attempt returns the original facts; it cannot add proofs +to an old record or authorize another worker run. A separate new execution +requires an explicitly allocated attempt under the existing H contract. ## Outputs, errors and replay diff --git a/docs/apps-module-migrations.json b/docs/apps-module-migrations.json index 2c82fca8a..ed71fbdc3 100644 --- a/docs/apps-module-migrations.json +++ b/docs/apps-module-migrations.json @@ -26,6 +26,7 @@ "src/inferrsi/apps/delivery/__init__.py", "src/inferrsi/apps/handoff/bridge.py", "src/inferrsi/apps/handoff/candidate_provider.py", + "src/inferrsi/apps/handoff/production_capture.py", "src/inferrsi/apps/storage/artifact_reader.py", "src/inferrsi/apps/views/attempt.py", "src/inferrsi/apps/workflows/benchmark_compare.py", @@ -37,6 +38,7 @@ "tests/test_apps_output.py", "tests/test_apps_port_validation.py", "tests/test_apps_prepare.py", + "tests/test_apps_production_cli.py", "tests/test_apps_publication.py", "tests/test_apps_replay.py", "tests/test_benchmark_assessment.py", @@ -62,6 +64,7 @@ "src/inferrsi/apps/artifact_reader.py", "src/inferrsi/apps/cli/evaluate.py", "src/inferrsi/apps/handoff/candidate_provider.py", + "src/inferrsi/apps/handoff/production_capture.py", "src/inferrsi/apps/views/attempt.py", "tests/check_installed.py", "tests/test_apps_artifact_reader.py", @@ -151,6 +154,7 @@ "tests/test_apps_execution_binding.py", "tests/test_apps_generation_plan.py", "tests/test_apps_module_migrations.py", + "tests/test_apps_production_cli.py", "tests/test_benchmark_assessment.py", "tests/test_benchmark_preparation.py", "tests/test_harness_entry_verification.py", diff --git a/src/inferrsi/apps/cli/evaluate.py b/src/inferrsi/apps/cli/evaluate.py index 86b36dbcb..cb50a7bef 100644 --- a/src/inferrsi/apps/cli/evaluate.py +++ b/src/inferrsi/apps/cli/evaluate.py @@ -27,6 +27,9 @@ def add_parser(commands) -> None: command.add_argument("--record-ref", help="@") command.add_argument("--scope") command.add_argument("--primary-claim") + if action == "execute": + command.add_argument("--capture-evidence", action="store_true", + help="Retain the configured frozen P1 task's evidence") def _object_file(path: Path) -> dict: @@ -89,7 +92,7 @@ def _prepare_ports(config: dict) -> dict: "validate_prepared": preparation.validate_prepared} -def _execute_ports(config: dict, storage: dict) -> dict: +def _execute_ports(config: dict, storage: dict, *, capture_evidence: bool = False) -> dict: from ...harness.api import Harness, LocalCpuTarget from ...harness.run_store import RunStore from ..storage.artifact_reader import ArtifactReader @@ -110,11 +113,17 @@ def _execute_ports(config: dict, storage: dict) -> dict: if item["namespace"] == storage["harness_namespace"]), None) if mount is None or mount["kind"] != "harness_sqlite": raise ValueError("execute requires the configured Harness SQLite mount") + capture = None + if capture_evidence: + from ..handoff.production_capture import PreparedCapture + + capture = PreparedCapture(storage) def execute(spec): # Opening a writable Store is an execution effect. Defer it until Apps # has verified the saved request/preparation, and preserve PublicError. - harness = Harness(RunStore.from_mount(mount), target, artifact_reader=reader) + harness = Harness(RunStore.from_mount(mount), target, artifact_reader=reader, + evidence_capture=capture) return harness.execute(spec) return {"execute_harness": execute} @@ -173,7 +182,8 @@ def dispatch(args) -> int: if args.evaluate_action == "prepare": ports = _prepare_ports(_runtime(args.runtime_config)) elif args.evaluate_action == "execute": - ports = _execute_ports(_runtime(args.runtime_config), storage) + ports = _execute_ports(_runtime(args.runtime_config), storage, + capture_evidence=args.capture_evidence) else: # Offline assessment ignores target/worker configuration entirely. ports = _assess_ports() diff --git a/src/inferrsi/apps/handoff/production_capture.py b/src/inferrsi/apps/handoff/production_capture.py new file mode 100644 index 000000000..5d99a31cd --- /dev/null +++ b/src/inferrsi/apps/handoff/production_capture.py @@ -0,0 +1,36 @@ +"""Compose the frozen B projection only when H invokes fresh evidence capture.""" + +from copy import deepcopy + +from ...harness.errors import PublicError +from ..storage.archive import read_prepared +from ..storage.artifact_reader import ArtifactReader +from .evidence_capture import EvidenceCapture + + +class PreparedCapture: + """Trusted host adapter; constructing it performs no task or artifact reads.""" + + def __init__(self, storage_config: dict): + self._storage = deepcopy(storage_config) + + def capture(self, phase, facts, *, artifacts): + # H never invokes this callback for registered replay/conflict/in-progress. + from ...benchmark.proofs import ProofError, ProofProjector + + prepared = read_prepared(self._storage, facts["prepared_ref"]) + reader = ArtifactReader(self._storage) + with reader.open(prepared["protocol"]) as stream: + protocol = stream.read() + try: + projector = ProofProjector(prepared, protocol) + # B's supported P1 validator fixes the single-output recipe. Apps + # takes role names from that validated metadata, not task names. + adapter = EvidenceCapture( + projector.project, + candidate_role=prepared["candidate_contract"]["input_role"], + report_role=prepared["recipe"]["outputs"][0]["role"], + ) + return adapter.capture(phase, facts, artifacts=artifacts) + except ProofError as error: + raise PublicError(error.code, stage="evidence_capture", message=str(error)) from error diff --git a/tests/check_installed.py b/tests/check_installed.py index fbee93754..78eda6163 100644 --- a/tests/check_installed.py +++ b/tests/check_installed.py @@ -800,6 +800,7 @@ def _inventory(root, prefix): capture_output=True, text=True, check=True, ) assert "--request" in help_result.stdout and "--output-id" in help_result.stdout + assert ("--capture-evidence" in help_result.stdout) == (evaluate_action == "execute") for canonical in ("inferrsi.apps.views.summary_chart", "inferrsi.apps.workflows.benchmark_operations", "inferrsi.apps.integrations.mindie.project", diff --git a/tests/test_apps_evaluate_cli.py b/tests/test_apps_evaluate_cli.py index 2f7a5937a..d208fa8dd 100644 --- a/tests/test_apps_evaluate_cli.py +++ b/tests/test_apps_evaluate_cli.py @@ -286,9 +286,9 @@ def test_request_cannot_supply_runtime_authority(evaluation, tmp_path, capsys, m configured = [] original = cli._execute_ports - def observe(trusted, storage): + def observe(trusted, storage, **options): configured.append(deepcopy(trusted)) - return original(trusted, storage) + return original(trusted, storage, **options) monkeypatch.setattr(cli, "_execute_ports", observe) command = arguments(tmp_path, "execute", request, config, runtime) diff --git a/tests/test_apps_production_cli.py b/tests/test_apps_production_cli.py new file mode 100644 index 000000000..b78447201 --- /dev/null +++ b/tests/test_apps_production_cli.py @@ -0,0 +1,318 @@ +"""Exercise opt-in evidence capture through the saved-request CLI on a real CPU task.""" + +import json +import sqlite3 +from copy import deepcopy +from hashlib import sha256 +from pathlib import Path + +import pytest + +from inferrsi.apps import api +from inferrsi.apps.cli import main +from inferrsi.apps.handoff.bridge import bind_execution +from inferrsi.apps.handoff.production_capture import PreparedCapture +from inferrsi.apps.storage import archive +from inferrsi.apps.storage.archive import read_prepared, read_result +from inferrsi.benchmark import cpu_smoke, proofs +from inferrsi.benchmark.workers import fixture_worker as worker +from inferrsi.contracts.json_v1 import decode, encode +from inferrsi.harness import execution_service, run_store +from tests.test_apps_evaluate_cli import arguments, save + +ROOT = Path(__file__).resolve().parents[1] + + +@pytest.fixture(params=["correct", "wrong", "invalid-utf8", "missing"]) +def production_cli(tmp_path, request, capsys): + for name in ("archive", "controller", "modules"): + (tmp_path / name).mkdir() + code = tmp_path / "modules/fixture_worker.py" + code.write_bytes(cpu_smoke.worker_source()) + protocol = cpu_smoke.protocol(code.read_bytes(), + control_domain=execution_service._CONTROL_DOMAIN) + config = {"schema_version": 1, "archive_namespace": "apps", "harness_namespace": "test", + "mounts": [{"kind": "directory", "namespace": "apps", "prefix": "archives/local", + "root": str(tmp_path / "archive")}, + {"kind": "harness_sqlite", "namespace": "test", "prefix": "stores/test", + "root": str(tmp_path / "store")}]} + runtime = {"schema_version": 1, "benchmark": { + "protocol": str(save(tmp_path, "protocol.json", protocol)), "worker_role": "worker-code", + "resources": {"worker-code": str(code), "baseline-code": str(code)}, + }, "target": {"target_id": "fixture-cpu", "config_revision": "1", + "work_root": str(tmp_path / "work"), "module_root": str(tmp_path / "modules"), + "controller_root": str(tmp_path / "controller")}} + prepare_request = {"schema_version": 1, "request": cpu_smoke.default_request()} + assert main(arguments(tmp_path, "prepare", prepare_request, config, runtime, + output="prepare")) == 0 + capsys.readouterr() + prepared = read_result(tmp_path, "prepare") + assert not (tmp_path / "store").exists() + kind = request.param + candidate = {"correct": str(sum(worker.INPUT_BYTES)).encode("ascii") + b"\n", + "wrong": b"wrong\n", "invalid-utf8": b"\xff\n", "missing": b"wrong\n"}[kind] + if kind != "missing": + (tmp_path / "controller/candidate.txt").write_bytes(candidate) + seed = decode((ROOT / "tests/fixtures/harness-prepared-binding/d023-null-timeout.json") + .read_bytes()) + attempt = run_store.allocate_attempt(**{key: seed[key] for key in ( + "run_id", "owner", "target_request", "deadline_utc", "resources", "budget", + "retry_of", "retry_reason", + )}) + proposal = {key: deepcopy(seed[key]) + for key in ("candidate", "inputs", "generation_record_ref")} + proposal["inputs"][0].update(source="candidate.txt", source_namespace="controller", + source_ref=None, expected_sha256=sha256(candidate).hexdigest()) + saved = {"schema_version": 1, "prepared_ref": prepared.result["prepared_ref"], + "attempt": attempt, "proposal": proposal, + "output_root": "evaluation/" + attempt["attempt_id"]} + (tmp_path / "original-execute.json").write_bytes(encode(saved)) + command = arguments(tmp_path, "execute", saved, config, runtime, output="execute") + assert main(command + ["--capture-evidence"]) == (3 if kind == "missing" else 0) + capsys.readouterr() + executed = read_result(tmp_path, "execute") + assessment = {"schema_version": 1, "record_ref": executed.result["record_ref"], + "primary_scope": "p1", "primary_claim_id": "C"} + expected = (["INCONCLUSIVE"] * 3 if kind == "missing" else + ["FAIL" if kind == "invalid-utf8" else "PASS", + "PASS" if kind == "correct" else "FAIL", "PASS"]) + expected_exit = {"PASS": 0, "FAIL": 8, "INCONCLUSIVE": 9}[expected[1]] + assert main(arguments(tmp_path, "assess", assessment, config, output="assess")) == expected_exit + capsys.readouterr() + assessed = read_result(tmp_path, "assess") + assert [claim["verdict"] for claim in assessed.result["assessment"]["claims"]] == expected + return {"pair": (config, run_store.RunStore(tmp_path / "store", "test"), prepared, executed, + assessed, expected), "saved": saved, "runtime": runtime, "kind": kind} + + +def test_real_cli_claims_and_views_share_the_fixed_pair(production_cli, tmp_path, capsys): + config, store, _, executed, assessed, verdicts = production_cli["pair"] + ref, decision = executed.result["record_ref"], assessed.result["assessment_ref"] + flags = ["--record-ref", str(save(tmp_path, "record-ref.json", ref)), + "--assessment-ref", str(save(tmp_path, "assessment-ref.json", decision)), + "--storage-config", str(save(tmp_path, "views-storage.json", config))] + before = store.committed(ref["attempt_id"]) + expected = api.read_attempt_view(ref, storage_config=config, assessment_ref=decision) + for command in ("status", "trace"): + assert main([command, *flags]) == 0 + view = json.loads(capsys.readouterr().out) + assert view["record_ref"] == expected["record_ref"] == ref + assert view["assessment_ref"] == decision + assert view["execution"]["attempt_id"] == ref["attempt_id"] + assert [claim["verdict"] for claim in view["assessment"]["claims"]] == verdicts + for command in ("report", "dashboard"): + path = tmp_path / (command + ".html") + assert main([command, *flags, "--output", str(path)]) == 0 + capsys.readouterr() + document = path.read_text(encoding="utf-8") + assert ref["artifact"]["sha256"] in document + assert decision["artifact"]["sha256"] in document + after = store.committed(ref["attempt_id"]) + assert before.payload_bytes == after.payload_bytes + assert decode((tmp_path / "original-execute.json").read_bytes()) == production_cli["saved"] + + +def test_registered_cli_replay_never_builds_projection_or_recaptures( + production_cli, tmp_path, capsys, monkeypatch, +): + case = production_cli + config, store, _, executed, _, _ = case["pair"] + count_before = store.committed(executed.result["attempt_id"]) + runtime = deepcopy(case["runtime"]) + runtime["target"].update(target_id="retired", config_revision="2", module_root=None) + + def never(*args, **kwargs): + pytest.fail("registered replay built a projection, recaptured evidence or started a worker") + + monkeypatch.setattr(PreparedCapture, "capture", never) + monkeypatch.setattr(proofs.ProofProjector, "__init__", never) + monkeypatch.setattr(execution_service.local_process, "_supervise", never) + assert main(arguments(tmp_path, "execute", case["saved"], config, runtime, + output="replay") + ["--capture-evidence"]) == executed.result["exit_code"] + result = json.loads(capsys.readouterr().out) + assert result["record_ref"] == executed.result["record_ref"] + after = store.committed(executed.result["attempt_id"]) + assert after.payload_bytes == count_before.payload_bytes + with sqlite3.connect(store.root / run_store.INDEX_NAME) as connection: + assert connection.execute("SELECT count(*) FROM attempts").fetchone()[0] == 1 + assert connection.execute("SELECT count(*) FROM records").fetchone()[0] == 1 + + +def new_attempt(case): + saved = deepcopy(case["saved"]) + original = saved["attempt"] + saved["attempt"] = run_store.allocate_attempt(**{key: original[key] for key in ( + "run_id", "owner", "target_request", "deadline_utc", "resources", "budget", + "retry_of", "retry_reason", + )}) + saved["output_root"] = "evaluation/" + saved["attempt"]["attempt_id"] + return saved + + +@pytest.mark.parametrize("production_cli", ["correct"], indirect=True) +@pytest.mark.parametrize("code", ["InvalidRequest", "UnsupportedSchema", "UnsupportedRuleVersion"]) +def test_declared_projection_error_keeps_existing_postregistration_refusal( + production_cli, tmp_path, capsys, monkeypatch, code, +): + case = production_cli + config, store, _, _, _, _ = case["pair"] + saved = new_attempt(case) + + def reject(*args, **kwargs): + raise proofs.ProofError(code, "controlled declared B projection refusal") + + monkeypatch.setattr(proofs.ProofProjector, "__init__", reject) + monkeypatch.setattr(execution_service.local_process, "_supervise", + lambda *a, **k: pytest.fail("rejected capture started a worker")) + assert main(arguments(tmp_path, "execute", saved, config, case["runtime"], + output="rejected") + ["--capture-evidence"]) == 3 + result = json.loads(capsys.readouterr().out) + assert result["execution"]["started"] is False + assert result["execution"]["process_outcome"] == "not_started" + assert result["record_ref"] == store.read(saved["attempt"]["attempt_id"])["record_ref"] + assert any(error["code"] == code for error in result["execution"]["errors"]) + + +@pytest.mark.parametrize("production_cli", ["correct"], indirect=True) +def test_enabling_capture_on_registered_attempt_never_retrofits_proofs( + production_cli, tmp_path, capsys, monkeypatch, +): + case = production_cli + config, _, _, _, _, _ = case["pair"] + saved = new_attempt(case) + assert main(arguments(tmp_path, "execute", saved, config, case["runtime"], + output="uncaptured")) == 0 + original = json.loads(capsys.readouterr().out) + assert not {"format", "grader", "samples", "cleanup"} & { + check["check_id"] for check in original["execution"]["checks"] + } + + def forbidden(*args, **kwargs): + pytest.fail("changing host assembly attempted to retrofit a registered record") + + monkeypatch.setattr(PreparedCapture, "capture", forbidden) + monkeypatch.setattr(proofs.ProofProjector, "__init__", forbidden) + assert main(arguments(tmp_path, "execute", saved, config, case["runtime"], + output="late-opt-in") + ["--capture-evidence"]) == 0 + replay = json.loads(capsys.readouterr().out) + assert replay["record_ref"] == original["record_ref"] + assert replay["execution"]["checks"] == original["execution"]["checks"] + + +@pytest.mark.parametrize("production_cli", ["correct"], indirect=True) +def test_conflict_and_live_attempt_never_invoke_fresh_capture( + production_cli, tmp_path, capsys, monkeypatch, +): + case = production_cli + config, store, _, executed, _, _ = case["pair"] + + def never(*args, **kwargs): + pytest.fail("registered state invoked fresh capture, projection or worker") + + monkeypatch.setattr(PreparedCapture, "capture", never) + monkeypatch.setattr(proofs.ProofProjector, "__init__", never) + monkeypatch.setattr(execution_service.local_process, "_supervise", never) + changed = deepcopy(case["saved"]) + changed["attempt"]["deadline_utc"] = "2098-01-01T00:00:00Z" + assert main(arguments(tmp_path, "execute", changed, config, case["runtime"], + output="conflict") + ["--capture-evidence"]) == 2 + result = json.loads(capsys.readouterr().out) + assert result["reason_code"] == "RequestConflict" and result["error"]["stage"] == "claim" + saved = new_attempt(case) + spec = bind_execution(saved, read_prepared(config, saved["prepared_ref"])) + with store.claim(saved["attempt"], run_store.request_digest(spec)): + assert main(arguments(tmp_path, "execute", saved, config, case["runtime"], + output="live") + ["--capture-evidence"]) == 4 + result = json.loads(capsys.readouterr().out) + assert result["reason_code"] == "AttemptInProgress" + assert store.read(executed.result["attempt_id"])["record_ref"] == executed.result["record_ref"] + + +@pytest.mark.parametrize("action", ["prepare", "assess"]) +def test_capture_flag_is_execute_only(tmp_path, monkeypatch, action): + from inferrsi.apps.cli import evaluate as cli + + monkeypatch.setattr(cli, "dispatch", lambda *a: pytest.fail("invalid flag reached a port")) + command = arguments(tmp_path, action, {}, {}, {"schema_version": 1}) + with pytest.raises(SystemExit) as error: + main(command + ["--capture-evidence"]) + assert error.value.code == 2 + + +@pytest.mark.parametrize("production_cli", ["correct"], indirect=True) +@pytest.mark.parametrize("after_publication", [False, True]) +def test_production_cli_publication_failure_preserves_refs_and_original_attempt( + production_cli, tmp_path, capsys, monkeypatch, after_publication, +): + case = production_cli + config, store, _, _, _, _ = case["pair"] + saved = new_attempt(case) + request_bytes = encode(saved) + output_id = "uncertain" if after_publication else "unpublished" + command = arguments(tmp_path, "execute", saved, config, case["runtime"], output=output_id) + output = tmp_path / "output" / output_id + original_publish = archive._publish_directory + original_sync = archive._sync_directory + + def fail_publish(source, destination): + if destination == output: + raise OSError("controlled pre-publication failure") + return original_publish(source, destination) + + def fail_durability(directory): + if directory == output.parent and output.is_dir(): + raise OSError("controlled post-publication durability failure") + return original_sync(directory) + + with monkeypatch.context() as fault: + if after_publication: + fault.setattr(archive, "_sync_directory", fail_durability) + else: + fault.setattr(archive, "_publish_directory", fail_publish) + assert main(command + ["--capture-evidence"]) == 6 + failed = json.loads(capsys.readouterr().out) + ref = failed["record_ref"] + committed = store.committed(saved["attempt"]["attempt_id"]) + assert ref == committed.record_ref == failed["error"]["latest_record_ref"] + assert failed["execution"]["started"] is True + assert {"format", "grader", "samples", "cleanup"} <= { + check["check_id"] for check in failed["execution"]["checks"] + } + assert output.exists() is after_publication + published_bytes = None + if after_publication: + assert "uncertain" in failed["error"]["message"].lower() + published = read_result(tmp_path, output_id) + assert published.result["exit_code"] == 0 + assert published.result["record_ref"] == ref + published_bytes = {name: (output / name).read_bytes() + for name in ("result.json", "manifest.json")} + + # Once committed, a failed output publication cannot re-run the task, even + # with its source gone and the configured target retired. + (tmp_path / "controller/candidate.txt").unlink() + runtime = deepcopy(case["runtime"]) + runtime["target"].update(target_id="retired", config_revision="2", module_root=None) + + def never(*args, **kwargs): + pytest.fail("publication recovery recaptured evidence, allocated or ran a worker") + + monkeypatch.setattr(PreparedCapture, "capture", never) + monkeypatch.setattr(proofs.ProofProjector, "__init__", never) + monkeypatch.setattr(run_store, "allocate_attempt", never) + monkeypatch.setattr(execution_service.local_process, "_supervise", never) + retry = arguments(tmp_path, "execute", saved, config, runtime, output=output_id) + assert main(retry + ["--capture-evidence"]) == (6 if after_publication else 0) + retried = json.loads(capsys.readouterr().out) + assert retried["record_ref"] == ref + if after_publication: + assert published_bytes == {name: (output / name).read_bytes() + for name in ("result.json", "manifest.json")} + retry = arguments(tmp_path, "execute", saved, config, runtime, output="recovered") + assert main(retry + ["--capture-evidence"]) == 0 + assert json.loads(capsys.readouterr().out)["record_ref"] == ref + assert encode(saved) == request_bytes + assert store.committed(ref["attempt_id"]).payload_bytes == committed.payload_bytes + with sqlite3.connect(store.root / run_store.INDEX_NAME) as connection: + assert connection.execute("SELECT count(*) FROM attempts").fetchone()[0] == 2 + assert connection.execute("SELECT count(*) FROM records").fetchone()[0] == 2