diff --git a/src/wisevalidator/reporter.py b/src/wisevalidator/reporter.py index 46822d6..6dd00f3 100644 --- a/src/wisevalidator/reporter.py +++ b/src/wisevalidator/reporter.py @@ -12,7 +12,11 @@ from wisevalidator.models import RunResult STATE_HUB_URL = os.environ.get("STATE_HUB_URL", "http://127.0.0.1:8000") -def report(result: RunResult, workstream_id: str | None = None) -> bool: +def report( + result: RunResult, + workplan_id: str | None = None, + workstream_id: str | None = None, +) -> bool: """POST result to state-hub /progress/. Returns True on success.""" body = { "event_type": "e2e_result", @@ -35,8 +39,9 @@ def report(result: RunResult, workstream_id: str | None = None) -> bool: "details": json.dumps(body), "event_type": "e2e_result", } - if workstream_id: - payload["workstream_id"] = workstream_id + scope_id = workplan_id or workstream_id + if scope_id: + payload["workplan_id"] = scope_id try: req = urllib.request.Request( diff --git a/tests/test_reporter.py b/tests/test_reporter.py index b6b95d6..be03cf0 100644 --- a/tests/test_reporter.py +++ b/tests/test_reporter.py @@ -34,4 +34,5 @@ def test_report_posts_e2e_result() -> None: assert captured["url"].endswith("/progress/") assert captured["body"]["event_type"] == "e2e_result" assert "PASSED" in captured["body"]["summary"] - assert captured["body"]["workstream_id"] == "ws-uuid" \ No newline at end of file + assert captured["body"]["workplan_id"] == "ws-uuid" + assert "workstream_id" not in captured["body"] \ No newline at end of file