Skip to content

fix(crawler): guard missing property.identifiers in adagents.json - #3434

Merged
bokelley merged 3 commits into
mainfrom
EmmaLouise2018/fix-property-identifiers
Apr 28, 2026
Merged

bokelley merged 3 commits into
mainfrom
EmmaLouise2018/fix-property-identifiers

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

Summary

  • The crawler crashes whenever @adcp/client's PropertyIndex.addProperty iterates property.identifiers and that field is missing — adagents.json files in the wild sometimes omit it.
  • Defensively patch the singleton addProperty at CrawlerService construction: missing/non-array values are coerced to [] so the property still lands in the agent index without aborting the whole crawl.
  • Adds a unit test that locks in both the no-throw path and the existing identifier-indexing behavior.

Error trace this fixes

Crawl failed: property.identifiers is not iterable
 TypeError: property.identifiers is not iterable
     at PropertyIndex.addProperty (/app/node_modules/@adcp/client/dist/lib/discovery/property-index.js:67:43)
     at PropertyCrawler.crawlAgents (/app/node_modules/@adcp/client/dist/lib/discovery/property-crawler.js:86:27)
     at async CrawlerService.crawlAllAgents (file:///app/dist/crawler.js:67:28)

The proper long-term fix is to harden @adcp/client upstream; remove this monkey-patch once that ships.

Test plan

  • npx vitest run server/tests/unit/property-index-guard.test.ts (new test, 2 passing)
  • npx tsc --project server/tsconfig.json --noEmit
  • Watch the next crawl run on staging — no property.identifiers is not iterable errors, and any property-without-identifiers logs a module=property-index-guard warn line instead of aborting the crawl.

…json

@adcp/client's PropertyIndex.addProperty iterates property.identifiers
without guarding the field, and adagents.json files in the wild sometimes
omit it — crashing the entire crawl. Patch the singleton at CrawlerService
construction to coerce a missing/non-array value to [] so the property
still lands in the agent index.
@bokelley
bokelley merged commit 64d557b into main Apr 28, 2026
13 checks passed
@bokelley
bokelley deleted the EmmaLouise2018/fix-property-identifiers branch April 28, 2026 18:59
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