Skip to content

fix(schedule): 장소 존재 검증이 빈 조회 결과를 놓치던 문제 수정 - #7

Merged
SD-gif merged 1 commit into
mainfrom
fix/place-existence-validation-signal
Aug 11, 2026
Merged

fix(schedule): 장소 존재 검증이 빈 조회 결과를 놓치던 문제 수정#7
SD-gif merged 1 commit into
mainfrom
fix/place-existence-validation-signal

Conversation

@SD-gif

@SD-gif SD-gif commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

#6 의 후속입니다. 배포 후 검증하다 제가 넣은 로직의 허점을 발견했습니다.

문제

#6 에서 Preview 의 장소 존재 검증을 이렇게 넣었습니다.

found = load_candidate_places_by_ids(place_ids)
if not found:
    return          # DB 를 못 읽는 환경으로 간주하고 건너뜀

요청한 id 가 전부 존재하지 않으면 found 가 빈 dict 입니다. 그걸 조회 실패로 오인해 그냥 통과시킵니다. 정확히 잡아야 할 경우를 놓칩니다.

dev 배포 후 확인한 실제 응답입니다.

POST /schedule-previews  mustVisitPlaceIds:[999999]
→ 201  {"status":"READY","canGenerate":true}      ← 막혔어야 함

수정

load_candidate_places_by_ids 의 반환값이 세 경우를 구분하게 합니다.

반환 의미
{...} 조회 성공. 없는 id 는 키에 없다
{} 조회는 됐지만 해당 id 가 하나도 없다
None DB 를 읽을 수 없다. 존재 검증을 하면 안 된다

Preview 는 None 일 때만 검증을 건너뜁니다. 나머지 호출부는 or {} 로 받습니다.

검증

네 가지 경우를 모두 확인했습니다.

조회 불가(None)        → 통과          (조회 실패를 입력 오류로 만들지 않음)
조회됨, 결과 없음({})   → 400 placeIds do not exist: [999999]
일부만 없음            → 400 placeIds do not exist: [999999]
전부 존재              → 통과

배포 후 dev 에서 확인할 것:

POST /schedule-previews  mustVisitPlaceIds:[999999]  → 400
POST /schedule-previews  mustVisitPlaceIds:[33]      → 201 READY

🤖 Generated with Claude Code

앞선 커밋에서 Preview 의 장소 존재 검증을 이렇게 넣었다.

    found = load_candidate_places_by_ids(place_ids)
    if not found:
        return          # DB 를 못 읽는 환경으로 간주하고 건너뜀

요청한 id 가 전부 존재하지 않으면 found 가 빈 dict 다. 그것을 조회 실패로
오인해 그냥 통과시켰다. 정확히 잡아야 할 경우를 놓친 것이다.

dev 배포 후 확인했더니 없는 placeId 로도 Preview 가 201 READY 로 나갔다.

load_candidate_places_by_ids 의 반환값이 세 경우를 구분하게 한다.

    {...}  조회 성공. 없는 id 는 키에 없다.
    {}     조회는 됐지만 해당 id 가 하나도 없다.
    None   DB 를 읽을 수 없다. 호출부는 존재 검증을 하면 안 된다.

Preview 는 None 일 때만 검증을 건너뛴다. 나머지 호출부는 `or {}` 로 받는다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@SD-gif
SD-gif merged commit 3669b2d into main Aug 11, 2026
@SD-gif
SD-gif deleted the fix/place-existence-validation-signal branch August 11, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant