import json from pathlib import Path import subprocess import sys SCRIPT = Path(__file__).parents[1] / "scripts/security_flow_report.py" def workplan(root, repo, task): directory = root / repo / "workplans" directory.mkdir(parents=True, exist_ok=True) (directory / "test.md").write_text( "---\nstatus: active\nflavor: implementation\n---\n\n" "## Work\n\n```task\n" + task + "\n```\n" ) def report(root): return json.loads(subprocess.check_output( [sys.executable, str(SCRIPT), "--root", str(root), "--json"], text=True )) def test_default_estate_observes_activity_owner_dependency(tmp_path): workplan(tmp_path, "railiance-platform", "id: RPF-WP-0048-T02\nstatus: wait\npriority: high\n" "depends_on: [ACTIVITY-WP-0041-T03]") workplan(tmp_path, "activity-core", "id: ACTIVITY-WP-0041-T03\nstatus: todo\npriority: high") waiting = report(tmp_path) assert [t["id"] for t in waiting["READY"]] == ["ACTIVITY-WP-0041-T03"] assert waiting["UNBLOCKED"] == [] workplan(tmp_path, "activity-core", "id: ACTIVITY-WP-0041-T03\nstatus: done\npriority: high") assert [t["id"] for t in report(tmp_path)["UNBLOCKED"]] == ["RPF-WP-0048-T02"] def test_default_estate_includes_custodian_and_explains_human_gate(tmp_path): workplan(tmp_path, "the-custodian", "id: CUST-WP-0079-T05\nstatus: progress\npriority: medium") workplan(tmp_path, "policy-nexus", "id: PNEX-WP-0006-T01\nstatus: wait\npriority: high\n" 'needs_human: true\nintervention_note: "Public publication in daily batch"') result = report(tmp_path) assert [t["id"] for t in result["READY"]] == ["CUST-WP-0079-T05"] assert result["ATTENDED"][0]["reason"] == "Public publication in daily batch" assert result["UNBLOCKED"] == []