[feat] solution,postgres-init,docs: 생성 진행 상태 · 새로 만들기 존중 · 발행본 색인·파비콘

작업트리에 커밋되지 않은 채 쌓여 있던 것과, 오늘 찾은 문제 셋을 함께 담는다.

## 1. 콘텐츠 생성 진행 상태 (작업트리에 있던 것)

COPY 잡의 실제 단계를 DB에 기록하고 응답으로 내보낸다. 폴링 횟수로 진행률을 흉내 내던
것을 걷어냈다. 새로고침·재접속해도 jobId 로 이어서 본다.

- services/copy_steps.py · services/job_progress.py · common/job_errors.py (신규)
- postgres-init/migrations/0013_job_progress.sql + init.sql
- 프론트: useGenerationJob · generationLabels (신규), Step5Generating·pollJob 배선,
  orval 모델 갱신(jobProgress · jobStep · jobStepStatus · jobStepReason)
- docs/GENERATION_FLOW.md (신규)

## 2. 발행된 사이트만 색인한다

실측(2026-09-15): 디스크의 발행본 33곳 중 **15곳이 draft 인데 `index, follow`** 였고
사이트맵에도 올라가 있었다. 사장님이 발행 버튼을 누른 적 없는 사이트가 짓다 만 상태로
구글에 실려 있었다는 뜻이다.

head.ts 가 robots 를 하드코딩하고 payload 의 `site.status` 를 보지 않았다.
"색인을 막을 이유가 없다"는 주석은 굽는 것이 곧 발행이던 시절의 말인데, 지금은 빌더
미리보기만 눌러도 draft 로 구워진다.

- seo/head.ts: PUBLISHED 일 때만 index, 아니면 `noindex, follow`
- 사이트맵·`/s` 목록·llms.txt 에서도 함께 빠진다 — 그쪽은 구운 HTML 의 robots 를 읽어
  거른다(seo/directory.ts readBakedNoindex). 규칙을 두 자리에 두지 않으려고 한 곳에 뒀다

## 3. [새로 크롤링하고 사이트 생성하기] 를 뒤집지 않는다

ba90a19 의 중복 합치기가 **일부러 다시 만들려는 경우까지** 기존 사업장으로 끌고 갔다 —
새로 만들기를 눌렀는데 기존 에디터가 열린다(사장님 보고 2026-09-15).

- Req_VerifyPlaceByUrl.reuse_existing (기본 True — 다른 호출자의 동작은 그대로)
- place_service.verify_place_by_url: 끄면 이어붙이지 않는다. 다만 **비어 있는 중복 행은
  계속 치운다** — 원래 막으려던 누적이 그것이고 빈 행은 잃을 것이 없다
- ensureServerPlace: 위저드는 새로 만들기 경로에서만 오므로 False 로 보낸다

## 4. 발행본 파비콘

발행본에 파비콘 링크가 아예 없어 브라우저 탭에 기본 아이콘이 떴다. 파일은 오리진 루트의
공용 자산이라 사이트마다 복사하지 않고 루트 절대경로로 가리킨다.

검증: site vitest 84건 통과 · tsc(site·frontend) · eslint 통과.
백엔드 pytest 는 로컬 DB 비밀번호가 맞지 않아 돌리지 못했다(a5b8701 과 같은 자리).
발행본 반영에는 전체 재굽기가 필요하다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5 committed 2026-09-15 17:29:27 +09:00
1 parent 4cd756108d
commit 079c93a62a
60 files changed
+1465 -596

No files matched your search

+39 -21
View File
@@ -126,27 +126,38 @@ async def test_llm_cannot_overwrite_corrected_sentence(auth_headers, client):
# ── 생성 프로세스 ─────────────────────────────────────────────────────────
async def test_crawled_fact_starts_as_candidate_and_is_not_published(auth_headers, client):
async def test_crawled_fact_publishes_immediately(auth_headers, client):
"""검증: 크롤링으로 처음 들어온 값.
기대결과: UNVERIFIED 후보로 남고 사이트에 안 나간다 — ★ 절대규칙 1."""
기대결과: 빈 자리이므로 **바로 노출값**이 된다(2026-09-14 결정).
★ 예전에는 UNVERIFIED 후보로 남겼다. 수집이 끝난 뒤에야 오는 값이라 사장님이 승인할
화면을 이미 지나가 있었고, 확인된 사실이 하나도 없는 채로 발행 게이트에 걸렸다.
★ 승인 이력과는 verified_by 로 구별한다 — 자동 노출은 비어 있다. 사람이 본 적 없다는
사실 자체를 지우면 나중에 '누가 확인했나' 를 되짚을 수 없다."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="p1")
body = await _crawl(client, h, pid, "check_in_time", "15:00")
assert body["outcome"] == FactWriteOutcome.CANDIDATE_CREATED.value
assert body["fact"]["status"] == FactStatus.UNVERIFIED.value
assert body["outcome"] == FactWriteOutcome.PUBLISHED_CREATED.value
assert body["fact"]["status"] == FactStatus.VERIFIED.value
# 응답에서 None 필드는 지워져 나간다(RemoveNoneResponse) — 없는 것이 곧 비어 있다는 뜻이다.
assert body["fact"].get("verified_by") is None, "★ 자동 노출을 사람 승인으로 위장하면 안 된다"
listed = await _facts(client, h, pid)
assert listed["publishable"] == 0
assert (await _facts(client, h, pid, publishable_only=True)).get("facts", []) == []
assert listed["publishable"] == 1
assert (await _facts(client, h, pid, publishable_only=True))["facts"][0]["value"] == "15:00"
async def test_approving_candidate_publishes_it(auth_headers, client):
"""검증: 후보를 VERIFIED 로 승인한다.
기대결과: verified_at 이 찍히고 사이트에 나갈 수 있게 된다."""
기대결과: verified_at 이 찍히고 그 값이 노출값 자리를 가져간다.
★ 후보는 사장님이 직접 넣은 값 위에 다른 수집값이 올 때 생긴다 — 크롤링끼리는
뒤에 온 값이 앞의 값을 바로 대체하므로(위 테스트) 여기서 사람 입력을 먼저 둔다."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="p2")
fid = (await _crawl(client, h, pid, "check_in_time", "15:00"))["fact"]["fact_id"]
await _own(client, h, pid, "check_in_time", "15:00")
fid = (await _crawl(client, h, pid, "check_in_time", "16:00"))["fact"]["fact_id"]
body = (await client.post(f"/v1/place/{pid}/fact/{fid}/transition", headers=h,
json={"status": FactStatus.VERIFIED.value})).json()
@@ -158,10 +169,12 @@ async def test_approving_candidate_publishes_it(auth_headers, client):
async def test_illegal_transition_is_rejected(auth_headers, client):
"""검증: UNVERIFIED → CORRECTED 처럼 전이표에 없는 이동.
기대결과: FACT_INVALID_TRANSITION — 확인을 건너뛴 '정정본'은 만들 수 없다."""
기대결과: FACT_INVALID_TRANSITION — 확인을 건너뛴 '정정본'은 만들 수 없다.
★ UNVERIFIED 는 이제 공식 API 수집이 빈 자리에 넣을 때 생긴다(크롤링은 바로 노출)."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="p3")
fid = (await _crawl(client, h, pid, "check_in_time", "15:00"))["fact"]["fact_id"]
fid = (await _crawl(client, h, pid, "check_in_time", "15:00", SourceType.API))["fact"]["fact_id"]
r = await client.post(f"/v1/place/{pid}/fact/{fid}/transition", headers=h,
json={"status": FactStatus.CORRECTED.value, "value": "16:00"})
@@ -185,12 +198,14 @@ async def test_recrawl_same_value_keeps_verification(auth_headers, client):
async def test_recrawl_changed_value_keeps_site_and_queues_candidate(auth_headers, client):
"""검증: 확인된 값과 다른 값을 재수집한다(OTA 가 바뀐 경우).
기대결과: ★ 노출값은 그대로 살아 있고, 새 값은 PENDING_OWNER 후보로만 쌓인다."""
"""검증: 사장님이 넣은 값과 다른 값을 재수집한다(OTA 가 바뀐 경우).
기대결과: ★ 노출값은 그대로 살아 있고, 새 값은 PENDING_OWNER 후보로만 쌓인다.
★ 자동 수집이 사람이 넣은 값을 밀어내지 못한다는 것이 이 테스트의 본체다.
크롤링이 직전 크롤링 값을 대체하는 것과는 다른 얘기다(위 즉시 노출 결정)."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="r2")
fid = (await _crawl(client, h, pid, "check_in_time", "15:00"))["fact"]["fact_id"]
await client.post(f"/v1/place/{pid}/fact/{fid}/transition", headers=h, json={"status": FactStatus.VERIFIED.value})
await _own(client, h, pid, "check_in_time", "15:00")
body = await _crawl(client, h, pid, "check_in_time", "16:00")
assert body["outcome"] == FactWriteOutcome.CANDIDATE_CREATED.value
@@ -208,8 +223,7 @@ async def test_approving_candidate_replaces_published_value(auth_headers, client
기대결과: 후보가 노출값이 되고 옛 값은 EXPIRED 이력으로 내려간다. 노출값은 여전히 1건."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="r3")
old = (await _crawl(client, h, pid, "check_in_time", "15:00"))["fact"]["fact_id"]
await client.post(f"/v1/place/{pid}/fact/{old}/transition", headers=h, json={"status": FactStatus.VERIFIED.value})
await _own(client, h, pid, "check_in_time", "15:00")
new = (await _crawl(client, h, pid, "check_in_time", "16:00"))["fact"]["fact_id"]
body = (await client.post(f"/v1/place/{pid}/fact/{new}/transition", headers=h,
@@ -227,8 +241,7 @@ async def test_repeated_recrawl_does_not_pile_up_candidates(auth_headers, client
기대결과: 후보가 쌓이지 않고 하나가 갱신된다(사람 확인 큐가 중복으로 넘치지 않게)."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="r4")
fid = (await _crawl(client, h, pid, "check_in_time", "15:00"))["fact"]["fact_id"]
await client.post(f"/v1/place/{pid}/fact/{fid}/transition", headers=h, json={"status": FactStatus.VERIFIED.value})
await _own(client, h, pid, "check_in_time", "15:00")
await _crawl(client, h, pid, "check_in_time", "16:00")
body = await _crawl(client, h, pid, "check_in_time", "17:00")
@@ -303,13 +316,18 @@ async def test_publishing_marks_place_for_rebuild(auth_headers, client):
async def test_crawl_only_does_not_mark_rebuild(auth_headers, client):
"""검증: 크롤링이 후보만 쌓았을 때 재빌드 표시.
기대결과: 안 찍힌다 — 사이트에 나가는 내용이 안 바뀌었으니 재빌드가 필요 없다."""
기대결과: 안 찍힌다 — 사이트에 나가는 내용이 안 바뀌었으니 재빌드가 필요 없다.
★ 노출값을 바꾼 수집은 반대로 찍혀야 한다(그게 needs_rebuild 의 뜻이다).
그래서 사장님 값 위에 올라온 **후보** 경로로 확인한다."""
h = await auth_headers("u1")
pid = await _verified_place(client, h, kakao="o4")
await _own(client, h, pid, "check_in_time", "15:00")
before = (await client.get(f"/v1/place/{pid}", headers=h)).json()["place"].get("content_updated_at")
await _crawl(client, h, pid, "check_in_time", "15:00")
await _crawl(client, h, pid, "check_in_time", "16:00")
place = (await client.get(f"/v1/place/{pid}", headers=h)).json()["place"]
assert place.get("content_updated_at") is None
assert place.get("content_updated_at") == before, "후보만 쌓였는데 재빌드 대상이 됐다"
async def test_facts_are_scoped_to_owner(auth_headers, client):