[fix] solution/backend: Teams 는 장애만 — 수집·발행 시작·완료 알림 제거, 빌드 실패 중복 발송 정리

수집 1회에 3~4장, 발행 1회에 2장씩 와서 장애 알림이 묻혔다. 빌드·되돌리기 실패와 수집 예외는
기존 build_failed · job_dead 알림이 이미 보내고 있어 같은 사고가 두 번씩 갔다.

- collect_service: 시작·완료 요약·예외 알림 제거 — 채널 크롤링 실패만 남긴다(채널별 결과는 잡 결과 channels 에 그대로)
- vision_service: 실패가 있을 때만
- build_service · rollback_service: activity 알림 되돌림 — build_failed · recovery 가 그대로 담당
- docs/ALERTS.md: activity 행을 실제 발송 범위로

관련 테스트 17개 파일 297 passed · 2 failed(test_search_console_service — 변경 전에도 실패)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5.5 committed 2026-09-30 16:37:24 +09:00
1 parent ca0bea77a7
commit b75c56a0d6
5 files changed
+11 -124

No files matched your search

+1 -40
View File
@@ -458,47 +458,14 @@ async def store_media(place_id: str, sources: list, unit_map: dict) -> dict:
# 오케스트레이션
async def run_collect(job: dict) -> dict:
"""COLLECT 잡 핸들러."""
started = time.monotonic()
with collect_diagnostics.collecting():
try:
result = await _run_collect(job)
except Exception as ex:
await activity_feed.post(
"❌ 수집 실패",
[f"place_id={job['payload'].get('place_id')}", f"{type(ex).__name__}: {ex}",
f"{time.monotonic() - started:.0f}초"],
)
raise
result = await _run_collect(job)
issues = collect_diagnostics.snapshot()
if issues:
result["issues"] = issues
await _post_collect_summary(result, issues, time.monotonic() - started)
return result
async def _post_collect_summary(result: dict, issues: list[dict], elapsed: float) -> None:
lines = [result.get("label") or f"place_id={result.get('place_id')}"]
if result.get("note"):
lines.append(result["note"])
for row in result.get("channels") or []:
lines.append(row)
facts = result.get("facts")
if facts:
reasons = ", ".join(f"{k} {v}" for k, v in facts["by_reason"].items())
lines.append(f"fact 저장 {facts['stored']} · 반려 {facts['rejected']}" + (f" ({reasons})" if reasons else ""))
media = result.get("media")
if media:
lines.append(f"사진 {media['stored']}장 (중복 {media['skipped_duplicate']})")
cov = result.get("coverage")
if cov and cov["missing"]:
lines.append(f"필수 항목 {cov['covered']}/{cov['total']} — 누락 {', '.join(cov['missing'])}")
other = [i for i in issues if i["stage"] != "fetch"]
for issue in other:
lines.append(f"⚠️ {issue['stage']} 실패: {issue['error_type']}: {issue['message'][:200]}")
lines.append(f"{elapsed:.0f}초")
await activity_feed.post("✅ 수집 완료", lines)
async def _run_collect(job: dict) -> dict:
payload = job["payload"]
place_id = payload["place_id"]
@@ -528,12 +495,6 @@ async def _run_collect(job: dict) -> dict:
link.channel == LinkChannel.NAVER_PLACE.value for link in targets
)
await activity_feed.post(
"🔎 수집 시작",
[result["label"], f"place_id={place_id}",
f"크롤링 대상 {len(targets)}건: " + (", ".join(activity_feed.channel_name(l.channel) for l in targets) or "없음")],
)
if not targets:
result["note"] = "크롤링 대상이 없다(어댑터가 처리할 수 있는 확정 URL 0건)"
await _finish(place_id, owner_user_id, PlaceStatus.REVIEW)