mirror of
https://github.com/NomaDamas/k-skill.git
synced 2026-06-24 02:04:11 +00:00
Keep LOST112 curl guidance usable under live latency
The helper's emitted POST example still timed out against LOST112 in live verification because the 20-second timeout budget was too short for the observed form-submit path. Raise the generated timeout to 60 seconds, lock that contract in the regression, and align the skill/doc wording so users receive guidance that matches the runnable command. Constraint: LOST112 live POST latency can exceed 20 seconds even when reachability probes succeed Rejected: Keep 20 seconds and rely on manual retry | still ships a broken default curl_example Confidence: high Scope-risk: narrow Reversibility: clean Directive: If the timeout budget changes again, rerun the exact emitted curl_example against LOST112 rather than only the lightweight reachability probe Tested: python3 -m unittest scripts.test_subway_lost_property Tested: python3 scripts/subway_lost_property.py --station 강남역 --item 지갑 --days 14 --verify-live Tested: npm run ci Not-tested: Long-term LOST112 latency drift beyond the currently observed 60-second budget
This commit is contained in:
parent
748967c21c
commit
32a33c3ce5
4 changed files with 7 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ LOST112에서 실제로 중요한 검색 조건은 아래와 같다.
|
|||
## 기본 흐름
|
||||
|
||||
1. 사용자에게 역명, 물품명, 대략의 날짜를 먼저 받는다.
|
||||
2. helper로 LOST112 payload와 referer가 포함된 runnable `curl` 예시를 생성한다. 예시 `curl` 은 응답 HTML을 `lost112-search-result.html` 로 저장한다.
|
||||
2. helper로 LOST112 payload와 referer가 포함된 runnable `curl` 예시를 생성한다. 예시 `curl` 은 느린 공식 응답을 감안해 `--max-time 60` 을 포함하고, 응답 HTML을 `lost112-search-result.html` 로 저장한다.
|
||||
3. 역명 그대로 검색한 뒤, 결과가 없으면 `역` 없는 키워드나 호선명으로 넓힌다.
|
||||
4. 서울교통공사 유실물센터 페이지를 함께 열어 후속 절차를 확인한다.
|
||||
|
||||
|
|
@ -64,6 +64,7 @@ python3 scripts/subway_lost_property.py \
|
|||
- `payload.SITE` 가 `V` 로 고정되어 있는지
|
||||
- `payload.DEP_PLACE` 에 역명 키워드가 들어갔는지
|
||||
- `curl_example` 에 `--referer https://www.lost112.go.kr/` 가 포함되어 있는지
|
||||
- `curl_example` 에 `--max-time 60` 이 포함되어 있는지
|
||||
- `curl_example` 에 `--output lost112-search-result.html` 가 포함되어 있는지
|
||||
- `curl_example` 이 `https://www.lost112.go.kr/find/findList.do` 를 사용하는지
|
||||
- `official_sources` 에 LOST112 와 서울교통공사 URL이 모두 들어 있는지
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ class SubwayLostPropertyQueryTest(unittest.TestCase):
|
|||
self.assertIn("강남", plan.suggested_keywords)
|
||||
command = shlex.split(build_curl_command(plan.payload))
|
||||
self.assertNotIn("-L", command)
|
||||
self.assertIn("--max-time", command)
|
||||
self.assertEqual(command[command.index("--max-time") + 1], "60")
|
||||
self.assertIn("--referer", command)
|
||||
self.assertEqual(command[command.index("--referer") + 1], "https://www.lost112.go.kr/")
|
||||
self.assertIn("--output", command)
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ python3 scripts/subway_lost_property.py \
|
|||
--days 14
|
||||
```
|
||||
|
||||
helper는 기본적으로 `SITE=V` 를 사용하고, 역명/물품명/기간을 LOST112 form payload와 **referer까지 포함한 runnable `curl` 예시**로 정리해 준다. 예시 `curl` 은 응답 HTML을 `lost112-search-result.html` 로 저장한다.
|
||||
helper는 기본적으로 `SITE=V` 를 사용하고, 역명/물품명/기간을 LOST112 form payload와 **referer까지 포함한 runnable `curl` 예시**로 정리해 준다. 예시 `curl` 은 느린 공식 응답을 감안해 `--max-time 60` 을 포함하고, 응답 HTML을 `lost112-search-result.html` 로 저장한다.
|
||||
|
||||
### 3) Optionally verify live reachability
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from typing import Callable
|
|||
LOST112_LIST_URL = "https://www.lost112.go.kr/find/findList.do"
|
||||
LOST112_REFERER_URL = "https://www.lost112.go.kr/"
|
||||
LOST112_OUTPUT_FILE = "lost112-search-result.html"
|
||||
LOST112_CURL_MAX_TIME = 60
|
||||
SEOUL_METRO_LOST_CENTER_URL = "https://www.seoulmetro.co.kr/kr/page.do?menuIdx=541"
|
||||
CURL_USER_AGENT = "Mozilla/5.0"
|
||||
|
||||
|
|
@ -117,7 +118,7 @@ def _base_curl_command(url: str | None, max_time: int, *, follow_redirects: bool
|
|||
|
||||
|
||||
def build_curl_command(payload: dict[str, str]) -> str:
|
||||
command = _base_curl_command("", 20, follow_redirects=False)
|
||||
command = _base_curl_command("", LOST112_CURL_MAX_TIME, follow_redirects=False)
|
||||
command.extend(["--referer", LOST112_REFERER_URL])
|
||||
for key, value in payload.items():
|
||||
if value:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue