fix(runtime): fold native execution into shared containment (ODY-152)

This commit is contained in:
Alexandre Teixeira
2026-10-01 20:59:49 +01:00
parent 1d0944d47d
commit 9bb2424e65
10 changed files with 332 additions and 155 deletions
+23
View File
@@ -165,6 +165,7 @@ def test_a_gone_leader_with_a_live_group_is_reported_not_killed(
def test_a_verified_grant_is_torn_down_normally(grant_store, monkeypatch):
seed_grant()
verdicts(monkeypatch, {4242: process_ownership.OWNED})
monkeypatch.setattr(containment, "_pgid_of", lambda pid: 4242)
signals = []
monkeypatch.setattr(
containment, "_signal_tree",
@@ -179,6 +180,28 @@ def test_a_verified_grant_is_torn_down_normally(grant_store, monkeypatch):
assert outcome.ownership == ""
def test_verified_leader_does_not_authorize_a_different_group(grant_store, monkeypatch):
seed_grant(pgid=9999)
verdicts(monkeypatch, {4242: process_ownership.OWNED})
monkeypatch.setattr(containment, "_pgid_of", lambda pid: 4242)
monkeypatch.setattr(containment, "_signal_tree", lambda *args: pytest.fail("foreign group signalled"))
outcome = containment.reap_record(grant_store()["grant-1"])
assert outcome.dead is False
assert outcome.ownership == process_ownership.UNVERIFIABLE
def test_reaper_retains_a_group_after_its_leader_dies(grant_store, monkeypatch):
from src import process_reaper
seed_grant()
verdicts(monkeypatch, {4242: process_ownership.GONE})
monkeypatch.setattr(containment, "_group_present", lambda pgid: True)
monkeypatch.setattr(containment, "_signal_tree", lambda *args: pytest.fail("unidentified group signalled"))
report = process_reaper.reap_containment_grants()
assert report["failed"] == 1
assert report["already_gone"] == 0
assert "grant-1" in grant_store()
def test_an_in_process_grant_is_not_subjected_to_the_gate(monkeypatch, tmp_path):
"""A grant carrying its own pid belongs to the caller holding it.