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 @@ -8,6 +8,7 @@

from loopx.status import collect_status
from loopx.control_plane.todos.list_readback import list_goal_todos
from loopx.control_plane.testing.canary_harness import import_fixture_authority


def main() -> None:
Expand Down Expand Up @@ -36,11 +37,13 @@ def main() -> None:
"goals": [{"id": "progress-projection", "repo": str(root), "state_file": state.name,
"domain": "general", "status": "active", "authority_sources": [],
"adapter": {"kind": "test_v0", "status": "connected-read-only"}}]}), encoding="utf-8")
# Status reads canonical authority; Markdown is only this fixture's input.
import_fixture_authority(registry, "progress-projection")
payload = collect_status(registry_path=registry, runtime_root_override=str(root / "runtime"),
limit=5)
item = next(item for item in payload["attention_queue"]["items"] if item["goal_id"] == "progress-projection")
assert item["user_todos"]["open_count"] == 21
assert len(item["user_todos"]["items"]) == 12
assert len(item["user_todos"]["items"]) == 21
assert item["project_asset"]["user_todos"]["open"] == 21
assert len(item["project_asset"]["user_todos"]["items"]) == 3
if args.full:
Expand Down
4 changes: 2 additions & 2 deletions examples/personal-workspace-browser/goal-masthead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ export const goalMastheadScenario = {
await quiet.close();
throw error;
}
// The real producer bounds the queue to 12 and its overview to three while
// retaining 21 open decisions. Pass its payload through the shipped parser
// The canonical producer retains 21 open decisions and bounds its overview
// to three. Pass its payload through the shipped parser
// and adapter, rather than manufacturing a complete three-item queue.
const fixtureEnv = { ...process.env, LOOPX_USAGE_PING: "0" };
if (!["LOOPX_TEST_PYTHON", "LOOPX_PYTHON_BIN", "LOOPX_PYTHON"].some(key => process.env[key])) fixtureEnv.PYTHONPATH = repoRoot;
Expand Down
6 changes: 4 additions & 2 deletions tests/extensions/test_process_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,26 +160,28 @@ def reap(*, timeout):


def test_windows_exited_leader_does_not_certify_descendant_cleanup(monkeypatch):
monkeypatch.setattr(process_runtime.time, "monotonic", lambda: 0.0)
process = Mock(spec=subprocess.Popen)
process.poll.return_value = 0
taskkill = Mock()
monkeypatch.setattr(subprocess, "Popen", taskkill)
with pytest.raises(RuntimeError, match="unconfirmed after leader exit"):
process_runtime._force_terminate_windows_process_tree(process, time.monotonic() + .1)
process_runtime._force_terminate_windows_process_tree(process, .1)
taskkill.assert_not_called()
process.kill.assert_not_called()
assert 0 <= process.wait.call_args.kwargs["timeout"] <= .1


def test_windows_force_cleanup_cannot_accept_an_unreaped_receiver(monkeypatch):
monkeypatch.setattr(process_runtime.time, "monotonic", lambda: 0.0)
process = Mock(spec=subprocess.Popen)
helper = Mock(spec=subprocess.Popen)
helper.wait.return_value, helper.poll.return_value = 0, 0
process.pid, process.poll.return_value = 12345, None
monkeypatch.setattr(subprocess, "Popen", Mock(return_value=helper))
process.wait.side_effect = subprocess.TimeoutExpired("native", .1)
with pytest.raises(subprocess.TimeoutExpired):
process_runtime._force_terminate_windows_process_tree(process, time.monotonic() + .1)
process_runtime._force_terminate_windows_process_tree(process, .1)
process.wait.assert_called_once()
assert 0 <= process.wait.call_args.kwargs["timeout"] <= .1

Expand Down
Loading