fix(site-import): FetchError 白话化映射(spec §6 行1)+ 预算语义注记
_pipeline 增 FetchError 分支(先于通用异常兜底):入口页不可达/超时—— 最高频真实失败路径——映射白话文案「网站打不开或响应太慢——检查 URL」 + phase=crawl(不可 retry);ImportTask docstring 的抓取失败归档口径 同步对齐。crawler 模块 docstring 注记 MAX_PAGES 预算语义(只计成功入编 页,链接农场广度消耗由总超时/并发/频控三层兜底)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -433,6 +433,18 @@ class TestTasks:
|
||||
with pytest.raises(ValueError):
|
||||
await task.start("t1", None, retry_task_id=tid_b)
|
||||
|
||||
async def test_FetchError白话化映射(self, monkeypatch):
|
||||
# spec §6 行1:站点不可达/超时是最高频真实失败路径——不漏进
|
||||
# 通用异常兜底裸抛英文内部信息
|
||||
stubs = _Stubs().install(monkeypatch)
|
||||
stubs.crawl_errors.append(safe_fetch.FetchError(
|
||||
"fetch failed for 'https://a.com/': timed out"))
|
||||
tid = await task.start("t1", "https://a.com/")
|
||||
t = await _wait("t1", tid)
|
||||
assert t.state == "failed"
|
||||
assert t.error == "网站打不开或响应太慢——检查 URL"
|
||||
assert t.failed_phase == "crawl"
|
||||
|
||||
async def test_30分钟惰性清理(self, monkeypatch):
|
||||
_Stubs().install(monkeypatch)
|
||||
tid = await task.start("t1", "https://a.com/")
|
||||
|
||||
Reference in New Issue
Block a user