Repository navigation
fix(express-bus-booking): KOBUS 주석 템플릿을 운행편에서 제외 (#698) - #702
Merged
Merged
Conversation
KOBUS 응답은 실제 fnSatsChc('...') 호출과 HTML 주석 프로토타입
fnSatsChc(deprTime,...)을 함께 담는다. 파서가 원본 전체를 대상으로
정규식을 돌려 주석 템플릿까지 운행편으로 만들었고, 그 결과 편수가
2배가 되고 raw_args=[]·departure_time=null 항목이 생겨 선점 단계에서
IndexError가 났다.
주석/템플릿을 먼저 제거하고, 여는 따옴표가 있는 실제 호출만 매칭하며,
필수 인자 수(14) 미만은 버린다. --select-index 범위 검증도 추가한다.
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 #698
원인
KOBUS
mrs/alcnSrch.do응답에는 실제onclick="fnSatsChc('...')"호출과 HTML 주석 템플릿<!-- fnSatsChc(deprTime,alcnDeprTime,...) -->가 함께 들어 있습니다. 기존 파서는 원본 HTML 전체에 대해fnSatsChc\((.*?)\)를 실행해 주석 템플릿까지 운행편으로 만들었고,raw_args=[]·departure_time=null인 가짜 항목이 섞여 편수가 2배가 되었습니다. 그 항목을 선택하면seat_stage_fields()의a[1]접근에서IndexError가 났습니다.변경
HTML_COMMENT_RE로 주석을 먼저 제거한 뒤 호출을 파싱합니다.FN_SATS_RE가(바로 뒤 따옴표를 요구하도록 해 템플릿(deprTime,...)과 함수 정의를 매칭에서 제외합니다.MIN_SATS_ARGS=14(seat_stage_fields()가 읽는 최대 인덱스 13 + 1) 미만 항목은 결과에서 버립니다.parse_schedules()로 분리해 네트워크 없이 테스트합니다.--select-index가 범위를 벗어나면IndexError대신 명시적SystemExit을 냅니다.검증
express-bus-booking/tests/test_kobus_express_booking.py신규: 주석/템플릿 제외, 주석 처리된 실제 호출 제외, 불완전 인자 드롭, index 연속성, select-index 범위 오류(11 tests).--depart-code 021 --arrive-code 500 --date 20261010→count=114(기존 228),departure_time=null항목 없음.--select-index 200 --hold-first-seat→--select-index 200 is out of range: parsed 114 schedule(s) (valid range 1-114).체크
npm run lint통과,npm run sync:cli-skills반영.