Repository navigation
Fixes #30586: return per-entity permissions inline on list endpoint - #31024
Conversation
Opt-in ?includePermissions=true on the generic list endpoint attaches each listed entity's ResourcePermission to ResultList.entityPermissions (keyed by id, NON_NULL so existing responses are unchanged), computed via the existing single-entity authorizer path and hooked into all shared list paths including the search-backed one. The UI reads these from the list response instead of firing one permission call per row (the data-quality N+1), falling back to the old per-row fetch when the map is absent. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in includePermissions=true query parameter to list/pagination APIs so responses can include per-entity ResourcePermission data inline (keyed by entity id). This reduces UI N+1 permission lookups by allowing list views (notably Data Quality test case lists) to render row-level actions without issuing one permission request per row.
Changes:
- Backend: Extend
ResultList<T>with optionalentityPermissionsand populate it from shared list paths inEntityResourcewhenincludePermissions=true. - UI: Thread
entityPermissionsthrough Data Quality list flows and updateDataQualityTabto consume inline permissions, falling back to per-row fetch when absent. - Tests: Add/adjust backend IT coverage for inline permissions and UI Jest coverage for inline vs fallback behavior.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts | Adds includePermissions to test-case list params so callers can request inline permissions. |
| openmetadata-ui/src/main/resources/ui/src/interface/types.d.ts | Extends PagingResponse to optionally include entityPermissions keyed by entity id. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCases/useTestCaseListPage.tsx | Exposes entityPermissions from the list hook to the page. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCases/useTestCaseList.ts | Requests includePermissions=true, stores returned permissions map, and returns it to consumers. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestCases/TestCases.component.tsx | Passes inline entityPermissions down to the shared DataQualityTab. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx | Requests inline permissions for test-case listings and stores them in provider state. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/TableProfiler/TableProfilerProvider.test.tsx | Updates expectations to include includePermissions: true in list calls. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/TableProfiler/TableProfiler.interface.ts | Adds optional allTestCasesPermissions to the provider context. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx | Passes inline permissions map to DataQualityTab. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/ProfilerDashboard/profilerDashboard.interface.ts | Adds optional entityPermissions prop to DataQualityTabProps. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx | Uses inline permissions (via PermissionsUtils) when provided; otherwise falls back to per-row fetch. |
| openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/DataQualityTab/DataQualityTab.test.tsx | Adds tests asserting zero per-row permission calls when inline permissions are provided, and fallback behavior otherwise. |
| openmetadata-spec/src/main/java/org/openmetadata/schema/utils/ResultList.java | Adds optional entityPermissions to list responses (already class-level NON_NULL JSON include). |
| openmetadata-service/src/main/java/org/openmetadata/service/resources/EntityResource.java | Implements includePermissions behavior across shared list paths. |
| openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/PermissionsResourceIT.java | Adds integration tests validating inline permissions for admin vs non-admin and default omission. |
|
| Count | Rule |
|---|---|
| 13 | react-hooks/exhaustive-deps |
| 10 | openmetadata-imports/no-lower-layer-page-imports |
| 4 | openmetadata-imports/no-circular-imports |
| 2 | no-restricted-imports |
| 1 | openmetadata-imports/no-rest-ui-imports |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/DataQuality/TestCases/TestCases.component.tsx:27:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/TestCases/TestCases.component.tsx:28:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/TestCases/TestCases.component.tsx:40:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseList.ts:34:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseList.ts:40:10 |
no-restricted-imports |
'getPrioritizedViewPermission' import from '../../../utils/PermissionsUtils' is restricted from being used by a pattern. getPrioritizedEditPermission/getPriorit |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseList.ts:238:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'getTestCases'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseListPage.tsx:20:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseListPage.tsx:20:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseListPage.tsx:21:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/DataQuality/TestCases/useTestCaseListPage.tsx:22:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:49:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:499:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'applyInlinePermissions' and 'collectInlineIncidentStatuses'. Either include them or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/ProfilerDashboard/profilerDashboard.interface.ts:24:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:48:3 |
no-restricted-imports |
'getPrioritizedEditPermission' import from '../../../../../utils/PermissionsUtils' is restricted from being used by a pattern. getPrioritizedEditPermission/getP |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:100:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has an unnecessary dependency: 'getPrioritizedEditPermission'. Either exclude it or remove the dependency array. Outer scope values like 'get |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:179:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:199:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchIngestionPipelineCount'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:201:9 |
react-hooks/exhaustive-deps |
The 'handleTestCasePageChange' function makes the dependencies of useMemo Hook (at line 351) change on every render. Move it inside the useMemo callback. Altern |
| 🟡 | src/components/Database/Profiler/TableProfiler/QualityTab/QualityTab.component.tsx:328:5 |
react-hooks/exhaustive-deps |
React Hook useMemo has missing dependencies: 'paging.total' and 't'. Either include them or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:204:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'getProfileSampleValue'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:229:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has an unnecessary dependency: 'allTestCases'. Either exclude it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:334:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has missing dependencies: 'fetchLatestProfilerData', 'isTableDeleted', and 'tableProfiler'. Either include them or remove the dependency ar |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:346:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchAllTests'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:372:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchTestCaseSummary'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/TableProfilerProvider.tsx:396:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 'fetchAllTests'. Either include it or remove the dependency array. |
| 🟡 | src/components/observability/DataQuality/TestCases/TestCases.tsx:18:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/components/observability/DataQuality/TestCases/TestCases.tsx:19:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/rest/testAPI.ts:47:1 |
openmetadata-imports/no-circular-imports |
This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency. |
| 🟡 | src/rest/testAPI.ts:47:1 |
openmetadata-imports/no-lower-layer-page-imports |
Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here. |
| 🟡 | src/rest/testAPI.ts:47:1 |
openmetadata-imports/no-rest-ui-imports |
REST clients must not import UI or state-layer modules. Move shared request/response types to the interface layer. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed| if (entityPermissions) { | ||
| applyInlinePermissions(); | ||
| } else { | ||
| fetchTestCasePermissions(); |
There was a problem hiding this comment.
We can eliminate fetch cll as we don't want that now
✅ Playwright Results — workflow succeededValidated commit ✅ 4506 passed · ❌ 0 failed · 🟡 6 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 56m 24s ⏱️ Max setup 7m 11s · max shard execution 21m 49s · max shard-job elapsed before upload 28m 58s · reporting 21s 🌐 224.63 requests/attempt · 2.23 app boots/UI scenario · 25.52% common-shard skew Optimization targets still in progress:
🟡 6 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Captures Harsha's revised direction: filter inaccessible rows in the DB/search query (before count/cursor) via one shared SpEL->predicate compiler rendered to both portable SQL EXISTS and the existing OMQueryBuilder, with includePermissions demoted to an optional sidecar. Grounded in RBACConditionEvaluator, the entity_relationship/tag_usage schema, and the EntityDAO list/count splice points. Lists the staging, parity-test plan, and open questions for review before the security-critical compiler is built. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| private final class ListPermissionEvaluator { | ||
| private final SecurityContext securityContext; | ||
| private final String user; | ||
| private final Map<String, ResourcePermission> evaluated = new LinkedHashMap<>(); |
There was a problem hiding this comment.
This LinkedHashMap is used as a permission memo but has no explicit entry limit. That violates the repository directive that every cache must have an explicit size cap. This requirement must be satisfied before merging by using a fixed maximum or an approved bounded cache implementation.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Drop the in-process row filtering added for includePermissions=true. It had no consumer -- both UI callers reach listInternalFromSearch, which only attached the sidecar -- while making a display flag decide which rows a list returns, on every EntityResource at once. Removing it also removes a refill loop that dropped the continuation cursor once MAX_AUTHORIZATION_FILL_BATCHES was exhausted, a paging.total that counted rows the caller could not see, a view check that diverged from DefaultAuthorizer.authorize on the isReviewer bypass, an unbounded per-request permission memo, and ~90 lines duplicating listAfter/listBefore. includePermissions=true is now purely additive: same rows, same total, plus an entityPermissions map. Move the sidecar out of the JAX-RS base into PagePermissionsResolver, which batch-loads the page once with ResourceContext.authorizationFields and one BulkFieldHydrator for tags, as LineagePermissionFilter and bulkCreateOrUpdate already do, instead of re-fetching every row by id. Decision entities are loaded separately from the response rows so hydrating owners and domains cannot leak them into the JSON. UI: fall back per row when the map omits a test case, treat an empty map as "no answer" rather than "no permissions", re-arm the loading gate so a page change cannot paint stale permissions, and publish inline permissions under the shared React Query key so drawers and useEntityPermissions stop re-fetching them. Drop the design doc from this PR, and ignore .run/.
Addresses two open review threads on the data-quality tab. Per @chirag-madlani, drop the per-row permission fetch entirely: the list response is now the only source of row permissions, so neither the whole-page fallback nor the per-row fallback for map misses remains. That also closes the P1 race Greptile flagged on the same code. The derivation is synchronous again, so there is no in-flight request for a superseded page to resolve late and overwrite the current page's permissions or clear its loading state. PagePermissionsResolver emits an entry for every row it returns, so a miss can only mean a row with no id. Both call sites -- QualityTab and the standalone data-quality page -- already pass the map. Test props now carry the same grants the removed fetch returned, and the suite asserts the permission endpoint is never called for any shape of response: absent, empty, or partial.
…e tab Row permissions now come from the list response only, so a DataQualityTab that is not given entityPermissions resolves every row to DEFAULT_ENTITY_PERMISSION and silently loses its edit/delete/status actions. The app-mode observability test-case tab renders that tab but never passed the map, unlike QualityTab and the standalone data-quality page. Reported by the Gitar review on #31024. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Code Review ✅ Approved 4 closed / 4 findings🔴 High risk · Generic list endpoints now expose per-entity authorization permissions to clients Adds opt-in ✅ 4 closed✅ Performance: includePermissions triggers per-entity get-by-id (backend N+1)
✅ Edge Case: Inline path silently yields no-permission rows for map misses
✅ Bug: Bounded refill drops reachable authorized rows from paging
✅ Bug: App-mode DQ test cases lose all row permissions
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Fixes #30586
I added an opt-in
?includePermissions=truequery param to the generic entity list/pagination endpoint so it returns each listed entity's permissions inline (ResultList.entityPermissions, keyed by id), instead of the UI firing one/permissions/{resource}/...call per listed row (the data-quality Sentry N+1). Per the design discussion this is deliberately not a separate bulk permission endpoint — the pagination API itself returns the permission set. The field is@JsonInclude(NON_NULL)and only computed when requested, so every existing list response is unchanged.Type of change:
High-level design:
EntityResource.addPermissions()readsincludePermissionsfromUriInfo(no per-resource method-signature churn) and, when set, computes each entity'sResourcePermissionvia the existing single-entityauthorizer.getPermission(...)path — identical results to/permissions/{resource}/{id}. Hooked into all shared list paths:listInternal(both overloads),searchInternal, andlistInternalFromSearch(the search-backed path the test-case data-quality list uses).ResultList<T>gains an optionalMap<entityId, ResourcePermission> entityPermissions(hand-written spec class,NON_NULL) — no schema regen, no impact on other endpoints.getListTestCaseBySearchsends the flag;TableProfilerProvider(the/table/*/profiler/data-qualitySentry path) anduseTestCaseList(standalone DQ page) threadentityPermissionsinto the sharedDataQualityTab, which derives row permissions from the map. When the map is absent it falls back to the old per-row fetch, so unmigrated callers keep working./api/v1/entity/permissions?Fqn=...endpoint from the ticket — having the list endpoint return permissions is a smaller surface and removes the client round-trips entirely.Tests:
Use cases covered
?includePermissions=true→ each row carries inline permissions (EDIT_ALL allowed); default listing omits the field.Unit tests
DataQualityTab.test.tsx: consumes inline map (asserts 0getEntityPermissionByFqncalls) + fallback path still fires them. Full affected suite: 177 tests pass.Backend integration tests
PermissionsResourceIT—testListEntitiesWithPermissions_adminGetsInlinePermissions,testListEntitiesWithPermissions_nonAdminGetsReducedPermissions(green against testcontainers: 2/2).Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Automated verification: backend IT (2/2 testcontainers), UI
tscclean, 177 Jest tests, prettier / organize-imports / spotless.UI screen recording / screenshots:
No visual change — the same row actions render; the change only removes N per-row permission API calls (now sourced from the list response). No recording.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.ResultListis a hand-written spec class).The PR appears safe to merge, with no outstanding correctness, security, or repository-rule findings.
Findings
Summary
This PR adds an opt-in permission sidecar to entity list responses and updates data-quality views to consume those permissions without issuing one request per row.
entityPermissions, keyed by entity ID, toResultList.Diagram
Reviews (7) · Last reviewed commit: "fix(ui): pass entityPermissions to the a..."