fix(lotto-signals): draw_no 모든 source에 전달 (drift baseline 회차 가드 활성화)
light/sim source에서도 current_draw_no를 항상 fetch해 drift/confidence 메트릭의 회차 단위 중복 push 가드가 올바르게 동작하도록 수정. lotto_latest_draw() 헬퍼를 service_proxy에 추가하고 run_signal_check에서 source에 무관하게 최신 회차를 먼저 조회; deep_check는 curate_weekly 반환값을 우선 사용. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,13 +41,18 @@ class LottoAgent(BaseAgent):
|
||||
|
||||
try:
|
||||
curate_result = None
|
||||
current_draw_no = None
|
||||
|
||||
# 회차 단위 메트릭(drift/confidence) 가드를 위해 항상 최신 회차 가져옴
|
||||
from ..service_proxy import lotto_latest_draw
|
||||
current_draw_no = await lotto_latest_draw()
|
||||
|
||||
if source == "deep":
|
||||
from ..curator.pipeline import curate_weekly
|
||||
cw = await curate_weekly(source="signal_deep")
|
||||
# curate_weekly returns {"ok", "draw_no", "confidence", "tokens", "payload"}
|
||||
curate_result = {"confidence": cw.get("confidence")}
|
||||
# deep_check 시 curate_weekly가 반환하는 draw_no를 우선 사용 (직접 수집)
|
||||
if cw.get("draw_no"):
|
||||
current_draw_no = cw.get("draw_no")
|
||||
|
||||
outcome = await run_signal_check(
|
||||
|
||||
@@ -360,3 +360,20 @@ async def lotto_strategy_weights() -> Dict[str, float]:
|
||||
if isinstance(weights, list):
|
||||
return {item["strategy"]: float(item["weight"]) for item in weights}
|
||||
return {k: float(v) for k, v in (weights or {}).items()}
|
||||
|
||||
|
||||
async def lotto_latest_draw() -> Optional[int]:
|
||||
"""GET /api/lotto/latest — 최신 회차 번호만 반환."""
|
||||
from .config import LOTTO_BACKEND_URL
|
||||
try:
|
||||
resp = await _client.get(f"{LOTTO_BACKEND_URL}/api/lotto/latest")
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
# /api/lotto/latest 응답 키: {"drawNo": N, ...}
|
||||
# 하위 호환을 위해 drawNo, draw_no, drwNo, draw 순서로 시도
|
||||
for key in ("drawNo", "draw_no", "drwNo", "draw"):
|
||||
if isinstance(data, dict) and data.get(key):
|
||||
return int(data[key])
|
||||
return None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user