fix(batch): retain failed scrape results - #505
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
A URL the engine could not turn into a document is now retained with a `block`,
but `V2Document` has no field that can carry it, so on /v2 it reached the caller
as an empty document with nothing to explain it, while GET
/v2/{batch/scrape,crawl}/{id}/errors, the route documented to carry exactly
those, returned an empty array and reported only a job-level failure.
docs/docs/recipe-batch.md promises the opposite: "URLs that fail mid-job are
recorded ... Retrieve them after the job completes".
Also updates the credits_used note in the v2 adapter, which described the
accounting from before failed URLs were retained and is no longer true: the sum
is now exact on the batch path rather than a lower bound.
The new state test asserted a whole customer-facing sentence that is defined in
crw-crawl; match on the vendor and a substring instead, as the neighbouring test
in that module does, so rewording a message does not break a crw-server test.
|
Thanks for this, and sorry for the slow start: your CI had never actually run, because a The bug is real and I reproduced it in both directions against locally built engines rather On main the caller receives two documents and is accounted for three pages. Your change makes One thing worth recording for the issue: a host that does not resolve never reaches the batch I have pushed a commit onto your branch with three follow-ups. 1. The failure reason did not reach the
2. 3. The new test pinned a whole customer-facing sentence that is defined two crates away in Two things I did not change, that are worth deciding on before this merges. The accounting change should be in the PR description.
On a hosted deployment that renders as the internal renderer host and port. This is not Smaller, not blocking: |
A failed URL is now kept as a placeholder, but on /v2 that placeholder had nothing to explain it: V2Document has no block field, and neither SDK reads the errors route. The block reason now lands in the document's warning, which the frozen shape already carries. The errors route lists only documents that have no body, so an origin error page that was delivered readable is not also reported as a failure, and each entry gets a stable per-entry id derived from the job id and position. A fault in the caller's own template (actions, or screenshot with renderJs:false) used to come back as one anti-bot placeholder per URL. Both checks now live in crw_crawl::single::validate_scrape_template, run at the top of the single scrape and of POST /v1/batch/scrape, so a bad template is one 400 on both surfaces. ScrapeData::has_body names the placeholder shape once. Docs describe the blocked counter, the errors entry with its url, and the credits caveat for multi-page PDFs.
|
one more commit on top. on |
Change
Batch scrapes now retain a blocked document when an individual scrape fails, keeping the result list aligned with the completed count while preserving the failed URL and reason.
Fixes #487
Measured
The regression failed on current
mainwithblocked = 0for a completed scrape error. It now reports one blocked document with the failed URL and error reason.Tests
cargo test -p crw-server start_batch_job_records_scrape_errors_as_blocked_documents -- --nocapture