Skip to content

feat(dar): Granted lifecycle, filters, sort, and self-service create policy#28044

Merged
harshach merged 33 commits into
mainfrom
harshach/dar-filters-granted-status
May 16, 2026
Merged

feat(dar): Granted lifecycle, filters, sort, and self-service create policy#28044
harshach merged 33 commits into
mainfrom
harshach/dar-filters-granted-status

Conversation

@harshach
Copy link
Copy Markdown
Collaborator

@harshach harshach commented May 11, 2026

Describe your changes:

I added a Granted state and filterable list to the Data Access Request workflow, gave authenticated users permission to file a DAR, and fixed the related workflow-handler bugs that surfaced once Approved became a non-terminal state.

Type of change:

  • New feature

High-level design:

Lifecycle. The DAR workflow now goes Open → Approved (awaiting grant) → Granted (active access) → Revoked, with Approved and Granted added to TaskEntityStatus. The UI hook (useDataAccessRequest) and DataAssetsHeader render an info banner while a DAR for the current user is in Approved, and clear it once it transitions to Granted. Approver capture is wired through a new TaskRepository.persistApprover() helper that goes through storeEntity + postUpdate so the new approvedBy/approvedById/approvedAt fields are persisted reliably on both terminal and non-terminal approve transitions.

Filters. Added a dedicated /v1/tasks/dataAccessRequests sub-endpoint that pre-scopes to category=DataAccess, type=DataAccessRequest and exposes dataset, service, status, requestedBy, approver, accessType, sortOrder (asc/desc on createdAt), plus offset-based pagination. Generic /v1/tasks gains aboutService, approver, and approverId filters so other task types benefit too. New ListFilter conditions cover the approver (indexed approvedById column with FQN fallback), the service via FQN-hash prefix, and payload.accessType via the existing @ConnectionAwareSqlQuery JSON-extract pattern.

Policy. Adds a DataConsumerPolicy-CreateTask-Rule granting Create on resource task to authenticated users, fixing the operations [Create] not allowed error a non-admin saw when trying to request access.

Workflow-handler fixes discovered while writing integration tests:

  • resolveResolutionType no longer maps Approved/Granted to a terminal TaskResolutionType in the fallback switch — the workflow stays alive so the request can later be granted or revoked.
  • CreateTask.isTerminalTaskStatus now treats Approved and Granted as non-terminal, allowing the next-stage CreateTask to actually update the existing task's status/workflowStageId/availableTransitions instead of preserving stale state during the markAsGranted transition.
  • Introduced a new active value for statusGroup (Open + InProgress + Pending + Approved + Granted) so the DAR hook can find "still in progress" requests without altering the existing open/closed semantics that Glossary-style workflows depend on.

Migration. In bootstrap/sql/migrations/native/2.0.0/{mysql,postgres}/schemaChanges.sql the new approvedById generated column + idx_approved_by_id index are declared inline on the task_entity CREATE TABLE for fresh installs, and an idempotent guarded ALTER block in the same file attaches the column + index for existing 2.0.0 deployments where the CREATE TABLE IF NOT EXISTS is a no-op (information_schema-guarded prepared statements on MySQL, native ADD COLUMN IF NOT EXISTS on Postgres). 2.0.0 has not been released yet, so no data backfill is needed.

Tests:

Use cases covered

  • Non-admin user files a DAR via POST /v1/tasks (was previously denied by policy).
  • Admin approves a DAR → task moves to Approved with approvedBy/At/ById populated and both markAsGranted and revoke transitions surfaced.
  • Admin marks the request as granted → task moves to Granted with approvedBy preserved.
  • Admin revokes from either Approved (back out before granting) or Granted (revoke active access) → task ends in Revoked with a Revoked resolution.
  • /v1/tasks/dataAccessRequests honors dataset, accessType, status, approverId, and sortOrder=asc|desc, and never leaks non-DAR task types into the list.
  • Glossary-style terminal-Approved workflows still count as closed in TaskCount.openCount/completedCount (no regression).

Backend integration tests

  • Added integration tests in openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DataAccessRequestIT.java (8 new + 3 updated test cases). Verified by running mvn test -pl openmetadata-integration-tests -Dtest='DataAccessRequestIT,TaskResourceIT,IncidentTaskIntegrationIT' — 257 tests pass, 0 failures.

Playwright (UI) tests

  • Not applicable — the only UI change is an info banner driven by the existing hook flow; a dedicated DAR list page (with the full filter UI) is a follow-up.

Manual testing performed

  1. Ran the combined integration suite locally end-to-end (Testcontainers Postgres 15 + Elasticsearch 9.3.0 + Dropwizard app); all DAR lifecycle, filter, sort, approver-capture, and policy assertions green.
  2. Confirmed make generate regenerates Pydantic + Java POJOs cleanly after the task.json and taskCount.json schema edits and that the new Granted enum + approvedBy* fields appear in target/generated-sources.
  3. Ran mvn spotless:apply and yarn ui-checkstyle:changed on the touched files; yarn i18n synced the 13 new locale keys across all 17 locale files.

UI screen recording / screenshots:

Not applicable. The only UI change is an Ant Design Alert banner shown when a request is in the Approved (awaiting-grant) state; the dedicated DAR list page is a follow-up.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated bootstrap/sql/migrations/native/2.0.0/{mysql,postgres}/schemaChanges.sql for the indexed approvedById column (inline in the CREATE TABLE for fresh installs, idempotent guarded ALTER for existing 2.0.0 deployments).
  • I have added tests (integration in DataAccessRequestIT) and listed them above.

🤖 Generated with Claude Code

…ate policy

Splits the Data Access Request lifecycle into Approved (awaiting grant) and
Granted (active access) so the UI can show an "approved – awaiting grant"
banner that clears once an admin marks the request as granted. Adds an
indexed approvedBy/approvedById/approvedAt on Task, captured at the approve
transition through a new direct-persist helper. Introduces a dedicated
/v1/tasks/dataAccessRequests endpoint pre-scoped to category=DataAccess with
DAR filters (dataset, service, status, requestedBy, approver, accessType)
and an asc/desc sort on createdAt; generic /v1/tasks gains service/approver
filters too. DataConsumerPolicy now grants Create on resource=task so
authenticated non-admins can file a DAR (fixes "operations [Create] not
allowed"). Reworks the workflow handler so transitions whose targetTaskStatus
is non-terminal (Approved, Granted) don't close the task, and updates
CreateTask.isTerminalTaskStatus to allow advancing between Approved →
Granted stages. Adds a new "active" statusGroup that includes the DAR
lifecycle states while preserving the existing open/closed semantics that
Glossary-style workflows depend on. Includes a Postgres + MySQL migration
for the indexed approvedById generated column and integration coverage in
DataAccessRequestIT spanning the new lifecycle, filters, sorting, approver
capture, and the non-admin policy path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 11, 2026 20:19
@harshach harshach requested a review from a team as a code owner May 11, 2026 20:19
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels May 11, 2026
Comment thread openmetadata-service/src/main/resources/json/data/policy/DataConsumerPolicy.json Outdated
@github-actions
Copy link
Copy Markdown
Contributor

✅ TypeScript Types Auto-Updated

The generated TypeScript types have been automatically updated based on JSON schema changes in this PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Data Access Request (DAR) task workflow to support a non-terminal Approved → Granted lifecycle, adds a dedicated DAR listing endpoint with richer filtering/sorting, and updates policy + schema/migrations to persist and query approver metadata efficiently.

Changes:

  • Added Granted task status plus approvedBy/approvedById/approvedAt fields, with workflow updates to support markAsGranted and revoke from both Approved/Granted.
  • Introduced GET /v1/tasks/dataAccessRequests with DAR-scoped filters and offset pagination; expanded generic task filters (approver/aboutService/accessType) and added active statusGroup.
  • Updated DataConsumer policy to allow authenticated users to create tasks, plus DB migrations to index approvedById for filtering performance.

Reviewed changes

Copilot reviewed 37 out of 42 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
openmetadata-ui/src/main/resources/ui/src/rest/tasksAPI.ts Adds Granted, DataAccessType, active statusGroup, and DAR list API typings.
openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts Switches hook to DAR-specific endpoint and adds “awaiting grant” state for banner/disable logic.
openmetadata-ui/src/main/resources/ui/src/components/DataAssets/DataAssetsHeader/DataAssetsHeader.component.tsx Renders info banner when the current user’s DAR is Approved (awaiting grant).
openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json Adds label/message keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-tw.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/tr-tr.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/th-th.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-pt.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/nl-nl.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/mr-in.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/ko-kr.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/he-he.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/gl-es.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json Adds corresponding i18n keys for DAR lifecycle, filters, and banner text.
openmetadata-spec/src/main/resources/json/schema/entity/tasks/task.json Adds Granted enum + approver capture fields to Task schema.
openmetadata-spec/src/main/resources/json/schema/api/tasks/taskCount.json Adds approved and granted counters to task count schema.
openmetadata-service/src/main/resources/json/data/policy/DataConsumerPolicy.json Grants authenticated users Create permission on task.
openmetadata-service/src/main/resources/json/data/governance/workflows/DataAccessRequestTaskWorkflow.json Updates DAR workflow stages/transitions for Approved→Granted lifecycle.
openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java Captures approver for non-terminal approve transitions; treats Approved/Granted as non-terminal in resolution fallback.
openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java Adds new /dataAccessRequests endpoint; expands /tasks filters; extends resolvable statuses.
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java Adds DAR list method with offset pagination + createdAt sorting; adds approver persistence helper.
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java Adds active statusGroup and new filter conditions (approver/aboutService/accessType).
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java Extends task count summary and adds DAO queries for createdAt-sorted offset pagination.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java Treats Approved/Granted as non-terminal statuses.
openmetadata-sdk/src/main/java/org/openmetadata/sdk/services/tasks/TaskService.java Adds SDK helper for /dataAccessRequests endpoint.
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/DataAccessRequestIT.java Adds/updates IT coverage for Approved→Granted lifecycle, policy, and DAR list filters.
openmetadata-integration-tests/pom.xml Adds test dependencies for PDF/XLSX fixture generation.
bootstrap/sql/migrations/native/2.0.1/postgres/schemaChanges.sql Adds generated approvedbyid column + index for approver filtering (Postgres).
bootstrap/sql/migrations/native/2.0.1/mysql/schemaChanges.sql Adds generated approvedById column + index for approver filtering (MySQL).
Comments suppressed due to low confidence (1)

openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts:114

  • Same timestamp issue in the stage-based fallback: isDarApprovalActive is called with task.updatedAt ?? task.createdAt even when the task is in the approved/granted stage. This should use the persisted approval timestamp (task.approvedAt) to avoid duration calculations being affected by later transitions.
        const stage = (
          task.workflowStageDisplayName ??
          task.workflowStageId ??
          ''
        ).toLowerCase();
        if (stage === 'approved' || stage === 'granted') {
          const payload = task.payload as
            | { duration?: string; expirationDate?: number }
            | undefined;

          return isDarApprovalActive(
            task.updatedAt ?? task.createdAt,
            payload?.duration,
            payload?.expirationDate
          );

Comment thread openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts Outdated
Comment thread bootstrap/sql/migrations/native/2.0.1/mysql/schemaChanges.sql Outdated
…tTaskStatus, document status-group semantics

- Replace hardcoded `"approve".equals(transitionId)` checks in TaskWorkflowHandler
  with a `targetTaskStatus == Approved` helper so the approver-capture path
  isn't coupled to the workflow JSON's literal transition id.
- Document the intentional dual membership of `Approved` in the `active` and
  `closed` status groups (and in `completedCount` / `approvedCount`): the same
  status has different lifecycle meanings for Glossary-style workflows
  (terminal) vs Data Access Requests (awaiting grant), and removing it from
  `closed` would regress the existing Closed tab for legacy workflows.
- Use the persisted `task.approvedAt` (with fallback to updatedAt/createdAt)
  for `isDarApprovalActive` duration calculations in the DAR hook so later
  workflow transitions don't shift the apparent approval timestamp.
- Add trailing newline to DataConsumerPolicy.json.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 11, 2026 21:08
…migration, fix CreateTaskTest

- /v1/tasks/dataAccessRequests now runs the same `authorizer.authorize(...)`
  + `EntityUtil.addDomainQueryParam(...)` calls that `listInternal` applies on
  the generic /v1/tasks endpoint, so the DAR endpoint enforces permissions
  and domain scoping equivalently. The endpoint still uses offset-based
  pagination + createdAt sort (so we can't reuse listInternal directly).
- Update the statusGroup OpenAPI description and allowableValues to reflect
  the actual server semantics: 'open' = Open/InProgress/Pending,
  'active' = Open/InProgress/Pending/Approved/Granted (DAR-friendly),
  'closed' = Approved/Rejected/Completed/Cancelled/Failed/Revoked
  (keeps Approved for backward compat with non-DAR workflows where Approved
  is terminal).
- Replace the unsupported `ADD COLUMN IF NOT EXISTS` / `ADD KEY IF NOT EXISTS`
  in the MySQL 2.0.1 migration with information_schema-guarded prepared
  statements, mirroring the idempotent ALTER pattern used elsewhere in the
  repo. `ADD KEY IF NOT EXISTS` is not valid MySQL syntax and
  `ADD COLUMN IF NOT EXISTS` only works on 8.0.29+.
- Update CreateTaskTest so the assertions match the new
  `isTerminalTaskStatus` semantics: Approved and Granted are non-terminal
  (so the next-stage CreateTask listener can advance the DAR through
  ApprovedAccess → GrantedAccess); Revoked is terminal.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 43 changed files in this pull request and generated 4 comments.

Comment thread openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts Outdated
harshach and others added 2 commits May 13, 2026 10:51
…wable race

CI flaked once on createApproveGrantRevokeLifecycle:213 with
`Workflow resolution failed for task ... on transition 'revoke'`. The Task
entity is correctly updated for the new GrantedAccess stage (the preceding
assertions on status=Granted, stageId=granted, and availableTransitions=[revoke]
all pass), but Flowable's runtime-task wait state occasionally hasn't settled
the instant `markAsGranted` returns. The next `resolveTask` call then sees
an active task with no matching pending transition and bubbles up the error.

Wrap the revoke `.resolve(...)` in `await().atMost(5s).pollInterval(250ms)`
that ignores `ApiException`. Locally the suite still completes in ~5–7s with
zero retries, matching the previous fast-path, so this is purely defensive
in CI.

DataAccessRequestIT 15/15 still passing after a full clean rebuild of
spec+service+sdk.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 44 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Comment thread openmetadata-ui/src/main/resources/ui/src/rest/tasksAPI.ts Outdated
Comment thread openmetadata-ui/src/main/resources/ui/src/rest/tasksAPI.ts Outdated
Comment thread openmetadata-ui/src/main/resources/ui/src/rest/tasksAPI.ts
Comment thread openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Rohit0301
Rohit0301 previously approved these changes May 15, 2026
karanh37
karanh37 previously approved these changes May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 44 changed files in this pull request and generated 2 comments.

Comment thread openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts Outdated
harshach and others added 2 commits May 15, 2026 09:03
…xOrCondition column scope

Two Copilot review-comment doc fixes (no behavior change):

- TaskWorkflowHandler.resolveResolutionType: expand the docstring to make
  the cascade explicit and call out the convention for custom workflows.
  Approved/Granted intentionally fall through to null in the targetTaskStatus
  fallback so DAR (and any future workflow that uses Approved/Granted as a
  non-terminal "awaiting next step" state) keeps the task alive on the next
  user-task node. Custom workflows that intend an Approved transition to be
  terminal MUST declare an explicit `resolutionType` in their workflow JSON,
  matching the seeded GlossaryApproval / DescriptionUpdate / etc. definitions.

- ListFilter.buildFqnPrefixOrCondition: rewrite the docstring to make it
  explicit that the helper is purpose-built for `task_entity.aboutFqnHash`.
  Both callers (aboutEntity and aboutService) operate on that single column —
  the `prefix` arg only namespaces bound parameter keys. Warn against reuse
  with other columns so future callers don't accidentally inherit the wrong
  column choice.

DataAccessRequestIT 15/15 still passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rAwaitingGrant on approval-active

Three open Copilot/gitar-bot review fixes:

- DataAssetsHeader.test.tsx: drop the unused `listTasks: jest.fn()` mock.
  The component now calls `listDataAccessRequests` exclusively (the
  per-asset DAR hook was switched to it earlier in this PR). The dangling
  mock kept the test surface out of sync with what the code actually calls.

- DataAccessRequestIT.java: replace the inlined
  `org.openmetadata.sdk.exceptions.ApiException.class` in the awaitility
  retry with a proper top-level import, matching the project's no-FQN
  convention (and the existing InvalidRequestException import sitting one
  line above).

- useDataAccessRequest.isDarAwaitingGrant: short-circuit to false when an
  approved DAR's duration / expirationDate window has elapsed. Previously
  the banner could surface for an expired approval while the "Request
  Data Access" button was simultaneously enabled (because isDarDisabled
  already runs the same isDarApprovalActive gate). Reuse approvedAt-based
  start time + payload duration/expirationDate so both memos agree on
  whether the approval is still active.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Conflicts: 10 locale files (ar-sa, gl-es, ko-kr, mr-in, nl-nl, pr-pr, pt-pt,
th-th, tr-tr, zh-tw). main rev e5accb3 shipped a translation update via
PR #28119 that overlapped the DAR keys this branch added in en-us. Took
main's per-locale versions verbatim, then re-ran `yarn i18n` to repropagate
the 14 DAR keys (access-type, approver, data-access-request*, grant-access,
granted, mark-as-granted, requested-by, sort-{ascending,descending,order})
from en-us across all 17 locales.

No code conflicts; the merge is purely an i18n refresh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
"access-policy-name": "نام سیاست دسترسی",
"access-request-plural": "درخواست‌های دسترسی",
"access-token": "توکن دسترسی",
"access-type": "Access Type",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: Locale keys reverted from translated to English

Several locale keys that were previously translated are now being reverted to English across multiple locales:

  • "access-type" changed from localized text to "Access Type" in pr-pr, mr-in, th-th, zh-tw
  • "approver" changed from localized text to "Approver" in pr-pr, mr-in, th-th, zh-tw

This appears to be an unintentional regression from the i18n sync. If these terms are intended to remain as untranslated proper nouns/technical terms, this should be documented. Otherwise, the original translations should be preserved.

Was this helpful? React with 👍 / 👎

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented May 16, 2026

Code Review 👍 Approved with suggestions 10 resolved / 11 findings

Implements a 'Granted' state for Data Access Requests with updated lifecycle management, granular filtering, and policy-based access. Please address the regression where several locale keys were reverted from translated values to English.

💡 Quality: Locale keys reverted from translated to English

📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json:19 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json:158 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/mr-in.json:19 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/mr-in.json:158 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/th-th.json:19 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/th-th.json:158 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-tw.json:19 📄 openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-tw.json:158

Several locale keys that were previously translated are now being reverted to English across multiple locales:

  • "access-type" changed from localized text to "Access Type" in pr-pr, mr-in, th-th, zh-tw
  • "approver" changed from localized text to "Approver" in pr-pr, mr-in, th-th, zh-tw

This appears to be an unintentional regression from the i18n sync. If these terms are intended to remain as untranslated proper nouns/technical terms, this should be documented. Otherwise, the original translations should be preserved.

✅ 10 resolved
Bug: 'Approved' status present in both 'active' and 'closed' groups

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java:983-989 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/CollectionDAO.java:4335-4339
The Approved status appears in both the active status group (line 985) and the closed status group (line 988). This means that a DAR task in Approved state will be returned by both statusGroup=active and statusGroup=closed queries. While the PR description states this preserves backward compatibility for Glossary workflows where Approved is terminal, it creates a semantic contradiction: a single task can simultaneously be 'active' and 'closed' depending on which filter the caller uses.

Similarly, the completedCount in the task count SQL (CollectionDAO line 4336) counts Approved tasks as completed, while the new approvedCount also counts them separately. For DAR workflows, an Approved task is explicitly not complete (it's awaiting grant).

Consider removing Approved from the closed group and instead introducing workflow-type-aware semantics, or at minimum documenting this dual-membership prominently.

Quality: Hardcoded 'approve' transition ID couples handler to workflow JSON

📄 openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java:235 📄 openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java:356
The TaskWorkflowHandler uses a hardcoded "approve" string to decide when to capture approver metadata (lines 235 and 356). If the workflow definition's transition ID is ever renamed or if other workflows use a different naming convention for approval transitions, the approver capture will silently fail to trigger.

Consider deriving this from the transition metadata (e.g., checking targetTaskStatus == Approved) rather than relying on a magic string ID match.

Quality: Missing newline at end of DataConsumerPolicy.json

📄 openmetadata-service/src/main/resources/json/data/policy/DataConsumerPolicy.json:25
The file DataConsumerPolicy.json is missing a trailing newline, as indicated by \ No newline at end of file in the diff. This can cause issues with some tooling (e.g., git diff noise on future edits) and violates POSIX conventions.

Bug: isDarDisabled missing 'granted' stage — allows duplicate DARs

📄 openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts:108-111
The isDarDisabled logic checks for stage === 'review' and stage === 'approved' but does not check for stage === 'granted'. Per the PR's lifecycle (Open → Approved → Granted → Revoked), a task in the 'Granted' stage means the user has active access. Without this check, the "Request Data Access" button remains enabled even when the user already has a granted (active) DAR, allowing them to submit duplicate requests.

The old code handled this by checking task.status === TaskEntityStatus.Granted explicitly.

Quality: Unused TaskEntityStatus import in isDarDisabled after refactor

📄 openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts:18 📄 openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts:108-111 📄 openmetadata-ui/src/main/resources/ui/src/hooks/useDataAccessRequest.ts:113-127
TaskEntityStatus is imported (line 18) and only used in the isDarAwaitingGrant memo but not in the refactored isDarDisabled logic. The isDarDisabled relies solely on string-based stage comparison while isDarAwaitingGrant uses TaskEntityStatus.Approved and TaskEntityStatus.Granted. This inconsistency makes the two memos fragile — if the stage names ever differ from the enum values, they'll disagree. Consider using the task.status enum consistently in both memos for robustness.

...and 5 more resolved from earlier reviews

🤖 Prompt for agents
Code Review: Implements a 'Granted' state for Data Access Requests with updated lifecycle management, granular filtering, and policy-based access. Please address the regression where several locale keys were reverted from translated values to English.

1. 💡 Quality: Locale keys reverted from translated to English
   Files: openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json:19, openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json:158, openmetadata-ui/src/main/resources/ui/src/locale/languages/mr-in.json:19, openmetadata-ui/src/main/resources/ui/src/locale/languages/mr-in.json:158, openmetadata-ui/src/main/resources/ui/src/locale/languages/th-th.json:19, openmetadata-ui/src/main/resources/ui/src/locale/languages/th-th.json:158, openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-tw.json:19, openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-tw.json:158

   Several locale keys that were previously translated are now being reverted to English across multiple locales:
   - `"access-type"` changed from localized text to `"Access Type"` in pr-pr, mr-in, th-th, zh-tw
   - `"approver"` changed from localized text to `"Approver"` in pr-pr, mr-in, th-th, zh-tw
   
   This appears to be an unintentional regression from the i18n sync. If these terms are intended to remain as untranslated proper nouns/technical terms, this should be documented. Otherwise, the original translations should be preserved.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

@sonarqubecloud
Copy link
Copy Markdown

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

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants