Implement weekly coding retro schedule

This commit is contained in:
2026-06-07 20:58:34 +02:00
parent 992fe94034
commit 14b2d40eb7
6 changed files with 526 additions and 0 deletions

View File

@@ -157,6 +157,128 @@ def test_repo_sbom_status_returns_empty_on_failure(monkeypatch) -> None:
assert resolver.resolve("repo_sbom_status", None, {"repos": "all"}) == {}
def test_coding_retro_returns_latest_progress_suggestions(monkeypatch) -> None:
calls: list[dict[str, Any]] = []
def fake_get(url: str, **kwargs: Any) -> DummyResponse:
calls.append({"url": url, **kwargs})
return DummyResponse([
{
"id": "older-retro",
"event_type": "coding_retro",
"summary": "older",
"created_at": "2026-05-31T17:00:00Z",
"detail": {
"generated_at": "2026-05-31T17:00:00Z",
"suggestions": [
{
"repo": "old-repo",
"title": "Old recommendation",
"recommendation": "Do the older thing.",
"priority": "low",
"score": 1,
}
],
},
},
{
"id": "note-1",
"event_type": "note",
"summary": "ignore me",
"created_at": "2026-06-07T17:05:00Z",
"detail": {},
},
{
"id": "newer-retro",
"event_type": "coding_retro",
"summary": "weekly coding retro ready",
"created_at": "2026-06-07T17:10:00Z",
"detail": {
"generated_at": "2026-06-07T17:09:30Z",
"window": {
"since": "2026-05-31T00:00:00Z",
"until": "2026-06-07T00:00:00Z",
},
"suggestions": [
{
"target_repo": "activity-core",
"title": "Harden schedule smoke gates",
"description": "Add a smoke proof before enablement.",
"priority": "HIGH",
"score": "8.5",
},
{
"repo_slug": "repo-without-title",
"recommendation": "missing title should be skipped",
"score": 9,
},
],
},
},
])
monkeypatch.setenv("STATE_HUB_URL", "http://state-hub.test/")
monkeypatch.setattr(httpx, "get", fake_get)
result = StateHubContextResolver().resolve(
"coding_retro",
None,
{"limit": 20, "window_days": 7},
)
assert calls == [
{
"url": "http://state-hub.test/progress/",
"params": {"limit": 20},
"timeout": 10.0,
}
]
assert result["source_progress_id"] == "newer-retro"
assert result["generated_at"] == "2026-06-07T17:09:30Z"
assert result["window"] == {
"since": "2026-05-31T00:00:00Z",
"until": "2026-06-07T00:00:00Z",
}
assert result["summary"] == "weekly coding retro ready"
assert result["suggestions"] == [
{
"repo": "activity-core",
"title": "Harden schedule smoke gates",
"recommendation": "Add a smoke proof before enablement.",
"priority": "high",
"score": 8.5,
}
]
def test_coding_retro_returns_empty_shape_when_not_published(monkeypatch) -> None:
def fake_get(url: str, **kwargs: Any) -> DummyResponse:
return DummyResponse([
{
"id": "note-1",
"event_type": "note",
"created_at": "2026-06-07T17:10:00Z",
}
])
monkeypatch.setattr(httpx, "get", fake_get)
result = StateHubContextResolver().resolve(
"coding_retro",
None,
{"event_type": "coding_retro"},
)
assert result == {
"suggestions": [],
"window": None,
"generated_at": None,
"source_progress_id": None,
"event_type": "coding_retro",
"summary": "",
}
def test_resolver_failure_returns_empty(monkeypatch) -> None:
def fake_get(url: str, **kwargs: Any) -> DummyResponse:
raise httpx.ConnectError("offline")