fix: Codex 리뷰 5건 수정 (critical 1 + high 4)
1. [critical] config.yaml → settings 객체에서 taxonomy 로드 (import crash 방지) 2. [high] ODF 변환: file_path 유지, derived_path 별도 필드 (무한 중복 방지) 3. [high] 법령 분할: 첫 장 이전 조문을 "서문"으로 보존 4. [high] Inbox: review_status 필드 분리 (pending/approved/rejected) 5. [high] 삭제: soft-delete (deleted_at) + worker 방어 + active_documents 뷰 - 모든 조회에 deleted_at IS NULL 일관 적용 - queue_consumer: row 없으면 gracefully skip Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -127,13 +127,7 @@ async def process(document_id: int, session: AsyncSession) -> None:
|
||||
target_fmt = CONVERT_MAP.get(fmt)
|
||||
if target_fmt:
|
||||
try:
|
||||
from core.utils import file_hash as calc_hash
|
||||
# 원본 메타 보존
|
||||
doc.original_path = doc.file_path
|
||||
doc.original_format = doc.file_format
|
||||
doc.original_hash = doc.file_hash
|
||||
|
||||
# .derived 디렉토리에 변환
|
||||
# .derived 디렉토리에 변환 (file_path는 원본 유지!)
|
||||
derived_dir = full_path.parent / ".derived"
|
||||
derived_dir.mkdir(exist_ok=True)
|
||||
tmp_input2 = tmp_dir / f"convert_{document_id}.{fmt}"
|
||||
@@ -150,13 +144,11 @@ async def process(document_id: int, session: AsyncSession) -> None:
|
||||
final_path = derived_dir / f"{document_id}.{target_fmt}"
|
||||
shutil.move(str(conv_file), str(final_path))
|
||||
|
||||
# DB 업데이트: current → ODF
|
||||
nas_root = Path(settings.nas_mount_path)
|
||||
doc.file_path = str(final_path.relative_to(nas_root))
|
||||
doc.file_format = target_fmt
|
||||
doc.file_hash = calc_hash(final_path)
|
||||
doc.derived_path = str(final_path.relative_to(nas_root))
|
||||
doc.original_format = doc.file_format
|
||||
doc.conversion_status = "done"
|
||||
logger.info(f"[ODF변환] {doc.original_path} → {doc.file_path}")
|
||||
logger.info(f"[ODF변환] {doc.file_path} → derived: {doc.derived_path}")
|
||||
else:
|
||||
doc.conversion_status = "failed"
|
||||
logger.warning(f"[ODF변환] 실패: {conv_result.stderr[:200]}")
|
||||
|
||||
Reference in New Issue
Block a user