Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def _run_probe(
) -> None:
env = os.environ.copy()
env["PYTHONPATH"] = str(source_root)
# This subprocess starts Python directly and pins product imports through
# PYTHONPATH. Do not inherit the invoking launcher's release identity: that
# would mix a base probe with head assets. Setting it to source_root is also
# wrong here because rendered recovery commands would expose two different
# checkout paths and turn path length into a false output regression.
env.pop("LOOPX_RELEASE_ROOT", None)
# Both revisions measure the same fixture, including implicit machine
# defaults. Never let the operator's registry/configuration select a host.
stable_root = budget_fixture_path(fixture_root)
Expand Down
34 changes: 34 additions & 0 deletions tests/control_plane/test_cli_output_differential.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,40 @@ def test_probe_process_failure_preserves_utf8_diagnostics(tmp_path):
)


def test_probe_process_isolates_release_root_from_invoking_checkout(
tmp_path, monkeypatch,
):
import runpy
from pathlib import Path

smoke = runpy.run_path(str(
Path(__file__).resolve().parents[2]
/ "examples/control_plane/cli-output-base-head-differential-smoke.py"
))
source_root = tmp_path / "pinned-base"
inherited_root = tmp_path / "candidate-head"
observed = {}

def capture_run(command, *, cwd, env=None):
observed.update({"command": command, "cwd": cwd, "env": env})

monkeypatch.setenv("LOOPX_RELEASE_ROOT", str(inherited_root))
monkeypatch.setitem(smoke["_run_probe"].__globals__, "_run", capture_run)
smoke["_run_probe"](
source_root=source_root,
probe_runner=tmp_path / "probe-runner.py",
probe_test=tmp_path / "probe-test.py",
semantics_source=tmp_path / "semantics.py",
fixture_root=tmp_path / "fixture",
receipt_path=tmp_path / "receipt.json",
cwd=tmp_path,
enforce_budget=False,
)

assert observed["env"]["PYTHONPATH"] == str(source_root)
assert "LOOPX_RELEASE_ROOT" not in observed["env"]


def _row(**overrides: object) -> dict[str, object]:
row: dict[str, object] = {
"row_id": "surface/status/small/json",
Expand Down
1 change: 0 additions & 1 deletion tests/control_plane/test_contract_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from canonical_authority_fixture import initialize_canonical_source_fixture
from loopx.cli_runtime import report_json_text
from loopx.paths import display_report_text
from loopx.contract import check_contract, display_report_value
from loopx.control_plane.goals.contract_health import (
contract_error_diagnostic,
Expand Down
Loading