For STATE-WP-0094-T05: runner revision, active definition, per-repo Forge commit, projection sync proxy, queued receipts and freshness window, with explicit gaps and coverage holes. No writes to hub, cluster or Forge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 671493@bnt-lap001 Assistant-Session: 60d7b11f-78f9-4731-9367-918511b2762d
24 lines
954 B
Python
24 lines
954 B
Python
from datetime import UTC, datetime
|
|
|
|
from repo_manager.freshness import summarize
|
|
|
|
|
|
def test_summarize_counts_windows_and_holes():
|
|
now = datetime(2026, 10, 4, 12, 0, tzinfo=UTC)
|
|
rows = [
|
|
{"status": "active", "last_backing_synced_at": "2026-10-04T10:00:00Z",
|
|
"forge_commit": "a"},
|
|
{"status": "active", "last_backing_synced_at": "2026-09-30T12:00:00Z",
|
|
"forge_commit": None},
|
|
{"status": "active", "last_backing_synced_at": None, "forge_commit": "b"},
|
|
{"status": "archived", "last_backing_synced_at": "2026-01-01T00:00:00Z"},
|
|
]
|
|
s = summarize(rows, now)
|
|
assert s["repos_total"] == 4
|
|
assert s["repos_active"] == 3
|
|
assert s["active_with_projection_sync"] == 2
|
|
assert s["active_never_synced_or_no_workplans"] == 1
|
|
assert s["active_forge_head_resolved"] == 2
|
|
assert s["synced_within_24h"] == 1
|
|
assert s["synced_within_7d"] == 2
|
|
assert s["age_hours"]["max"] == 96.0
|