Merge branch 'feature/variety-item' into main
This commit is contained in:
commit
1bcee68432
18 files changed
+416
-20
No files matched your search
@@ -200,7 +200,10 @@ async def run_build(job: dict) -> dict:
|
||||
)
|
||||
|
||||
mismatches = list(report.get("mismatches") or [])
|
||||
unique_count = report.get("uniqueContentCount") or 0
|
||||
# ★ None(재지 못했다)과 0(재 봤더니 0건)을 뭉개지 않는다. 게이트는 raw 를 보고,
|
||||
# 기록·화면에는 0 으로 떨어뜨린다. 뭉개면 디스크 오류가 NO_UNIQUE_CONTENT 로 둔갑한다.
|
||||
unique_count_raw = report.get("uniqueContentCount")
|
||||
unique_count = unique_count_raw or 0
|
||||
jsonld = report.get("jsonld") or []
|
||||
result["unique_content_count"] = unique_count
|
||||
result["mismatches"] = mismatches[:20]
|
||||
@@ -211,14 +214,25 @@ async def run_build(job: dict) -> dict:
|
||||
# 대개 게이트 사유(고유 콘텐츠 0건·구조화 데이터 불일치)이기 때문이다.
|
||||
# 여기서 사유를 정확히 골라야 publish_logs 에 '무엇을 고쳐야 하는지' 가 남는다 —
|
||||
# 전부 "렌더 실패"로 뭉뚱그리면 운영자가 손댈 곳을 알 수 없다.
|
||||
gate = publish_gate.evaluate(PlaceCategory(place.category), snapshot["facts"], unique_count, mismatches)
|
||||
gate = publish_gate.evaluate(
|
||||
PlaceCategory(place.category), snapshot["facts"], unique_count_raw, mismatches
|
||||
)
|
||||
result["gate"] = {"passed": gate.passed, **gate.as_log()}
|
||||
|
||||
if not gate.passed:
|
||||
return await _fail(f"{gate.reason.name}: {gate.as_log()}", gate, stamp)
|
||||
|
||||
if not report.get("ok"):
|
||||
# 게이트로 설명되지 않는 실패(디스크·번들·payload 파손). 재시도가 의미 있는 쪽이다.
|
||||
# ★ 렌더러가 거부한 이유에 사유 코드를 붙인다. evaluate() 는 얇은 콘텐츠로 막지
|
||||
# 않지만 렌더러는 스팸 판정을 피하려 페이지 쓰기를 거부한다 — 그 사유를 "렌더 실패"
|
||||
# 로 뭉개면 화면이 NO_UNIQUE_CONTENT 문구를 못 고르고, 사장님은 손댈 곳을 모른다.
|
||||
thin = publish_gate.check_unique_content(unique_count_raw)
|
||||
if not thin.passed:
|
||||
# 위에서 evaluate 결과로 채워 둔 gate 를 덮는다 — 화면(GateRejectCard)은 이 값으로
|
||||
# 문구를 고르는데, passed=True 인 채로 두면 "서버 검수를 통과하지 못했습니다" 만 뜬다.
|
||||
result["gate"] = {"passed": False, **thin.as_log()}
|
||||
return await _fail(f"{thin.reason.name}: {thin.as_log()}", thin, stamp)
|
||||
# 나머지는 게이트로 설명되지 않는 실패(디스크·번들·payload 파손). 재시도가 의미 있다.
|
||||
return await _fail(str(report.get("error") or "렌더 실패"), None, stamp)
|
||||
|
||||
# DB 발행 상태를 바꾸기 전에 정적 파일을 외부 저장소에 올린다.
|
||||
|
||||
@@ -63,11 +63,20 @@ def check_required_fields(category: PlaceCategory, facts: list) -> GateResult:
|
||||
return GateResult(True)
|
||||
|
||||
|
||||
def check_unique_content(unique_content_count: int) -> GateResult:
|
||||
"""고유 콘텐츠 품질 진단용. 발행 게이트에서는 더 이상 호출하지 않는다.
|
||||
def check_unique_content(unique_content_count: int | None) -> GateResult:
|
||||
"""렌더러가 '고유 콘텐츠 0건' 으로 거부했을 때 사유 코드를 붙이는 자리.
|
||||
|
||||
evaluate() 는 이걸 부르지 않는다(얇은 콘텐츠로 발행을 막지 않기로 했다).
|
||||
부르는 곳은 build_service — 렌더 보고서가 실패로 왔을 때 그 이유를 되짚는다.
|
||||
|
||||
이 가게에만 있는 것(소개문·FAQ·객실 설명·사진 alt·템플릿 아닌 fact 값)이 0이면
|
||||
같은 템플릿 대량 생성으로 보인다. 그건 스팸 판정 대상이고, 판정되면 사이트가 통째로 무의미해진다."""
|
||||
같은 템플릿 대량 생성으로 보인다. 그건 스팸 판정 대상이고, 판정되면 사이트가 통째로 무의미해진다.
|
||||
|
||||
★ None 은 '0건' 이 아니라 '재지 못했다' 다. 렌더러가 디스크·번들 문제로 죽으면 계수가
|
||||
없는 채로 보고서가 온다 — 그걸 0 으로 읽으면 디스크 오류에 NO_UNIQUE_CONTENT 라는
|
||||
엉뚱한 사유가 붙는다. 판정하지 않고 통과시키고, 진짜 사유는 report.error 가 말한다."""
|
||||
if unique_content_count is None:
|
||||
return GateResult(True)
|
||||
if unique_content_count <= 0:
|
||||
return GateResult(False, PublishRejectReason.NO_UNIQUE_CONTENT, {"unique_content_count": unique_content_count})
|
||||
return GateResult(True)
|
||||
@@ -83,11 +92,17 @@ def check_jsonld_matches(mismatches: list) -> GateResult:
|
||||
return GateResult(True)
|
||||
|
||||
|
||||
def evaluate(category: PlaceCategory, facts: list, unique_content_count: int, mismatches: list) -> GateResult:
|
||||
def evaluate(
|
||||
category: PlaceCategory, facts: list, unique_content_count: int | None, mismatches: list
|
||||
) -> GateResult:
|
||||
"""게이트 전체. **처음 걸린 것에서 멈춘다** — 운영자가 하나씩 고치게 사유를 하나만 준다.
|
||||
|
||||
순서는 심각도 순: 미검증(클레임) → JSON-LD 불일치(거짓).
|
||||
|
||||
★ unique_content_count 는 받되 여기서 막지 않는다 — 얇은 콘텐츠는 '틀린 것' 이 아니다
|
||||
(test_evaluate_does_not_block_thin_content). 실제로 페이지 쓰기를 거부하는 쪽은
|
||||
렌더러이고, 그 사유는 build_service 가 check_unique_content 로 되짚어 라벨을 붙인다.
|
||||
|
||||
★ 업종 필수 항목 누락은 **막지 않는다**(2026-08-27 결정).
|
||||
막아야 할 것은 "틀린 정보가 나가는 것"이지 "정보가 덜 찬 것"이 아니다.
|
||||
영업시간이 비어 있어도 주소·전화가 확인된 페이지는 그 자체로 쓸모가 있고,
|
||||
|
||||
@@ -363,6 +363,15 @@ def _sections(saved_sections, default_spec) -> list:
|
||||
variant_id = _text(item.get("variantId"))
|
||||
if variant_id:
|
||||
entry["variantId"] = variant_id
|
||||
# ★ 사장님이 에디터에 직접 쓴 섹션 본문. variantId 와 같은 이유로 그대로 싣는다 —
|
||||
# 이 필드가 없던 동안 캔버스에 쓴 소개문은 payload 경계에서 통째로 버려졌다.
|
||||
# 저장(sites.theme)은 되는데 발행본에는 안 나오고, 고유 콘텐츠로도 세지 않아
|
||||
# "소개를 썼는데 발행이 고유 콘텐츠 0건으로 막힌다" 가 됐다.
|
||||
# ★ fact 가 아니라 검증 대상이 아니다. 사장님이 자기 가게에 대해 쓴 자기 문장이고,
|
||||
# 섹션 제목(name)이 이미 같은 경로로 나간다.
|
||||
body = _text(item.get("body"))
|
||||
if body:
|
||||
entry["body"] = body
|
||||
out.append(entry)
|
||||
|
||||
for sid, label, locked in default_spec:
|
||||
|
||||
Reference in new issue
Block a user