feat: sync execution with 3s progress polling (stage 2)

- pulp_client: get_repo / sync_repo / get_task (비동기 task href 반환)
- POST /repos/{uuid}/sync: remote 확인 후 동기화 시작, 진행률 조각 반환
- GET /repos/{uuid}/progress: progress_reports 합산 → 바/퍼센트,
  완료/실패 시 hx-trigger 제거로 폴링 중단
- task_store: uuid→task_href 메모리 추적 (단일 인스턴스), 대시보드 '동기화 중' 집계
- views.task_progress: state/done/total/percent + created_resources에서 새 vN
- 동기화는 안전 동작이라 확인 모달 없이 실행 (스펙 §5-1)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 11:09:37 +09:00
parent c1192ab09d
commit 6c41b89c53
14 changed files with 441 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ import httpx
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from .. import views
from .. import task_store, views
from ..deps import get_pulp_client, templates
from ..pulp_client import PulpClient
@@ -21,10 +21,11 @@ router = APIRouter()
def _load_repos(pulp: PulpClient) -> dict[str, Any]:
"""저장소 목록을 읽어 표시 모델 + 요약 + (실패 시) 에러 메시지를 만든다."""
syncing = task_store.active_count()
try:
repos = pulp.list_repos()
except httpx.HTTPError as exc:
return {"repos": [], "summary": views.summarize([]), "error": str(exc)}
return {"repos": [], "summary": views.summarize([], syncing), "error": str(exc)}
repo_views: list[dict[str, Any]] = []
for repo in repos:
@@ -37,7 +38,11 @@ def _load_repos(pulp: PulpClient) -> dict[str, Any]:
version = None # 버전 상세 실패는 치명적이지 않음 — 행은 표시
repo_views.append(views.build_repo_view(repo, version))
return {"repos": repo_views, "summary": views.summarize(repo_views), "error": None}
return {
"repos": repo_views,
"summary": views.summarize(repo_views, syncing),
"error": None,
}
@router.get("/", response_class=HTMLResponse)