fix: 테스트 격리 DB의 운영 백업 오염 차단 — 복원 리허설로 발견한 동형 재발 결함 - #419
Merged
Conversation
복원 리허설(백업이 실제로 복원 가능한지 첫 실측)에서 발견: 당일 운영 백업이 빈 DB였다. 원인 — 테스트가 run_daily_backup을 monkeypatch 없이 실행하면 (test_critical_fixes의 run_rebalance 경로), conftest의 QUANT_DB_PATH 격리는 DB만 격리하고 백업 경로는 격리하지 않아, 격리된(빈) DB가 같은 날짜 파일명으로 운영 data/backups/에 백업돼 진짜 백업을 덮어썼다. 과거 'DB 복구 사건'(테스트가 운영 DB를 삭제)과 동형의 결함이 백업 경로에서 재발한 것. 가드: QUANT_DB_PATH(격리 DB)가 설정된 환경에서는 QUANT_BACKUP_PATH를 명시하지 않는 한 운영 backup_path에 쓰지 않는다(skip+debug 로그). 운영 환경(env 미설정) 은 기존과 동일. 복구: 운영 백업 재생성 후 복원 리허설 재검증 — 바스켓 키 거래 9·포지션 9· 스냅샷 1(NAV 9,960,286) 보존 확인, 오염된 빈 백업 삭제. 회귀 테스트 3건(격리 시 거부/완전 격리 시 수행/운영 환경 정상). 전체 1493 passed. 교훈: 백업은 '복원 리허설'까지가 백업이다 — 존재만 확인한 백업은 검증된 것이 아니다.
easygap
added a commit
that referenced
this pull request
Jun 11, 2026
fix: 테스트의 운영 추적 파일(reports/) 오염 일괄 차단 — #419 스택
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
fix: 테스트 격리 DB의 운영 백업 오염 차단 — 복원 리허설로 발견한 동형 재발 결함
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
백업 오염(#419)과 동형의 경로 둘을 추가 적발·차단: 1) reports/sector_map_cache.json — git 추적되는 운영 캐시(상관관계 리스크 체크가 소비)인데, 개별 테스트가 SECTOR_MAP_CACHE_PATH monkeypatch를 잊으면 테스트 데이터가 운영 캐시를 덮어썼다(매 스위트 실행 후 working tree dirty로 관찰되던 원인). conftest autouse fixture로 전 테스트 일괄 임시 경로 강제 — 개별 테스트의 기억에 의존하지 않는다. 2) reports/full_paper_lifecycle_test.json — test_paper_lifecycle이 추적 파일을 매 실행 덮어씀. 산출물은 tmp_path로, 추적 파일은 과거 검증 증빙으로 보존. 검증: 전체 1493 passed 후 git status에서 reports/ 오염 0 확인(이전엔 매번 M 2건). 백업 가드(#419 스택) 동작으로 운영 백업도 무손상(바스켓 거래 9건 유지).
easygap
added a commit
that referenced
this pull request
Jul 6, 2026
fix: 테스트의 운영 추적 파일(reports/) 오염 일괄 차단 — #419 스택
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
발견 경위 (17번째 감사 라운드 — 복원 리허설)
백업이 실제로 복원 가능한지 첫 실측을 수행하다 발견: 당일 운영 백업이 빈 DB였다(거래 0·포지션 0). 운영 DB 자체는 무사.
원인 (과거 'DB 복구 사건'과 동형의 재발)
테스트가
run_daily_backup을 monkeypatch 없이 실행하면(test_critical_fixes의run_rebalance경로), conftest의QUANT_DB_PATH격리는 DB만 격리하고 백업 경로는 격리하지 않아, 격리된(빈) DB가 같은 날짜 파일명으로 운영data/backups/에 백업돼 진짜 백업을 덮어썼다.수정
QUANT_DB_PATH(격리)가 설정된 환경에서는QUANT_BACKUP_PATH를 명시하지 않는 한 운영 backup_path에 쓰지 않는다(fail-safe skip). 운영 환경은 기존과 동일.복구·검증
교훈
백업은 복원 리허설까지가 백업이다 — 존재만 확인한 백업은 검증된 것이 아니다. (주간 운영 점검에 복원 리허설 포함 권장)