CUST-WP-0055 T05: workplan-first progress scope in sinks and resolvers

Prefer workplan_id in State Hub progress writes while dual-writing
workstream_id for wire-compat. Extend schedule_health, evidence/report
sinks, phase5 checks, k8s triage prose, and SCOPE terminology.
This commit is contained in:
tegwick 2026-07-08 20:00:35 +02:00
parent 7947961ed4
commit 69fe69041f
12 changed files with 135 additions and 30 deletions

View file

@ -8,6 +8,7 @@ import pytest
from activity_core import report_sinks
from activity_core.state_hub_write import (
IDEMPOTENCY_HEADER,
apply_progress_scope_fields,
idempotency_headers,
idempotency_key,
)
@ -33,6 +34,24 @@ def test_headers_carry_the_key() -> None:
assert headers == {IDEMPOTENCY_HEADER: "run1:i:e"}
def test_apply_progress_scope_prefers_workplan_id() -> None:
body: dict[str, str] = {}
apply_progress_scope_fields(
body,
{"workplan_id": "wp-1", "workstream_id": "ws-legacy", "topic_id": "topic-1"},
)
assert body["workplan_id"] == "wp-1"
assert body["workstream_id"] == "wp-1"
assert body["topic_id"] == "topic-1"
def test_apply_progress_scope_dual_writes_legacy_workstream_id() -> None:
body: dict[str, str] = {}
apply_progress_scope_fields(body, {"workstream_id": "ws-1"})
assert body["workplan_id"] == "ws-1"
assert body["workstream_id"] == "ws-1"
def test_distinct_identities_get_distinct_keys() -> None:
assert idempotency_key("r", "i", "daily_triage") != idempotency_key(
"r", "i", "schedule_miss"