Skip to content

docs(crawl): say that a crawl whose patterns match nothing completes with 0 results - #52

Merged
StefanoGuerrini merged 9 commits into
mainfrom
docs/crawl-patterns-output-filter
Oct 16, 2026
Merged

StefanoGuerrini merged 9 commits into
mainfrom
docs/crawl-patterns-output-filter

Conversation

@zenrows-dev-pool

@zenrows-dev-pool zenrows-dev-pool Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Before: The SDK did not say what happens when an include pattern matches nothing. Acceptance check 19 expected such a crawl to end failed with no_items_found. The SDK did not say what seed_unreachable and no_items_found mean.

After: A crawl whose pages held nothing new to follow ends completed with no results and no error. That covers a page with no link, only links to other sites, or only links the patterns reject. The README says to check the patterns against the URLs the start page links to. CrawlErrorCode says that seed_unreachable covers a start page that could not be reached, was blocked, or came back empty. It says that no_items_found means the crawl read the start page but found no data it could use, so it had nothing to follow. The patterns still limit what a crawl opens as well as what it returns, so maxPages and excludePatterns keep their wording from main.

How:

  • README.md: one sentence on the 0-result outcome, next to how a failed crawl carries error.
  • src/crawl/client.ts: the includePatterns doc says a crawl whose patterns reject every link ends completed.
  • src/crawl/types.ts: the CrawlErrorCode doc gives the narrowed meaning of seed_unreachable and no_items_found.
  • acceptance/crawl: row 19, its check and its report title expect completed, items_found 0, no results and no error.
  • acceptance/crawl/contract.lock records the contract this surface follows.
  • Merged the current main into the branch.

Tests:

  • pnpm check (biome): 41 files checked, no fixes needed.
  • tsc --noEmit on tsconfig.json and tsconfig.test.json: no errors.
  • pnpm test -- --run: 27 files passed, 1 skipped; 372 tests passed, 6 skipped.
  • bash acceptance/crawl/run.sh --no-key: PASS 8, SKIP 21 (the live checks need a key), 0 findings.

…ategies a crawl ran with

`outputFormat` takes `markdown` as well as `html`: the crawl returns each
kept URL's page converted to Markdown, read with `content()` or
`download()` as HTML already was.

A crawl reports `discovery`, the strategies it finds URLs with on each
page it walks, and a create can ask for them. `links` follows the links
in the page's HTML, and is what a crawl runs with when the create leaves
it out. The field stays optional, so the type parses an older answer too.

`content(..., { download: true })` asks for the page as a file to save
rather than one to show. The text is the same; the server sends a file
name built from the content id.

`CrawlErrorCode` gains `api_key_cap_reached`, which a crawl ends with
when the key that created it reaches one of its credit caps.
The lock names the API description this surface was synced to, by its
blob id, so a later drift check compares against it instead of reporting
the surface as never synced. Two operations in that description are not
served to callers and no surface exposes them; the lock lists them as
pending, so a change to either does not read as drift here.
… set

The Crawl API now ends a crawl that runs out of credits, or whose API key
hits a credit cap, as `stopped` with `error.code` `insufficient_credits` or
`api_key_cap_reached` and no `stop_reason`, instead of `failed`. The type
comments, the `wait` comment and the README said `error` belongs to a
`failed` crawl and `stopped` to `stop()`. They now describe both cases, the
README example handles the credit stop, and a unit test pins that `wait`
resolves such a crawl with its error and no stop reason.
…it opens

The Crawl API now treats include and exclude patterns as a filter on what
a crawl returns. The crawl still opens on-site pages that fail them, within
`depth` and `maxPages`, to follow their links to pages that match, and
never returns those pages. Every page it opens counts toward `maxPages` and
is billed. The JSDoc for `maxPages`, `includePatterns` and
`excludePatterns`, and the README, now say so, and that a crawl whose
patterns match nothing ends `completed` with no results.
…eted

Acceptance check 19 asserted that an include pattern matching nothing ends
the crawl `failed` with `no_items_found`. The Crawl API now ends such a
crawl `completed` with 0 results and no `error`, so the check asserts that,
and reads the crawl's results to confirm none came back. Check 21 still
reads the defaults from the same crawl.
Base automatically changed from docs/crawl-stopped-on-credits to main October 16, 2026 10:45
…esults is not a failure

A URL that fails includePatterns or excludePatterns is neither
returned nor opened, so the docs no longer say the crawl opens such
pages or bills them. A crawl whose pages held nothing new to follow
ends completed with no results and no error. seed_unreachable covers
an empty start page, and no_items_found means Extract found no data
on the start page.
@zenrows-dev-pool zenrows-dev-pool Bot changed the title docs(crawl): say that patterns filter what a crawl returns, not what it opens docs(crawl): say that a crawl whose patterns match nothing completes with 0 results Oct 16, 2026
…duct names

no_items_found now reads as the crawl finding no data it could use on the start page, with the advice to start from a listing or product page.
…hat match nothing

The check expects a completed crawl with 0 results, so the report no longer calls it a failed crawl.
@StefanoGuerrini
StefanoGuerrini marked this pull request as ready for review October 16, 2026 13:56
@StefanoGuerrini
StefanoGuerrini merged commit 38c18f8 into main Oct 16, 2026
3 checks passed
@StefanoGuerrini
StefanoGuerrini deleted the docs/crawl-patterns-output-filter branch October 16, 2026 13:56
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.

1 participant