[fix] agent: format_script 색 마커 {{강조|..}} 보존 — format_map → 정규식 치환
str.format_map 이 {{·}} 를 이스케이프로 해석해 색 마커 {{강조|텍스트}} 를 {강조|텍스트} 로
붕괴시키던 버그 수정. 정규식 \{(\w+)\} 으로 {변수} 단일 토큰만 치환 — 색 마커는 내부 |(비-\w)로
매칭되지 않아 그대로 보존된다. {변수} 치환·미등록 토큰 원형 유지는 동일.
엔드투엔드 검증(backoffice_db + 실 DB 카드)에서 발견. 회귀 테스트 추가, agent 87/87.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1917d76304
commit
8c700b1e08
2 files changed
+21
-8
No files matched your search
@@ -89,6 +89,14 @@ def test_client_step_and_variable_mapping_load():
|
||||
assert vm["인터넷 최저가"] == "internet_min_price"
|
||||
|
||||
|
||||
def test_format_script_preserves_color_markers():
|
||||
"""변수 치환이 색 마커 {{강조|...}} 를 보존해야 한다(회귀: format_map 이 {{}} 를 {} 로 붕괴시킴)."""
|
||||
repo = _repo()
|
||||
out = repo.format_script("**{input_price}원**·{{안내|{target}원}}·{unknown}",
|
||||
{"input_price": 9800, "target": 10000})
|
||||
assert out == "**9800원**·{{안내|10000원}}·{unknown}" # 마커 보존 + 변수 치환 + 미등록 원형
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_resolve_card_script_file_mode_default():
|
||||
"""기본(source_type='file'): resolve_card_script 가 파일 카드 멘트를 반환(하위호환)."""
|
||||
|
||||
Reference in new issue
Block a user