fix(runtime): verify namespace init death and record Wave 3-S validation

This commit is contained in:
Alexandre Teixeira
2026-10-01 23:17:01 +01:00
parent 0dec375631
commit 57143a14ba
7 changed files with 720 additions and 37 deletions
+8
View File
@@ -1,5 +1,7 @@
"""Captured spawns exercise the production runner without signalling fake PIDs."""
import asyncio
import json
import os
from types import SimpleNamespace
from src import containment
@@ -13,6 +15,9 @@ def capture_owned_spawn(monkeypatch, tmp_path):
async def fake_exec(*argv, **kwargs):
captured.update(argv=argv, kwargs=kwargs, command=argv[-1])
if "--info-fd" in argv:
fd = int(argv[argv.index("--info-fd") + 1])
os.write(fd, json.dumps({"child-pid": 99999998}).encode())
stdout = asyncio.StreamReader()
if "ody-boundary" in argv:
stdout.feed_data((argv[argv.index("ody-boundary") + 1] + "\n").encode())
@@ -33,6 +38,9 @@ def capture_owned_spawn(monkeypatch, tmp_path):
return containment.ReleaseOutcome(dead=True, escalated=False)
monkeypatch.setattr(asyncio, "create_subprocess_exec", fake_exec)
real_capture = containment.process_ownership.capture
monkeypatch.setattr(containment.process_ownership, "capture", lambda pid:
{"pid": pid, "start_token": "captured-fake"} if pid in (99999998, 99999999) else real_capture(pid))
if hasattr(containment.os, "pidfd_open"):
monkeypatch.delattr(containment.os, "pidfd_open")
monkeypatch.setattr(containment, "_release_awaited", release)