Skip to content

Fixes 35005: Search tasks about an entity and filter mentions by entity - #34819

Merged
harsh-vador merged 8 commits into
mainfrom
feat/tasks-search-entity-mentions
Oct 12, 2026
Merged

harsh-vador merged 8 commits into
mainfrom
feat/tasks-search-entity-mentions

Conversation

@harsh-vador

@harsh-vador harsh-vador commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #35005

Describe your changes:

Backend for the entity Activity feed (the Inbox's Activity and Tasks views on an entity page; the UI comes in a separate PR). That view lists the tasks about one entity, and its Mentions view shows only the mentions about that entity. Two small API additions, no schema change and no migration.

GET /v1/tasks takes q

  • The same free-text task search the scoped lists (/visible, /assigned, /owned, …) already use: name, displayName, the payload's reason, and the about-entity's displayName / FQN.
  • With aboutEntity it searches one entity's tasks; aboutEntity already matches by FQN prefix, so a table's column-level tasks are included.
  • The five q parameters now share one description constant.

GET /v1/activity/mentions takes an optional entityLink

  • Returns only the mentioned activity about that entity, matched the way GET /v1/activity/about matches it (aboutFqnHash of the link's entity).
  • When entityLink is given, the caller must be able to view that entity (authorizeEntityLinkView, as /about does).
  • The mention subquery, domain filter and ordering are now shared SQL constants, so the four MySQL / Postgres variants are built from the same pieces. The two existing queries are unchanged character for character.

GET /v1/conversations takes includeFields (default false)

  • With entityLink, also lists the conversations about the entity's fields: a table link returns the table's and its columns' conversations (about = link OR about LIKE '<link without >>::%', wildcards escaped, inside the existing aboutFqnHash match). A column link stays that column's.
  • Opt-in, because the classic Activity tab's count and the thread panel list conversations by an entity link and expect an exact match; their results are unchanged.

Type of change:

  • New feature

Tests:

Backend integration tests

  • ActivityResourceIT#test_mentionsFeedFiltersByEntity: a mention on one table is returned for its link, a mention on another table is not, and without entityLink the feed still has every mention.
  • TaskResourceIT#testListEndpointSearchesWithinEntity: aboutEntity + q returns the matching task on the entity, not a non-matching task on it nor a matching task on another entity.
  • ConversationResourceIT#testListingIncludesFieldConversationsOnRequest: without the flag a table link returns only the table's conversation; with it, the table's and its column's; a column link with it returns only the column's. ConversationFilterTest covers the predicate and the escaped prefix.
  • Ran the new and the existing mentions / task-search / conversation tests on MySQL and Postgres: all pass.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (No schema change.)

🤖 Generated with Claude Code

The entity Activity feed lists the tasks about one entity through GET
/v1/tasks?aboutEntity=…, which had no search, and its Mentions view needs
the mentions about that entity only.

- GET /v1/tasks takes `q`, the same task search the scoped task lists use
  (name, displayName, payload reason, about displayName / FQN). The five
  `q` parameters share one description constant.
- GET /v1/activity/mentions takes an optional `entityLink`; it matches the
  entity the way /v1/activity/about does (aboutFqnHash of the link's entity)
  and is authorized like /about. The mention subquery, domain filter and
  ordering are shared constants across the four MySQL/Postgres variants.
@harsh-vador
harsh-vador requested a review from a team as a code owner October 7, 2026 08:09
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added the UI UI specific issues label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Oct 7, 2026
@harsh-vador
harsh-vador enabled auto-merge October 8, 2026 09:53
@harsh-vador harsh-vador changed the title Search tasks about an entity and filter mentions by entity Fixes 35005: Search tasks about an entity and filter mentions by entity Oct 9, 2026
…earch

A free-text `q` can't narrow rows through an index, so the name-ordered page walked
task_entity_name_index and checked every task until it filled a page. With `q`, the
task list now selects rows through the other filters (e.g. aboutEntity) and sorts only
those: MySQL ignores the name index, Postgres materializes the matches first.

Postgres also gets a text_pattern_ops index on task_entity.aboutfqnhash: the plain btree
can't serve the aboutEntity `LIKE 'hash.%'` prefix under a non-C collation, so every
aboutEntity list and count seq-scanned the table.

EXPLAIN ANALYZE on 1M tasks (page query, old -> new):
- MySQL, service-level aboutEntity + q: ~27s -> ~0.3s; one table + q: ~1ms -> <0.1ms
- Postgres, one table + q: ~900ms -> 0.2ms; service + q: ~380ms -> ~110ms
- q with no other filter: ~25s/12s -> one full pass (~7s/2s); no index can serve it
…ity-mentions

# Conflicts:
#	bootstrap/sql/migrations/native/2.1.0/postgres/schemaChanges.sql
Main now builds the generic list and count conditions through
ListFilter.getConditionForEntity(table) (#34785). Use the same entry point in the
task search overrides so their page and the count can't drift apart.
@github-actions

Copy link
Copy Markdown
Contributor

The Java checkstyle failed.

Please run mvn spotless:apply in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Java code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@gitar-bot

gitar-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Adding entity-level view authorization to filtered mention feeds changes access decisions and could block callers who previously retrieved those mentions.

Adds a free-text q filter to GET /v1/tasks, an optional entityLink to GET /v1/activity/mentions with authorization on that entity, and an opt-in includeFields flag on GET /v1/conversations so an entity's Activity view can include its columns' conversations. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

@harsh-vador
harsh-vador added this pull request to the merge queue Oct 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-12T06:00:20Z)

Blocked the queue: integration-tests-mysql-elasticsearch

@harsh-vador
harsh-vador added this pull request to the merge queue Oct 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-12T12:48:29Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/Pagination.spec.ts › should test Table columns complete flow with search

@harsh-vador
harsh-vador added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit 7209438 Oct 12, 2026
77 of 78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task search by entity, entity-scoped mentions and field conversations for the entity Activity tab

2 participants