fix(portfolio): name 검증에 한글+공백 허용 (minor-change, CHG-20260627-03)

_PORTFOLIO_NAME_RE + CLI _NAME_RE를 ^[a-zA-Z0-9가-힣 ._:-]{1,100}$로 완화. name은 (owner,name) 조회 키일 뿐 wire 식별자 아님. 475 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
This commit is contained in:
2026-06-27 12:03:33 +09:00
co-authored by Claude Opus 4.8
parent 853a9bdab8
commit 233cbc3df6
5 changed files with 74 additions and 4 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ from app.schemas.portfolio import (
)
from app.services.portfolio_service import PortfolioService
_NAME_RE = re.compile(r"^[a-zA-Z0-9._:\-]{1,100}$")
_NAME_RE = re.compile(r"^[a-zA-Z0-9가-힣 ._:\-]{1,100}$")
portfolio_app = typer.Typer(help="Portfolio lifecycle and trade commands.")
comment_app = typer.Typer(help="Portfolio comment history commands.")
@@ -72,7 +72,7 @@ def _confirm(force: bool, message: str) -> None:
def _validate_portfolio_name(name: str, ctx_console=None) -> None:
if not _NAME_RE.match(name):
msg = f"유효하지 않은 이름입니다: {name!r} — [a-zA-Z0-9._:-] 문자만 허용하며 1~100자여야 합니다."
msg = f"유효하지 않은 이름입니다: {name!r} — 한글·영문·숫자·공백·._:- 만 허용하며 1~100자여야 합니다."
if ctx_console is not None:
ctx_console.print(f"Error: {msg}")
raise typer.Exit(code=1)
+2 -2
View File
@@ -9,7 +9,7 @@ import re as _re
from pydantic import BaseModel, ConfigDict, Field, field_validator
_PORTFOLIO_NAME_RE = _re.compile(r"^[a-zA-Z0-9._:\-]{1,100}$")
_PORTFOLIO_NAME_RE = _re.compile(r"^[a-zA-Z0-9가-힣 ._:\-]{1,100}$")
class StrategySetResponse(BaseModel):
@@ -90,7 +90,7 @@ class CreatePortfolioRequest(PortfolioBase):
def validate_name(cls, v: str) -> str:
if not _PORTFOLIO_NAME_RE.match(v):
raise ValueError(
f"이름은 [a-zA-Z0-9._:-] 문자만 허용하며 1~100자여야 합니다: {v!r}"
f"이름은 한글·영문·숫자·공백·._:- 만 사용 가능하며 1~100자여야 합니다: {v!r}"
)
return v