Skip to content

fix(discovery-provider): skip malformed EM metadata during prefetch#14026

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/bug-report-resolution-8553
Draft

fix(discovery-provider): skip malformed EM metadata during prefetch#14026
cursor[bot] wants to merge 1 commit intomainfrom
cursor/bug-report-resolution-8553

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Mar 31, 2026

Summary

  • prevent entity manager prefetch from crashing when manage_entity metadata is valid JSON but not an object (e.g. [])
  • centralize metadata JSON parsing in collect_entities_to_fetch with object-shape validation
  • add regression coverage to ensure malformed prefetch metadata is skipped and indexing continues

Changes

  • packages/discovery-provider/src/tasks/entity_manager/entity_manager.py
    • added parse_metadata_json_dict() helper
    • replaced repeated json.loads(...) blocks in prefetch paths with guarded parsing
    • on malformed shape, logs and skips the transaction metadata branch instead of throwing
  • packages/discovery-provider/integration_tests/tasks/entity_manager/test_index_skip_tx.py
    • added test_skip_malformed_prefetch_metadata regression test

Validation

  • unable to run integration tests in this cloud runner because pytest is not installed (python3 -m pytest -> No module named pytest)
  • fix is minimal and covered by added test for local/CI execution
Open in Web View Automation 

Co-authored-by: Ray Jacobson <raymondjacobson@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: 21c1f7b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant