Fix core-hub stabilization evidence sink posting
Allow persist_ops_evidence to emit State Hub progress for core-hub context sources so scheduled stabilization checks record hub-visible evidence.
This commit is contained in:
parent
1a2e0770c1
commit
726da055dc
2 changed files with 52 additions and 1 deletions
|
|
@ -136,6 +136,57 @@ def test_state_hub_progress_sink_posts_compact_probe_summary(monkeypatch) -> Non
|
|||
assert "token=secret" not in serialized
|
||||
|
||||
|
||||
def test_core_hub_stabilization_sink_posts_progress(monkeypatch) -> None:
|
||||
posts: list[dict[str, Any]] = []
|
||||
|
||||
def fake_get(url: str, **kwargs: Any) -> DummyResponse:
|
||||
return DummyResponse([])
|
||||
|
||||
def fake_post(url: str, **kwargs: Any) -> DummyResponse:
|
||||
posts.append({"url": url, **kwargs})
|
||||
return DummyResponse({"id": "progress-core-hub-1"})
|
||||
|
||||
monkeypatch.setattr(httpx, "get", fake_get)
|
||||
monkeypatch.setattr(httpx, "post", fake_post)
|
||||
|
||||
result = persist_ops_inventory_evidence(
|
||||
{
|
||||
"activity_id": "activity-core-hub",
|
||||
"run_id": "12345678-aaaa-bbbb-cccc-123456789abc",
|
||||
"scheduled_for": "2026-07-07T10:15:00+00:00",
|
||||
"version_used": 1,
|
||||
"context_sources": [
|
||||
{
|
||||
"type": "core-hub",
|
||||
"query": "stabilization_check",
|
||||
"bind_to": "context.core_hub_stabilization_check",
|
||||
"params": {
|
||||
"evidence_sinks": [
|
||||
{
|
||||
"type": "state-hub-progress",
|
||||
"event_type": "core_hub_stabilization_check",
|
||||
"state_hub_url": "http://state-hub.test",
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
],
|
||||
"context": {
|
||||
"core_hub_stabilization_check": {
|
||||
"kind": "core_hub_stabilization",
|
||||
"overall_pass": True,
|
||||
"checks": {"widget_types_count": {"pass": True, "count": 26}},
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
assert result[0]["status"] == "posted"
|
||||
body = posts[0]["json"]
|
||||
assert body["event_type"] == "core_hub_stabilization_check"
|
||||
assert "Core Hub stabilization" in body["summary"]
|
||||
|
||||
|
||||
def test_state_hub_progress_sink_is_idempotent(monkeypatch) -> None:
|
||||
idempotency_key = f"{_run_id()}:ops_probe:ops_inventory_probe"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue