fix(test): 공용 시드에 care_config 싱글턴 보장 — t11·t12 CI 실패 해소 - #129
Merged
Conversation
pmdb main 은 2026-07-23 이후 db-tests 가 계속 빨간불이었다. 원인은 테스트도 함수도 아니고 **CI 환경에만 없는 행**이다. dump_schema.sh 는 구조만 덤프한다(데이터 제외). 그래서 CI 컨테이너의 app.care_config 는 0행이고, app.phone_hmac 의 `select hmac_key into v_key from app.care_config` 가 NULL 을 집는다 → extensions.hmac(digits, NULL, 'sha256') 이 NULL → create_care_report 가 번호를 못 읽었다며 invalid_phone(P0001) 을 던진다. · t11: 단언 2 가 죽고 3·4·6·7·8 이 연쇄 실패(케어 리포트가 안 만들어지므로) · t12: 아예 SQL 오류로 파일 중단 운영 DB 직행 검증(기존 관행)에서는 care_config 행이 이미 있어 통과하므로 CI 에서만 드러났다 — 운영 확인 결과 1행 존재, phone_hmac 정상. seed.sql 에 넣은 이유: care 기능을 쓰는 t11·t12 가 모두 이 시드를 포함하고, 앞으로 추가될 케어 테스트도 같은 함정을 밟는다. hmac_key 는 컬럼 기본값(랜덤 32바이트)에 맡긴다 — 발행·조회가 한 트랜잭션 안에서 끝나므로 키 값 자체는 무관하고 운영 키를 흉내 낼 이유도 없다. 이미 행이 있으면 no-op 이라 운영 직행 검증에도 영향이 없다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
pmdb main 은 2026-07-23 이후 db-tests 가 계속 빨간불이었다. 최근 5개 런 전부 실패.
원인은 테스트도 함수도 아니고 CI 환경에만 없는 행이다.
원인
dump_schema.sh는 구조만 덤프한다(데이터 제외). 그래서 CI 컨테이너의app.care_config는 0행이고, 위 경로를 타는 테스트가 전부 깨진다.발행 성공)가 죽고, 케어 리포트가 안 만들어지니 3·4·6·7·8 이 연쇄 실패ERROR: invalid_phone으로 파일 중단운영 DB 직행 검증(이 저장소의 기존 관행)에서는
care_config행이 이미 있어 통과하므로 CI 에서만 드러났다. 운영 확인 결과 1행 존재,phone_hmac정상 동작.수정
helpers/seed.sql에 싱글턴 행을 보장한다.hmac_key는 컬럼 기본값(랜덤 32바이트)에 맡긴다 — 발행·조회가 한 트랜잭션 안에서 끝나므로 키 값 자체는 무관하고, 운영 키를 흉내 낼 이유도 없다.검증
로컬에서 이 수정을 진짜로 검증하려면
app.care_config행이 없는 환경이 필요한데, 운영의 그 행은 실제 HMAC 키라 지우면 기존 케어 리포트의 전화번호 대조가 깨진다. 그래서 건드리지 않았고, 이 PR 의 CI 가 검증이다.머지 후 #128 을 리베이스하면 그쪽도 초록불이 된다(#128 의 t15 는 이미 6개 전부 통과 중이었다).
🤖 Generated with Claude Code