Repository navigation
Conversation
bas_dd 를 생략하면 KST 오늘 날짜 한 번만 조회해 휴장일/데이터 미공개 시 빈 결과(검색)나 404(base-info/trade-info)를 반환했다. instruction.md 는 '휴장일이면 최근 영업일로 다시 시도'를 약속하고 있다. - server.js: bas_dd 입력 여부(basDdExplicit)를 정규화 단계에서 구분하고, 응답 query.bas_dd 는 실제 사용한 날짜를 반환 - krx-stock.js: resolveBasDd 헬퍼로 하루씩(최대 10일) 뒤로 물러나 행이 있는 최근 영업일을 사용. 명시한 bas_dd 는 fallback 없이 그대로 사용하고, upstream 오류일 때는 추가 조회를 하지 않는다 - search/base-info 는 시장 스냅샷 캐시(buildBaseInfoSnapshotCacheKey)를 날짜별로 공유
This was referenced Nov 2, 2026
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.
Fixes #763
무엇을 고치나
korean-stock-search/instruction.md는bas_dd에 대해 "없으면 KST 오늘 날짜 기본값, 휴장일이면 최근 영업일로 다시 시도"라고 약속하지만, 프록시는 오늘 날짜로 한 번만 조회하고 재시도가 없었다. 그래서 문서상 기본 동작인bas_dd생략이 주말·휴장일·당일 데이터 미공개 시점에 빈 결과/404 를 돌려준다.재현 (프로덕션, 수정 전)
변경
server.js:normalizeKoreanStockDate→normalizeKoreanStockDateInput으로bas_dd입력 여부(basDdExplicit)를 함께 반환. 세 라우트(/search,/base-info,/trade-info)는bas_dd미지정일 때만 fallback 하고, 응답query.bas_dd에는 실제 사용한 날짜를 담는다. 캐시 키에도basDdExplicit를 포함해 "기본 날짜 요청"과 "오늘을 명시한 요청"이 같은 캐시 항목을 공유하지 않게 했다.krx-stock.js:resolveBasDd공용 헬퍼 추가. 행이 있으면 즉시 중단하고, 없으면 달력 기준으로 하루씩 최대 10일 뒤로 물러난다. 명시한bas_dd는 fallback 없이 그대로 사용하며, upstream 오류(모든 시장 실패)면 추가 조회를 하지 않아 장애 시 KRX 를 두들기지 않는다./base-info·/search는 날짜별 시장 스냅샷 캐시(buildBaseInfoSnapshotCacheKey)를 공유한다./trade-info가 프로덕션에서502 upstream_error+KRX API HTTP 오류 (status: 401)로 나오는 문제는 키에stk_bydd_trd권한이 없는 ops 이슈로, 이 PR 은 건드리지 않았다(401 메시지/코드는 기존 그대로).테스트
수정 전 실패 → 수정 후 통과:
korean stock search without bas_dd falls back to the most recent trading day— 수정 전items가 비어Cannot read properties of undefined (reading 'code')로 실패korean stock base-info without bas_dd falls back to the most recent trading day— 수정 전404 !== 200korean stock trade-info without bas_dd falls back to the most recent trading day— 수정 전404 !== 200korean stock endpoints honor an explicit bas_dd without fallback probing— 명시한 날짜는 시장별 1회씩만 조회(추가 probe 없음)하고 404/빈 결과 유지korean stock default bas_dd fallback stops after a bounded lookback— 데이터가 아예 없을 때 최대 10일까지만 조회korean stock default bas_dd does not probe older days while the upstream is failing— upstream 장애 시 뒤로 물러나지 않음전체 스위트:
cd packages/k-skill-proxy && node --test→ 492 pass / 0 fail / 2 skipped.npm run lint통과. 프록시 전용 수정이라 changeset 없음.