Skip to content

[deploy] prod 서버 배포#124

Merged
selnem merged 5 commits into
prodfrom
develop
Jun 15, 2026
Merged

[deploy] prod 서버 배포#124
selnem merged 5 commits into
prodfrom
develop

Conversation

@selnem

@selnem selnem commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

[deploy] prod 서버 배포

selnem added 5 commits June 15, 2026 20:51
VECTOR_HNSW_M, EF_CONSTRUCTION, EF_SEARCH, DIST_METHOD 설정을 추가하고
VectorStoreService와 벡터 insert 스크립트가 동일한 hnsw_kwargs를 사용하도록 통일한다.
prod 환경에서 complaint-email·geo·*-pins API를 숨기고 contest/policy-admin은 노출하도록 ROUTER_REGISTRY를 조정한다. 환경별 라우터 집합 회귀 방지 테스트를 추가한다.
@selnem selnem self-assigned this Jun 15, 2026
@selnem selnem added the 🚀 deploy 배포 label Jun 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces CDN configuration settings, customizable HNSW parameters for vector indexing, and test endpoints for S3 operations (upload, download, delete), along with corresponding unit tests. The review feedback highlights three key improvement opportunities: handling non-ASCII filenames in the S3 download endpoint's Content-Disposition header to prevent encoding errors, merging custom HNSW arguments with default settings to avoid missing keys, and updating the HNSW distance method validator to handle None values safely.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread app/routes/TestRoute.py
Comment on lines +60 to +65
filename = Path(key).name or "download.bin"
return StreamingResponse(
io.BytesIO(data),
media_type=content_type or "application/octet-stream",
headers={"Content-Disposition": f'attachment; filename="{filename}"'},
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

S3에서 다운로드할 파일의 이름(filename)에 한글 등 비ASCII 문자가 포함되어 있을 경우, Content-Disposition 헤더에 그대로 설정하면 ASGI 서버(Uvicorn 등)에서 UnicodeEncodeError가 발생하여 다운로드 요청이 실패(500 Internal Server Error)할 수 있습니다.

RFC 5987 및 RFC 6266 표준에 따라 파일명을 URL 인코딩(urllib.parse.quote)하고, filename*=UTF-8'' 형식을 사용하여 안전하게 전달하는 것을 권장합니다.

    filename = Path(key).name or "download.bin"
    import urllib.parse
    encoded_filename = urllib.parse.quote(filename)
    return StreamingResponse(
        io.BytesIO(data),
        media_type=content_type or "application/octet-stream",
        headers={
            "Content-Disposition": f"attachment; filename=\"{encoded_filename}\"; filename*=UTF-8''{encoded_filename}"
        },
    )

self._domain_configs = domain_configs or {}
self._embed_models: dict[tuple[str, int], BaseEmbedding] = {}
self._embedding_batch_size_override = embedding_batch_size_override
self._hnsw_kwargs = hnsw_kwargs or dict(DEFAULT_HNSW_KWARGS)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

hnsw_kwargs가 전달될 때, 일부 키만 포함된 부분 딕셔너리(예: {"hnsw_m": 32})가 전달되면 나머지 필수 키(hnsw_ef_construction, hnsw_ef_search, hnsw_dist_method 등)가 누락되어 에러가 발생하거나 기본값이 적용되지 않을 수 있습니다.

DEFAULT_HNSW_KWARGS를 기반으로 입력받은 hnsw_kwargs를 병합(merge)하여 항상 모든 필수 키가 존재하도록 보장하는 것이 안전합니다.

Suggested change
self._hnsw_kwargs = hnsw_kwargs or dict(DEFAULT_HNSW_KWARGS)
self._hnsw_kwargs = {**DEFAULT_HNSW_KWARGS, **(hnsw_kwargs or {})}

Comment thread app/core/config.py
Comment on lines +423 to +426
def _empty_vector_hnsw_dist_method(cls, value: object) -> object:
if isinstance(value, str) and value.strip() == "":
return "vector_cosine_ops"
return value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

vector_hnsw_dist_method 필드는 str 타입으로 정의되어 있으므로, 만약 환경 변수나 설정 값에서 None이 명시적으로 전달될 경우 isinstance(value, str) 조건에 걸리지 않아 None을 그대로 반환하게 됩니다. 이 경우 Pydantic 검증 단계에서 ValidationError가 발생할 수 있습니다.

안전한 방어적 프로그래밍을 위해 valueNone인 경우에도 기본값인 "vector_cosine_ops"를 반환하도록 처리하는 것이 좋습니다.

Suggested change
def _empty_vector_hnsw_dist_method(cls, value: object) -> object:
if isinstance(value, str) and value.strip() == "":
return "vector_cosine_ops"
return value
def _empty_vector_hnsw_dist_method(cls, value: object) -> object:
if value is None or (isinstance(value, str) and value.strip() == ""):
return "vector_cosine_ops"
return value

@selnem selnem merged commit e3952b4 into prod Jun 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant