STATE-WP-0072: progress reporter uses workplan_id
POST /progress/ with workplan_id only; keep workstream_id param as deprecated CLI alias for backward compatibility.
This commit is contained in:
parent
7fb9b2b926
commit
1eb9b250be
2 changed files with 10 additions and 4 deletions
|
|
@ -12,7 +12,11 @@ from wisevalidator.models import RunResult
|
||||||
STATE_HUB_URL = os.environ.get("STATE_HUB_URL", "http://127.0.0.1:8000")
|
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."""
|
"""POST result to state-hub /progress/. Returns True on success."""
|
||||||
body = {
|
body = {
|
||||||
"event_type": "e2e_result",
|
"event_type": "e2e_result",
|
||||||
|
|
@ -35,8 +39,9 @@ def report(result: RunResult, workstream_id: str | None = None) -> bool:
|
||||||
"details": json.dumps(body),
|
"details": json.dumps(body),
|
||||||
"event_type": "e2e_result",
|
"event_type": "e2e_result",
|
||||||
}
|
}
|
||||||
if workstream_id:
|
scope_id = workplan_id or workstream_id
|
||||||
payload["workstream_id"] = workstream_id
|
if scope_id:
|
||||||
|
payload["workplan_id"] = scope_id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,5 @@ def test_report_posts_e2e_result() -> None:
|
||||||
assert captured["url"].endswith("/progress/")
|
assert captured["url"].endswith("/progress/")
|
||||||
assert captured["body"]["event_type"] == "e2e_result"
|
assert captured["body"]["event_type"] == "e2e_result"
|
||||||
assert "PASSED" in captured["body"]["summary"]
|
assert "PASSED" in captured["body"]["summary"]
|
||||||
assert captured["body"]["workstream_id"] == "ws-uuid"
|
assert captured["body"]["workplan_id"] == "ws-uuid"
|
||||||
|
assert "workstream_id" not in captured["body"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue