From 884ea1e669e05c121e743036d013cdced083a8ce Mon Sep 17 00:00:00 2001 From: hyungi Date: Tue, 16 Jun 2026 14:40:56 +0900 Subject: [PATCH] =?UTF-8?q?docs(news):=20url=20normalizer=20=EC=B1=84?= =?UTF-8?q?=EB=84=90=EB=B3=84=20=EC=9D=98=EB=8F=84=EC=A0=81=20divergence?= =?UTF-8?q?=20=EB=AA=85=EC=8B=9C=20=E2=80=94=20=ED=86=B5=ED=95=A9=20?= =?UTF-8?q?=EA=B8=88=EC=A7=80=20=EB=B0=95=EC=A0=9C=20(R11b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit audit 의 dup-url-normalizer-divergent 는 design intent 오탐: news._normalize_url 은 query-식별 사이트(hada.io?id=·HN item?id=) 별개 기사 붕괴 방지 위해 보수적(query 보존·sort/trailing-slash/ 소문자화 안 함), file_watcher._canonicalize_url 은 web_clip dedup 위해 공격적 정규화 — 채널별 의도된 차이. 통합하면 news dedup 가 깨진다(docstring 경고). 두 함수 docstring 에 상호 cross-ref + '통합 금지' 명시해 미래 잘못된 통합 차단. 동작 변경 0(주석만). Co-Authored-By: Claude Opus 4.8 (1M context) --- app/workers/file_watcher.py | 4 ++++ app/workers/news_collector.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/workers/file_watcher.py b/app/workers/file_watcher.py index e94c0fb..99c7694 100644 --- a/app/workers/file_watcher.py +++ b/app/workers/file_watcher.py @@ -137,6 +137,10 @@ def _canonicalize_url(url: str) -> str: 같은 글의 utm 변형 (`?utm_source=foo`) 과 fragment 변형 (`#section`) 을 한 row 로 수렴시키기 위해 file_hash 산출 전 반드시 거친다. + + ★R11c: news_collector._normalize_url(news 채널)과 의도적으로 다르다 — 이쪽(web_clip)은 + query-sort/trailing-slash/소문자화로 공격적 정규화하지만, news 쪽은 query-식별 사이트의 + 별개 기사 붕괴 방지를 위해 보수적이다. 두 함수 통합 금지(채널별 dedup 의도가 다름). """ if not url: return "" diff --git a/app/workers/news_collector.py b/app/workers/news_collector.py index 59699ae..3a4a6df 100644 --- a/app/workers/news_collector.py +++ b/app/workers/news_collector.py @@ -83,6 +83,10 @@ def _normalize_url(url: str) -> str: query 전체 제거 금지: hada.io/topic?id= · aitimes articleView.html?idxno= · HN item?id= 등 query-식별 사이트에서 별개 기사가 같은 URL 로 붕괴된다. 저장(edit_url)·조회 양쪽이 이 함수를 공유해야 dedup 이 성립. + + ★R11c: file_watcher._canonicalize_url(web_clip 채널)과 의도적으로 다르다 — 이쪽은 콘텐츠 + 식별 query 보존(별개 기사 붕괴 방지)이 핵심이라 query-sort/trailing-slash/소문자화를 안 한다. + 두 함수 통합 금지(news dedup 가 깨짐). 채널별 normalization 은 의도된 설계. """ parsed = urlparse(url) kept = [