fix: 2026-10-15 코드 검토 F01~F10 — 수집 실패 전파·트랜잭션 경계·저장 실패·공지 버전/확인 조건·테스트 체계

- F01 쿠팡: HTTP 200 비JSON·data 목록 없음은 수집 실패(기간 교체 안 함), 정상 빈 목록과 구분
- F02 회의록 [적용]: 업무 INSERT 와 줄 연결을 한 연결·한 트랜잭션(_insert_task), 확인은 잠그기 전·알림/메일은 커밋 뒤, 줄 바뀜 409
- F03 업무 등록 표: persist 실패 전파, 미저장이면 [적용] 중단, 초안 유지·다시 저장·이탈 경고
- F04 인증정보 변경 시 내부 토큰 삭제 + 네이버·토스 토큰을 발급 인증정보 지문(SHA-256)에 묶음, GS샵 방식 캐시도 키 지문 기준
- F05 쪽 수 상한·커서 반복 = 실패(쿠팡은 구간을 하루까지 나눠 재시도), 네이버·카카오·토스·GS샵 동일 기준
- F06 [중지] 확인과 저장 시작을 같은 잠금(begin_saving), 저장 시작 뒤 중지 불가
- F07/F08 긴급 공지: 내용 version·고친 공지 다시 그리기·확인에 version(409), 확인은 행 잠금 트랜잭션에서 수신자·표시 시각·취소 검증
- F09 쇼핑몰 연결 테스트도 clear 처리·저장 안 한 시험은 상태 유지(광고 테스트와 같은 계약)
- F10 DB 테스트 skip·가짜 app.main/time.sleep 파일 범위 fixture, 오래된 기대값 갱신, pytest.ini·requirements-dev·tests/js/package.json·docs/TESTING.md
- 결과·후속 과제: docs/CODE_REVIEW_2026-10-15_RESULT.md (마이그레이션·환경변수 변경 없음)

Python 440 passed/63 skipped(DB 없음), 503 passed(로컬 PostgreSQL), jsdom 7종·Edge 6종 통과

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 18:41:42 +09:00
parent edd5a97a9b
commit c7cc94a09c
51 changed files with 1536 additions and 222 deletions
+14 -4
View File
@@ -159,7 +159,11 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
!up.classList.contains("is-manual") && man.classList.contains("is-manual") && gross(up) === "220,000");
check("[광고비] 앞으로의 날은 입력 칸 아님", !cell(e, "google", "2026-10-08") && !!cell(e, "google", "2026-10-07"));
const kpi = Array.from(e.d.querySelectorAll(".perf-kpi-value")).map(function (n) { return n.textContent.trim(); });
check("[광고비] KPI — 이번달 광고비 599,000(네이버 300,000 포함) · 매출 대비 비율", kpi[0] === "₩599,000" && /%$/.test(kpi[1]), kpi);
// 렌더 데이터(render_performance.py)에 구글 광고 API 값 10/04 123,457 이 더해졌다(2026-10-15 구글 광고 API 연동)
check("[광고비] KPI — 이번달 광고비 722,457(네이버 300,000·구글 API 123,457 포함) · 매출 대비 비율", kpi[0] === "₩722,457" && /%$/.test(kpi[1]), kpi);
const api = cell(e, "google", "2026-10-04");
check("[광고비] 광고 API 값 = 초록(is-api) — 직접 입력·업로드 표시와 구분, 구글 ROAS(500%)", api.classList.contains("is-api") &&
!api.classList.contains("is-manual") && !api.classList.contains("is-upload") && api.textContent.trim() === "123,457(500%)", api.className + " " + api.textContent);
wing.click();
const wi = wing.querySelector(".perf-manual-input");
wi.value = "30000";
@@ -219,7 +223,9 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
const nv = cell(e, "naver", "2026-10-03");
check("[네이버] 칸 = 광고비(보고서 ROAS 반올림)", nv.textContent.trim() === "300,000(251%)", nv.textContent);
const hb = e.d.querySelector('.perf-main thead [data-detail-channel="naver"]');
check("[네이버] 머리글 = 상세 보기 버튼(다른 채널은 아님)", !!hb && e.d.querySelectorAll(".perf-main thead [data-detail-channel]").length === 1);
const detailChans = Array.from(e.d.querySelectorAll(".perf-main thead [data-detail-channel]")).map(function (b) { return b.dataset.detailChannel; });
// 구글도 광고 API 로 가져온 보고서 항목이 있어 상세 보기(2026-10-15) — 그 밖의 채널은 아님
check("[네이버] 머리글 = 상세 보기 버튼(네이버·구글만)", !!hb && detailChans.sort().join(",") === "google,naver", detailChans);
hb.click(); await settle();
const call = e.calls.find(function (c) { return /\/details/.test(c.url); });
check("[네이버] 지금 기간으로 상세 요청", call && call.url === "/performance/api/ad-spend/naver/details?from=2026-10-01&to=2026-10-31", e.calls);
@@ -233,10 +239,14 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
// ── 설정: 수동 입력 토글 ──
{
const e = await env("perf_settings.html");
const heads = Array.from(e.d.querySelectorAll(".perf-set-table thead th")).map(function (th) { return th.textContent.trim(); });
// 쇼핑몰 표만(아래 "광고 API 연동" 표도 같은 표 모양 — 2026-10-15)
const SHOP = ".perf-card:not(#perf-ad-sources) .perf-set-table";
const heads = Array.from(e.d.querySelectorAll(SHOP + " thead th")).map(function (th) { return th.textContent.trim(); });
check("[설정] '수동 입력' 열(매출 집계 다음)", heads.indexOf("수동 입력") === heads.indexOf("매출 집계") + 1, heads);
const rows = Array.from(e.d.querySelectorAll(".perf-set-table tbody tr")).map(function (tr) { return tr.dataset.code; });
const rows = Array.from(e.d.querySelectorAll(SHOP + " tbody tr")).map(function (tr) { return tr.dataset.code; });
check("[설정] 쇼핑몰 순서 = 어댑터 등록 순서(003 열 순서)", rows.join(",") === "cafe24,naver,coupang,ohouse,gmarket,kakao,gsshop,elevenst,lotteon,toss", rows);
const adRows = Array.from(e.d.querySelectorAll("#perf-ad-sources tbody tr")).map(function (tr) { return tr.dataset.code + ":" + tr.dataset.api; });
check("[설정] 광고 API 연동 표는 따로(구글 광고, /api/ad-sources/)", adRows.join(",") === "google:ad-sources", adRows);
const box = e.d.querySelector('tr[data-code="coupang"] input[data-field="manual_input"]');
check("[설정] 켜진 쇼핑몰은 체크", box && box.checked && !e.d.querySelector('tr[data-code="cafe24"] input[data-field="manual_input"]').checked);
box.checked = false;