feat(B03): WF1 자동 확정을 역할 무관으로 확대 — 관리자도 B06까지 자동 체인

SYSTEM_ADMIN 예외를 제거한다(2026-08-04 사용자 확정 — 관리자도 같은 사용자).
업로드 후 모두 기본값으로 지표면 자동 확정 -> B05 기본 경로 -> B06 기본 횡단
설계까지 체인을 탄다. 관리자가 B04에서 다른 모델로 재확정하는 경로는 그대로이며,
체인은 경로가 이미 있으면 스스로 건너뛴다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-04 18:34:09 +09:00
co-authored by Claude Opus 5
parent ded617129e
commit 7d7fd64d6b
+30 -22
View File
@@ -51,7 +51,12 @@ async def trigger_wf1_analysis_and_email(
input_file_id: int,
user_role: str,
) -> None:
"""WF1 분석·DB 저장 후 역할에 따라 자동 확정하고 이메일을 발송한다."""
"""WF1 분석·DB 저장 후 자동 확정하고 이메일을 발송한다.
자동 확정은 역할 무관이다(2026-08-04 사용자 확정 — 관리자도 같은 사용자).
`user_role`은 호출부 시그니처 유지용으로만 남겨 둔다.
"""
_ = user_role
pool = get_db_pool()
project_info: dict[str, Any] | None = None
try:
@@ -110,28 +115,31 @@ async def trigger_wf1_analysis_and_email(
analysis_result=analysis_result,
source_filters=source_filters,
)
if user_role != "SYSTEM_ADMIN":
from B04_wf1_Surface.B04_wf1_Surface_Service import (
confirm_surface_selection,
find_surface_model_for_selection,
)
# 역할 무관 자동 확정(2026-08-04 사용자 확정) — 시스템 관리자도 같은
# 사용자다. 모두 기본값으로 자동 확정하고 B05·B06 자동 계산 체인까지 탄다.
# 관리자는 B04에서 다른 모델을 골라 재확정할 수 있다(체인은 경로가 이미
# 있으면 스스로 건너뛴다).
from B04_wf1_Surface.B04_wf1_Surface_Service import (
confirm_surface_selection,
find_surface_model_for_selection,
)
selection = surface_confirmation_defaults()
try:
model_id = await find_surface_model_for_selection(
connection, project_id, selection
)
except LookupError as exc:
auto_confirmation_error = str(exc)
logger.error(
"WF1 자동 확정 보류: project_id=%s reason=%s",
project_id,
auto_confirmation_error,
)
else:
await confirm_surface_selection(connection, project_id, model_id, selection)
auto_confirmed = True
confirmed_model_id = model_id
selection = surface_confirmation_defaults()
try:
model_id = await find_surface_model_for_selection(
connection, project_id, selection
)
except LookupError as exc:
auto_confirmation_error = str(exc)
logger.error(
"WF1 자동 확정 보류: project_id=%s reason=%s",
project_id,
auto_confirmation_error,
)
else:
await confirm_surface_selection(connection, project_id, model_id, selection)
auto_confirmed = True
confirmed_model_id = model_id
await connection.commit()
except Exception:
await connection.rollback()