Stop dual-writing workstream_id on State Hub progress POSTs
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 21s
Build and Publish Container Image / build-and-push (push) Successful in 1m24s

Progress scope helpers and schedule-miss alerts now send workplan_id only.
Legacy workstream_id in sink config still maps to workplan_id on the wire.
This commit is contained in:
tegwick 2026-07-09 00:31:55 +02:00
parent f171bb037a
commit 5a9292319e
6 changed files with 10 additions and 12 deletions

View file

@ -178,7 +178,6 @@ def post_missed_fire_alert(
scope_id = workplan_id or workstream_id
if scope_id:
body["workplan_id"] = scope_id
body["workstream_id"] = scope_id
# Dedup repeated alerts for the same missed window (same schedule + last fire).
last_fired = health.last_fired_at.isoformat() if health.last_fired_at else "none"

View file

@ -23,13 +23,12 @@ IDEMPOTENCY_HEADER = "Idempotency-Key"
def apply_progress_scope_fields(body: dict[str, Any], source: dict[str, Any]) -> None:
"""Copy topic/workplan/task/decision scope from a sink config into a progress body.
Prefers ``workplan_id``; dual-writes ``workstream_id`` for wire-compat until
legacy-meter retires the alias.
Prefers ``workplan_id``; accepts legacy ``workstream_id`` in sink config only
as a fallback source (maps to ``workplan_id`` on the wire).
"""
workplan_id = source.get("workplan_id") or source.get("workstream_id")
if workplan_id:
body["workplan_id"] = workplan_id
body["workstream_id"] = workplan_id
for key in ("topic_id", "task_id", "decision_id"):
if source.get(key):
body[key] = source[key]