Coordination is a view, not topology. Open workplans and wait tasks project into graph-explorer; citation edges recover depends_on from task prose. UI: /ui/graph-explorer?mode=coordination. Assistant: grok Assistant-Session: 01a09dc1-b21e-77e1-919e-fcad2f82b267
58 lines
2.1 KiB
Python
58 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
from railiance_fabric.coordination_graph import coordination_graph_payload
|
|
from railiance_fabric.graph_explorer import fabric_graph_explorer_manifest
|
|
from railiance_fabric.schema_validation import draft202012_validator
|
|
|
|
|
|
def _validate_schema(name: str, document: dict) -> None:
|
|
from pathlib import Path
|
|
|
|
schema_path = Path("schemas") / name
|
|
validator = draft202012_validator(schema_path)
|
|
validator.validate(document)
|
|
|
|
|
|
def test_coordination_payload_filters_open_records_and_cites_wait() -> None:
|
|
workplans = [
|
|
{"id": "wp-a", "slug": "cust-wp-0071", "title": "Sizing", "status": "active"},
|
|
{"id": "wp-b", "slug": "rapps-wp-0014", "title": "Pilot", "status": "active"},
|
|
{"id": "wp-c", "slug": "done-wp", "title": "Finished", "status": "finished"},
|
|
]
|
|
tasks = [
|
|
{
|
|
"id": "t1",
|
|
"workplan_id": "wp-a",
|
|
"title": "Measure after RAPPS-WP-0014",
|
|
"status": "wait",
|
|
"description": "Await RAPPS-WP-0014 bind",
|
|
"needs_human": False,
|
|
},
|
|
{
|
|
"id": "t2",
|
|
"workplan_id": "wp-a",
|
|
"title": "Closed",
|
|
"status": "done",
|
|
},
|
|
{
|
|
"id": "t3",
|
|
"workplan_id": "wp-c",
|
|
"title": "orphan open on finished wp",
|
|
"status": "todo",
|
|
},
|
|
]
|
|
payload = coordination_graph_payload(workplans, tasks)
|
|
_validate_schema("graph-explorer-payload.schema.yaml", payload)
|
|
ids = {el["data"]["id"] for el in payload["elements"]}
|
|
assert "workplan:wp-a" in ids
|
|
assert "workplan:wp-b" in ids
|
|
assert "workplan:wp-c" not in ids
|
|
assert "task:t1" in ids
|
|
assert "task:t2" not in ids
|
|
assert "task:t3" not in ids
|
|
waits = [el for el in payload["elements"] if el["data"].get("edgeType") == "waits_on"]
|
|
assert waits
|
|
assert waits[0]["data"]["target"] == "workplan:wp-b"
|
|
assert payload["metrics"]["open_workplans"] == 2
|
|
assert "coordination" in {mode["id"] for mode in fabric_graph_explorer_manifest()["modes"]}
|
|
assert payload["metrics"]["wait_or_human_tasks"] == 1
|