Skip to content

Tolerate unresolvable stream references during content pack install#26581

Open
patrickmann wants to merge 5 commits into
masterfrom
fix/content-pack-tolerate-missing-stream-references
Open

Tolerate unresolvable stream references during content pack install#26581
patrickmann wants to merge 5 commits into
masterfrom
fix/content-pack-tolerate-missing-stream-references

Conversation

@patrickmann

@patrickmann patrickmann commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes Graylog2/graylog-plugin-enterprise#12987

Description

Installing a content pack could fail with ContentPackException: Missing Stream for widget entity when a view (dashboard/search) referenced a stream that could not be resolved to a native stream. The view-side resolvers threw, which aborted and rolled back the entire content pack installation.

This was also asymmetric with the export side (WidgetDTO.toContentPackEntity), which already silently drops stream references it cannot map. This change makes the three import-time view resolvers behave the same way: skip an unresolvable stream reference with a logged warning instead of throwing, so a single dangling reference no longer blocks the whole install.

The wrong-type branch (a non-null, non-Stream value) still throws, since that indicates a genuinely corrupt entity map rather than a missing reference.

Note: if dropping the invalid stream results in an empty stream set, we will then query all indices. So it may change the semantics of the query.

Export issue is tracked in #26584

Affected resolvers:

  • WidgetEntity.toNativeEntity
  • SearchTypeEntity.mappedStreams
  • QueryEntity.shallowMappedFilter

How Tested

  • New unit tests WidgetEntityTest and SearchTypeEntityTest, plus a new case in QueryEntityTest, covering both the drop-on-missing and keep-on-resolvable paths.
  • Manual: install a content pack, edit an entity, create a new revision, and install it. A pack containing a stream reference that cannot be resolved on the target system now installs (with a warning logged for the skipped stream) instead of failing.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

patrickmann and others added 2 commits July 6, 2026 10:29
Installing a content pack could fail with "Missing Stream for widget
entity" when a view referenced a stream that could not be resolved to a
native stream. The view-side resolvers threw a ContentPackException,
which aborted and rolled back the entire content pack installation.

This was asymmetric with the export side (WidgetDTO.toContentPackEntity),
which already silently drops stream references it cannot map. Make the
three import-time view resolvers behave the same way: skip an
unresolvable stream reference with a warning instead of throwing, so a
single dangling reference no longer blocks the whole install.

The wrong-type branch (a non-null, non-Stream value) still throws, since
that indicates a genuinely corrupt entity map rather than a missing
reference.

Affected resolvers:
- WidgetEntity.toNativeEntity
- SearchTypeEntity.mappedStreams
- QueryEntity.shallowMappedFilter

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

This comment was marked as resolved.

@patrickmann patrickmann marked this pull request as ready for review July 6, 2026 12:11
@patrickmann patrickmann requested a review from a team July 6, 2026 12:11
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.

3 participants