Skip to content

fix(beholder): ignore third-party network resets when scraping - #991

Merged
YusukeHirao merged 1 commit into
devfrom
fix/beholder-network-disconnection-scope-989
Dec 2, 2026
Merged

YusukeHirao merged 1 commit into
devfrom
fix/beholder-network-disconnection-scope-989

Conversation

@YusukeHirao

Copy link
Copy Markdown
Member

Fixes #989

Summary

  • Scraper のネットワーク切断リトライ判定を、既定でページ本体と同一ホストの失敗に限定
  • ScraperOptions.networkDisconnectionScope: 'same-host' | 'all' を追加(省略時 'same-host')
  • サードパーティ失敗はこれまでどおり failedRequests に全件記録

振る舞いの変更

  • 判定: not breaking — 到達できたページ本体の HTML/アンカーを捨てる挙動は feat(beholder): track requestfailed events and support page-level retry on network disconnection #864 の意図(一時的回線断)から外れた誤検知だった。意図された「同一ホストの一時切断でリトライする」使い方は維持され、旧の全ホスト厳格さは 'all' で復元できる
  • 影響: @d-zero/beholder の scrapeStart / #fetchData。切断系エラーでのページ失敗・リトライ条件
  • before: 任意ホストの net::ERR_CONNECTION_RESET 等でページ全体が失敗(retries 尽きる)
  • after: 既定では同一ホストの切断失敗だけがリトライ対象。サードパーティのみの失敗は success + failedRequests
  • ユーザーがすること: 旧厳格さが必要なら networkDisconnectionScope: 'all' を渡す。通常のクロール利用はオプション追加不要(既定で beholder: サードパーティの接続リセットでページ全体が取得失敗になる #989 が直る)

対象外

意図的に変更しないもの

  • README(切断リトライ自体が未記載のため。契約は ScraperOptions の JSDoc)
  • CDN 等の別ホスト first-party を既定のリトライ対象に含めないこと(same-host 採択のトレードオフ)
  • エージェント環境の NO_COLOR による remote-inspector ANSI テスト失敗(検証は FORCE_COLOR=1 yarn test)

Default page-level disconnection retries to same-host failures so blocked
third-party hosts no longer discard reachable HTML. Callers can restore
all-hosts strictness with networkDisconnectionScope: 'all'.

Behavior change: Scraper retries on network disconnection only for
same-host failed requests by default. Third-party ERR_CONNECTION_RESET
(and similar) no longer fail the whole page; they remain in
failedRequests. Pass networkDisconnectionScope: 'all' for the previous
behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@YusukeHirao
YusukeHirao requested a review from yusasa16 as a code owner December 2, 2026 06:15
@YusukeHirao
YusukeHirao merged commit 62e0f55 into dev Dec 2, 2026
7 checks passed
@YusukeHirao
YusukeHirao deleted the fix/beholder-network-disconnection-scope-989 branch December 2, 2026 06:20
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.

beholder: サードパーティの接続リセットでページ全体が取得失敗になる

1 participant