Store collection title on Recent Activity share rows - #26893
Open
patrickmann wants to merge 4 commits into
Open
Conversation
Sharing or unsharing a collection recorded a Recent Activity row with no item title, so the Welcome page rendered the raw ObjectId. Collections have no content pack facade, so the read-time catalog lookup misses and falls back to the stored title, which was null for the share and unshare paths. Resolve the entity title at write time via GRNDescriptorService and store it on the SHARE and UNSHARE rows, guarded so a type without a descriptor provider still records the activity (title stays null and is resolved from the catalog at read time, as before). Closes Graylog2/graylog-plugin-enterprise#14983 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Skip the event entirely when there is nothing to record, so a capability-only share change no longer resolves a title it discards. Log an unexpected descriptor failure at WARN. Only the missing-provider case is expected (outputs shared via a content pack install have none), so a Mongo failure no longer degrades silently at DEBUG. Fix the resolveTitle comment: the read path prefers catalog resolution and only falls back to the stored title, not the other way round. Tests: resolve the title once per event rather than per row, cover the duplicate-grantee filter and the capability-only branch, use OUTPUT with a real provider-less GRNDescriptorService instead of stubbing a throw for a type that does have one, and pin that a provider's placeholder title is stored as-is. Add a StartPageService case pinning that a catalog hit wins over the stored title and only a miss falls back to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes Graylog2/graylog-plugin-enterprise#14983
Description
Sharing a collection produced a Welcome page Recent Activity row showing the collection's raw ObjectId instead of its title, for example
The collection 689abc... was shared by Jane Doe.Recent Activity resolves titles at read time through the
Catalog, which is built from content pack entity excerpts. Collections have no content pack facade, so the lookup misses and the list falls back to the title stored on the row. The share and unshare paths never stored one, so the title wasnulland the UI rendered the id. This is the same root cause as #14932, on a different, shared core code path (RecentActivityUpdatesListener).RecentActivityUpdatesListener.createRecentActivityFor(EntitySharesUpdateEvent)now resolves the entity title once viaGRNDescriptorServiceand stores it on the SHARE and UNSHARE rows. The change is additive: read-time catalog resolution still wins for facade-backed types (streams, dashboards, and the rest), so only facade-less types like collections use the stored title.The subscriber also returns early when the event has no creates and no deletes.
EntitySharesServiceposts the event unconditionally, so a capability-only change previously resolved a title that was then discarded.Resolution is guarded.
GRNDescriptorService.getDescriptorthrows for a GRN type with no registered provider, and this runs inside an event subscriber, so a failure falls back to anulltitle (today's behavior) rather than dropping the activity. Only that missing-provider case is expected and logged at debug level; anything else, such as a database failure, is logged at warn.How Tested
RecentActivityUpdatesListenerTest: share and unshare store the resolved title and resolve it only once per event; the duplicate grantee increates()is filtered out; a GRN type with no descriptor provider (output, using a real provider-lessGRNDescriptorServicerather than a stubbed throw) still records the row with anulltitle and does not throw; a provider placeholder title is stored as-is; a capability-only change records nothing and resolves no title.StartPageServiceTest: a catalog hit wins over the stored title, and only a catalog miss falls back to it. Both new assertions were checked against a mutation: flipping the precedence reddens only the new case, and moving the title resolution inside the per-row loop trips the new single-resolution check.collectionson by default):The collection <title> was shared by <user>, not a raw id.Notes
Resolving the descriptor at write time is safe here in a way it would not be at read time. #26785 rejected a
GRNDescriptorServicefallback insideStartPageItemTitleRetrieverbecause a provider reports a missing entity with a placeholder title rather than an absent one, which would have surfaced those placeholders for every entity type on every read. At write time the shared entity normally exists, so the resolved title is real.Two known limitations, both accepted:
ERROR: prod ingest. These placeholders are already visible elsewhere, for example on the Grants Overview page.Types of changes
Checklist