LLM WikiAccess-protected knowledge portal

WIKI

crawler-lib-dotnet

AI Summary Purpose Durable note for the NuGet/.NET package crawler at ~/labrador/crawler/crawler lib dotnet . Records the 2026 06 05 missing data investigation and the catalog page/leaf retry fixes. Key points The crawler uses NuGet V3 cata

경로ai/repo-notes/crawler-lib-dotnet.md
카테고리Repo Note
태그#crawler #data-pipeline #dotnet #kubernetes #lib #license #notes #repo #repo-note #security

# crawler-lib-dotnet

AI Summary

Purpose:

Key points:

(licenses.nuget.org/<expr>, spdx.org/licenses/<id>) resolve to a license name for normal matching; GitHub licenseUrl routes the existing GitHub license fallback to that repo (instead of projectUrl); any other plain URL is stored in LICENSE only, with LICENSE_IDS matching and the AI license call skipped.

_processCatalogLeaf(versions_info, ctx); missing-version backfill _collectMissingVersions diffs flatcontainer (v3-flatcontainer/{id}/index.json) against collected+DB versions and collects gaps via registration leaf catalogEntry → catalog leaf (version + license rows only; no product rows). The end-of-batch sort pass now runs for every component (the old len>1 gate skipped single-version updates) and always upserts product LATEST_VERSION = sortVersions(all)[-1], fixing late-backfilled old versions overwriting LATEST_VERSION.

only confirmed data-loss sites stay error (baseCralwer.setInsertIgnoreDB/ setInsertIntoDB insert failures, which are swallowed so the page can close as processed=1; table name added to the message). Everything else demoted to warning: retryable page/leaf failures (processed=0 requeue), sorting/ LATEST_VERSION correction failures, license/GitHub/AI enrichment, JSON fallbacks, clone cleanup, updatePackageListCrawler, low-level DB (cdbvdb/base raise upward). app/check.py diagnostics CLI untouched.

Relevant when:

Do not read full document unless:

Linked documents:

Open Questions

Details

Repo Info

- python3 -m unittest discover -s tests -v - python3 -m compileall src tests - git diff --check

NuGet Catalog Source-of-Truth

Use NuGet V3 catalog as an append-like event source:

  1. Catalog index: https://api.nuget.org/v3/catalog0/index.json
  2. Catalog page: each index items[*].@id.
  3. Catalog leaf: each page items[*].@id.

Microsoft documents the hierarchy as index, page, and leaf. Index page entries do not inline leaves; page item entries contain only minimal information and leaf @id; the leaf contains package metadata such as id, version, dependencyGroups, projectUrl, license fields, and published.

NuGet package ID identity is case-insensitive. Microsoft NuGet search docs state that exact packageid matches are case-insensitive. For crawler/storage design, this means Newtonsoft.Json and newtonsoft.json should be considered the same PRODUCT_KEY identity even if the crawler preserves the original casing returned by NuGet metadata.

Missing-Data Root Causes Fixed on 2026-06-05

1. Catalog index URL had leading whitespace

File: src/ai/labradorlabs/input/crawlerInfo.py

Before:

Fix:

2. Empty LIST table could not seed itself

File: src/ai/labradorlabs/crawler/dotnetCrawler.py

Before:

Fix:

3. Leaf fetch failures could close a page as complete

File: src/ai/labradorlabs/crawler/dotnetCrawler.py

Before:

Fix:

- test_leaf_fetch_failure_keeps_catalog_page_retryable - test_version_exception_records_one_retry_status_for_catalog_page

4. Page fetch failures could leave status unpersisted

Before:

Fix:

5. Product SOURCE_URL was read from page item metadata

Before:

Fix:

Remaining Known Gaps

- Code block that builds dependency_list and calls insertDependency is commented out. - This was committed as dependency-table collection being disabled (e0b8086). - Version rows still include DEPENDENCIES JSON.

- PROCESSED=0 keeps failures retryable but can cause repeated immediate retries if a page/leaf has a persistent bad shape or outage. - A Go-style retry ladder (30-34) or a processing status would be safer for multi-worker or persistent-failure operation.

- This follows the current code shape but means reprocessing a page replays all leaves in that page. - Upsert idempotency must be relied on for duplicate catalog leaf processing.

GitHub License Fallback Policy

a license value, the crawler does not call GitHub.

GET /repos/{owner}/{repo}/license for the default branch. Do not make tag-specific license API calls in the main fallback path.

repeated API calls for one NuGet page that contains many packages from the same repository.

license records, decode the API content field for LICENSE_AI input, and store ORIGINAL_DATA.GITHUB.LICENSE_API.ref as None for the default-branch API result.

volume, per the 2026-06-05 user decision.

license API returns no license data. Clone cleanup happens once per catalog page/repo, not per leaf.