feat(board): expose summarize_by_machine for offload visibility (A-1)
요약 풀의 머신별 완료 실적(맥미니 vs 맥북)을 /api/queue/overview 응답에 summarize_by_machine 로 노출. rows_to_summarize_split 이 이미 계산하던 값의 additive 투영 — 신규 수집 SQL/마이그 0. 통합 보드 레인의 오프로드 가시화 (맥북이 요약 86% 처리) 재료. + FE 타입 동기 + store 신선도 timestamp(B-4). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,6 +103,32 @@ def test_summarize_pool_split_attribution():
|
||||
assert macbook["pending"] == 0 # 풀 pending 은 macmini 만
|
||||
|
||||
|
||||
def test_summarize_by_machine_projection():
|
||||
"""build_summarize_by_machine = split 의 done_1h/done_today 를 머신별로 투영
|
||||
(done_15m 은 제외 — 내부 state 판정 전용)."""
|
||||
from services.queue_overview import build_summarize_by_machine
|
||||
split = _split(
|
||||
macbook={"done_1h": 226, "done_today": 312, "done_15m": 60},
|
||||
macmini={"done_1h": 37, "done_today": 94, "done_15m": 9},
|
||||
)
|
||||
sbm = build_summarize_by_machine(split)
|
||||
assert sbm == {
|
||||
"macmini": {"done_1h": 37, "done_today": 94},
|
||||
"macbook": {"done_1h": 226, "done_today": 312},
|
||||
}
|
||||
assert "done_15m" not in sbm["macbook"]
|
||||
|
||||
|
||||
def test_compose_overview_includes_summarize_by_machine():
|
||||
"""compose_overview 응답 계약에 summarize_by_machine 포함 (FE 레인 분담 재료)."""
|
||||
now_kst = datetime(2026, 6, 13, 13, 0, tzinfo=KST)
|
||||
stats = {"summarize": _stage(pending=1317, done_1h=264)}
|
||||
split = _split(macbook={"done_1h": 226, "done_today": 312}, macmini={"done_1h": 37, "done_today": 94})
|
||||
ov = compose_overview(stats, split, {}, {}, [], deep_enabled=True, now_kst=now_kst)
|
||||
assert ov["summarize_by_machine"]["macbook"]["done_1h"] == 226
|
||||
assert ov["summarize_by_machine"]["macmini"]["done_today"] == 94
|
||||
|
||||
|
||||
def test_deep_disabled_deep_summary_counts_to_macmini():
|
||||
stats = {"deep_summary": _stage(pending=2, processing=1, done_1h=3, done_today=4)}
|
||||
machines = build_machines(stats, _split(), [], deep_enabled=False)
|
||||
|
||||
Reference in New Issue
Block a user