fix(prediction): stats_aggregator hour 경계 silent 누락 복구 #93
No reviewers
레이블
레이블 없음
마일스톤 없음
담당자 없음
참여자 2명
알림
마감일
마감일이 설정되지 않았습니다.
의존성
No dependencies set.
Reference: gc/kcg-ai-monitoring#93
불러오는 중...
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/stats-aggregator-hour-boundary"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
변경 요약
prediction/output/stats_aggregator.py:aggregate_hourly()가 현재 + 이전 hour 를 모두 UPSERT (경계 누락 방지)_aggregate_one_hour()로 단일 hour 집계 분리 (UPSERT idempotent)tests/test_stats_aggregator_hour_boundary.py: 3 유닛테스트docs/RELEASE-NOTES.md: [Unreleased] 수정 섹션발견 경위
Phase 1-2 의 snapshot 스크립트에 추가한
C1. stats_hourly vs events 카테고리 drift섹션이 실제 silent error 를 포착:근본 원인
prediction 한 사이클 평균 13분 소요 (5분 interval 보다 긺) → 사이클이 hour 경계를 넘나드는 경우(12:55 시작 → 13:08 완료)가 흔함. 이 사이클 내 생성된 이벤트(occurred_at=12:57)가
aggregate_hourly호출 시점(now_kst=13:08) 기준 현재 hour=13:00 만 UPSERT 되어 12:00 hour 는 이전 사이클 snapshot 으로 stale 유지. 새 카테고리·신규 이벤트가 그대로 누락 되며 로그에는 아무 오류도 안 남는 전형적 silent bug.수정 내용
_aggregate_one_hour(conn, hour_start, updated_at)로 분리aggregate_hourly()호출 시마다previous_hour → current_hour순서로 2 번 집계검증
2026-04-20 12:00 stat_hour.by_category에GEAR_IDENTITY_COLLISION: 1복구 확인C1 drift가 0 rows (drift 완전 해소)배포 영향
Silent hour-boundary bug 정확한 재현·수정·회귀 검증. 운영 수동 재집계로 복구 확인. LGTM