Skip to content

fix(crawler): skip adagents.json properties missing required fields - #3483

Merged
EmmaLouise2018 merged 2 commits into
mainfrom
EmmaLouise2018/fix-crawler-identifiers
Apr 28, 2026
Merged

EmmaLouise2018 merged 2 commits into
mainfrom
EmmaLouise2018/fix-crawler-identifiers

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

Summary

  • Crawler used to crash mid-batch with property.identifiers is not iterable or a Postgres NOT NULL violation on property_type whenever a publisher's adagents.json shipped malformed properties entries — a single bad entry tanked the rest of the manifest.
  • Added sanitizeAdagentsProperty in server/src/discovery/property-index-guard.ts and apply it in recordPropertiesForAgent before any DB write. Properties missing property_type or name are skipped with a structured warning; non-array identifiers is coerced to [].
  • Existing hardenPropertyIndex already defends the in-memory @adcp/client path; this closes the parallel gap on the federated-index DB path.

Test plan

  • npm run typecheck clean
  • vitest run server/tests/unit/property-index-guard.test.ts — 8/8 pass (added 6 sanitizer cases)
  • Pre-commit suite (vitest + dynamic-imports lint + typecheck) passes — 834 tests
  • Verify in production logs that the next crawl no longer aborts on malformed manifests

Malformed adagents.json manifests sometimes ship properties entries
without property_type, name, or identifiers. The crawler used to
forward these straight to discovered_properties and crash mid-batch
with either 'property.identifiers is not iterable' or a Postgres
NOT NULL violation on property_type, taking down the rest of the
crawl.

recordPropertiesForAgent now sanitizes each property: missing
required fields cause that one property to be skipped (with a
warning), and a non-array identifiers value is coerced to []. The
rest of the manifest still records normally.
@EmmaLouise2018
EmmaLouise2018 merged commit b417a09 into main Apr 28, 2026
13 checks passed
@EmmaLouise2018
EmmaLouise2018 deleted the EmmaLouise2018/fix-crawler-identifiers branch April 28, 2026 23:10
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