Skip to content

Feat/optional max pages - #3

Merged
AdamRussak merged 2 commits into
mainfrom
feat/optional-max-pages
Jul 22, 2026
Merged

Feat/optional max pages#3
AdamRussak merged 2 commits into
mainfrom
feat/optional-max-pages

Conversation

@ulielitay

Copy link
Copy Markdown
Collaborator

No description provided.

A source had to specify max_pages. Make it optional across both services:
omitting it (or passing null) means "no page limit" — crawl all in-scope pages,
still bounded by same-host + include/exclude prefix scoping.

- config.SourceConfig / retrieval.ProposedSourceConfig: max_pages is now
  `int | None = Field(default=None, gt=0)` — optional, and positive only when
  provided. The DB column was already NULLABLE; NULL now means unlimited (schema
  comment updated).
- crawler.crawl(): when max_pages is None, use sys.maxsize internally as the cap
  (page_cap) so the existing sitemap/BFS/llms bound checks and slicing need no
  special-casing.
- propose_doc_source MCP tool + retrieval.propose_source: max_pages optional
  (default None); docstring updated (omit for no limit; positive if given).
- admin: form field no longer required (blank = no limit); dropped the
  None -> 100 fallbacks in _record_to_config and sources_repo._row_to_record so
  an unset limit stays unlimited instead of silently becoming 100; index view
  shows "unlimited".

Tests: omitting max_pages is accepted and yields None (config + ProposedSource);
a None-limit sitemap crawl fetches all in-scope pages; propose with max_pages=None
writes NULL; zero/negative still rejected. Updated the two tests that asserted
max_pages was required.
Drop the max_bytes cap on llms-full.txt / llms.txt discovery entirely. The cap
rejected legitimately large full-content files (docs.anthropic.com's
/llms-full.txt is ~24MB), forcing a fallback to the thin index and, when that
index links off-host, an empty crawl. Now the full file is fetched however large
it is.

- discover(): no max_bytes parameter; no size check.
- _fetch_capped (streaming/abort) replaced by a plain _fetch_body GET.
- Removed the corresponding cap tests; added one asserting a large body is
  returned in full (no truncation).

Sources are human-approved before any crawl, so an unbounded fetch here is
bounded by that approval gate.
@ulielitay
ulielitay force-pushed the feat/optional-max-pages branch from 9189316 to 9c6aa83 Compare July 22, 2026 17:20
@AdamRussak
AdamRussak merged commit 7208c97 into main Jul 22, 2026
1 of 2 checks passed
@AdamRussak
AdamRussak deleted the feat/optional-max-pages branch July 22, 2026 17:55
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.

2 participants