fix(827): isolate D4 lease broker fixture
This commit is contained in:
@@ -223,6 +223,9 @@ export default function register(pi: ExtensionAPI): void {
|
||||
def assert_d4(records: list[dict[str, Any]]) -> dict[str, object]:
|
||||
lifecycle = [record for record in records if record.get("event") == "runtime_generation_bump"]
|
||||
promotion = next(record for record in records if record.get("event") == "probe_lease_promoted")
|
||||
launcher_registration = next(
|
||||
record for record in records if record.get("event") == "lease_anchor_registered"
|
||||
)
|
||||
reload_revoke = next(
|
||||
record
|
||||
for record in lifecycle
|
||||
@@ -250,7 +253,7 @@ def assert_d4(records: list[dict[str, Any]]) -> dict[str, object]:
|
||||
|
||||
identities = {
|
||||
(record["peercred"]["pid"], record["starttime_ticks"])
|
||||
for record in [*lifecycle, promotion, *authorization]
|
||||
for record in [*lifecycle, promotion, launcher_registration, *authorization]
|
||||
}
|
||||
assert len(identities) == 1, f"same Pi PID/starttime did not persist: {identities}"
|
||||
|
||||
@@ -262,6 +265,7 @@ def assert_d4(records: list[dict[str, Any]]) -> dict[str, object]:
|
||||
assert {"startup", "reload", "fork", "new", "resume"} <= observed_reasons, (
|
||||
f"missing lifecycle boundary: {observed_reasons}"
|
||||
)
|
||||
assert launcher_registration.get("session_id_shape") == "hex-256"
|
||||
assert reload_revoke.get("prior_lease") == "VERIFIED"
|
||||
assert reload_revoke.get("prior_lease_revoked") is True
|
||||
assert current_authorization.get("code") == "MUTATOR_UNVERIFIED"
|
||||
@@ -271,6 +275,7 @@ def assert_d4(records: list[dict[str, Any]]) -> dict[str, object]:
|
||||
"same_pid_starttime": next(iter(identities)),
|
||||
"generations": generations,
|
||||
"reload_revoke_verified": True,
|
||||
"lease_anchor_fixture": True,
|
||||
"new_generation_code": "MUTATOR_UNVERIFIED",
|
||||
"superseded_generation_code": "STALE_GENERATION",
|
||||
}
|
||||
@@ -303,9 +308,14 @@ def run_once(index: int) -> Path:
|
||||
)
|
||||
wait_path(socket_path)
|
||||
environment = os.environ.copy()
|
||||
# Do not let the gated launcher inherit or fall back to its live/default
|
||||
# broker. Both its registration handshake and D4 lifecycle use this one
|
||||
# per-run p3 fixture socket; there is no second broker.
|
||||
environment.pop("MOSAIC_LEASE_BROKER_SOCKET", None)
|
||||
environment.update(
|
||||
{
|
||||
"D4_GENERATION_SOCKET": str(socket_path),
|
||||
"MOSAIC_LEASE_BROKER_SOCKET": str(socket_path),
|
||||
"D4_PI_LOG": str(pi_log),
|
||||
"MOSAIC_PI_FORCE_SKILLS": "",
|
||||
"PI_SKIP_VERSION_CHECK": "1",
|
||||
|
||||
Reference in New Issue
Block a user