Refuse stale installed owner packages despite matching version metadata
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
tegwick 2026-09-09 23:02:29 +02:00
parent be42de7caf
commit 7a61383e59
4 changed files with 86 additions and 3 deletions

View file

@ -69,3 +69,30 @@ def test_owner_build_requires_matching_sibling_lock_before_output(tmp_path, monk
with pytest.raises(ValueError, match="does not match"):
builder.build(output, rein, llm, owner_runtime=True)
assert not output.exists()
@pytest.mark.parametrize("change", [None, "stale", "missing", "extra"])
def test_installed_package_contents_must_match_committed_source(tmp_path, change):
import subprocess
source = tmp_path / "source"
package = source / "fixture"
package.mkdir(parents=True)
(package / "__init__.py").write_text("VERSION = 2\n")
subprocess.run(["git", "init", "-q", str(source)], check=True)
subprocess.run(["git", "-C", str(source), "add", "fixture"], check=True)
site = tmp_path / "site"
installed = site / "fixture"
installed.mkdir(parents=True)
(installed / "__init__.py").write_text("VERSION = 2\n")
if change == "stale":
(installed / "__init__.py").write_text("VERSION = 1\n")
elif change == "missing":
(installed / "__init__.py").unlink()
elif change == "extra":
(installed / "retired.py").write_text("old = True\n")
if change:
with pytest.raises(ValueError, match="owner package"):
builder.verify_source_files(site, [(source, "fixture", "fixture")])
else:
result = builder.verify_source_files(site, [(source, "fixture", "fixture")])
assert result["files_verified"] == 1