Skip to content

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

Open
harshach wants to merge 18 commits into
mainfrom
harshach/dar-filters-granted-status
Open

feat(dar): Granted lifecycle, filters, sort, and self-service create policy#28044
harshach wants to merge 18 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
…resolve guard on availableTransitions

Two review-driven fixes:

1) Add an idempotent ALTER inside bootstrap/sql/migrations/native/2.0.0/
   schemaChanges.sql so environments that already executed the 2.0.0 CREATE
   TABLE (before the approvedById generated column was inlined) pick up the
   new column + index. Fresh installs use the inline definition; existing
   2.0.0 deployments get it via the ALTER.
   - MySQL: information_schema-guarded prepared statements (MySQL doesn't
     reliably support `ADD COLUMN IF NOT EXISTS` across 8.0 versions and has
     no `ADD KEY IF NOT EXISTS`).
   - Postgres: native `ADD COLUMN IF NOT EXISTS`.

2) Refine TaskResource.validateTaskCanBeResolved so Approved/Granted are
   only treated as resolvable when the workflow still exposes available
   transitions. Without this guard, terminal-approved workflows like
   Glossary or DescriptionUpdate (where Approved is a terminal state and
   availableTransitions is empty) would let users / bulk operations
   re-resolve already-closed tasks and re-run postUpdate hooks. DAR's
   Approved (markAsGranted/revoke) and Granted (revoke) keep working
   because their availableTransitions list is non-empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread bootstrap/sql/migrations/native/2.0.0/postgres/schemaChanges.sql Outdated
… isDarDisabled/isDarAwaitingGrant

- bootstrap/sql/migrations/native/2.0.0/postgres/schemaChanges.sql:
  Move `CREATE INDEX IF NOT EXISTS idx_task_approved_by_id` to run AFTER
  the `ALTER TABLE ADD COLUMN IF NOT EXISTS approvedbyid` so existing
  2.0.0 deployments (whose CREATE TABLE IF NOT EXISTS is a no-op and
  therefore doesn't add the inlined column) don't fail the CREATE INDEX
  with "column does not exist". Fresh installs still get both via the
  CREATE TABLE / first-time CREATE INDEX; existing installs now get the
  ALTER first, then the index.

- openmetadata-ui/.../hooks/useDataAccessRequest.ts: Unify isDarDisabled
  and isDarAwaitingGrant so both use the same `status || stage` resolution
  (TaskEntityStatus.Approved/Granted with DarWorkflowStage fallback) and
  isDarDisabled now uses the persisted `task.approvedAt` for the
  isDarApprovalActive duration check (falling back to updatedAt/createdAt
  only for older tasks). Avoids the prior inconsistency where one memo
  was stage-string-only and the other was status-enum-only, and prevents
  later workflow transitions (granting) from extending the apparent
  approval window via updatedAt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 12, 2026 21:25
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-spec/src/main/resources/json/schema/api/tasks/taskCount.json Outdated
Comment thread bootstrap/sql/migrations/native/2.0.0/mysql/schemaChanges.sql
harshach and others added 2 commits May 12, 2026 14:35
… status-wide aggregation

`TaskCountSummary` computes `approvedCount`/`grantedCount` purely from
`status = 'Approved'/'Granted'` (see CollectionDAO.TaskDAO.getTaskCountSummary),
which means terminal-Approved tasks from other workflows (Glossary,
DescriptionUpdate, etc.) also land in `approvedCount` — not just DARs awaiting
grant. Update the JSON-schema descriptions so they don't claim DAR-only scope
and instead state the actual status-based meaning.

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

Copilot AI review requested due to automatic review settings May 12, 2026 21:42
@harshach harshach review requested due to automatic review settings May 12, 2026 21:42
@sonarqubecloud
Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings May 13, 2026 06:52
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.

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented May 13, 2026

Code Review ✅ Approved 7 resolved / 7 findings

Expands the Data Access Request workflow with 'Granted' and 'Approved' states, enhanced filtering, and updated policies to support end-to-end lifecycle management. Addressed all findings related to status grouping, workflow coupling, migration scripts, and duplicate request prevention.

✅ 7 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 2 more resolved from earlier reviews

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

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.

4 participants