Skip to content

feat(policy-agent): add Revoke to databasePolicyConfig requestedAccess enum - #29267

Merged
chirag-madlani merged 19 commits into
mainfrom
policy_agent_revoke_access_oss
Jul 2, 2026
Merged

chirag-madlani merged 19 commits into
mainfrom
policy_agent_revoke_access_oss

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Fix #29663

Changes

Adds "Revoke" to the accessType enum in
metadataIngestion/policyagentconfig/databasePolicyConfig.json:


Summary by Gitar

  • Governance workflow enhancements:
    • Added expiryTimer to UserApprovalTask to support automated task resolution via boundary timers.
    • Implemented ExpireOnTimerImpl for handling timer-driven state transitions and task closures.
  • Task lifecycle management:
    • Added ManualRevoke and Expired task statuses to task.json and backend handlers.
    • Introduced isTerminalStatus utility in TaskRepository to prevent redundant resolution updates.
  • Policy agent configuration:
    • Added Revoke to the DatabaseAccessType enum in databasePolicyConfig.json.
    • Added accessType override support to PolicyAgentTaskDefinition to force connector revocation operations.

This will update automatically on new commits.

|------|----------|
| openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json | Adds "Revoke" to the accessType enum; JSON schema and all generated TypeScript files are in sync. Semantic mismatch between accessType description ("Pattern of access") and the new operational Revoke value worth noting. |
| openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts | Auto-generated TypeScript; AccessType enum correctly updated with Revoke to match the JSON schema change. RequestedAccess enum correctly left unchanged. |
| openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts | Auto-generated TypeScript; AccessType enum updated with Revoke, consistent with schema change. |
| openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts | Auto-generated TypeScript; AccessType enum updated with Revoke, consistent with schema change. |
| openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts | Auto-generated TypeScript; AccessType enum updated with Revoke, consistent with schema change. |
| openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts | Auto-generated TypeScript; AccessType enum updated with Revoke, consistent with schema change. |

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[DatabasePolicyConfig] --> B{accessType}
    B -->|FullAccess| C[Grant full DB/schema/table access]
    B -->|ColumnLevel| D[Grant column-restricted access\nuses 'columns' field]
    B -->|Masked| E[Grant masked data access]
    B -->|Revoke NEW| F[Remove existing access]
    C & D & E & F --> G{requestedAccess\nRead / Write / Admin\nrequired in all cases}
    G --> H[Connector executes\ncorresponding SQL]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[DatabasePolicyConfig] --> B{accessType}
    B -->|FullAccess| C[Grant full DB/schema/table access]
    B -->|ColumnLevel| D[Grant column-restricted access\nuses 'columns' field]
    B -->|Masked| E[Grant masked data access]
    B -->|Revoke NEW| F[Remove existing access]
    C & D & E & F --> G{requestedAccess\nRead / Write / Admin\nrequired in all cases}
    G --> H[Connector executes\ncorresponding SQL]
Loading

Comments Outside Diff (1)

  1. openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)

    P1 requestedAccess is still required when accessType is "Revoke"

    requestedAccess remains in the required array, so callers performing a revoke operation must supply a value like "Read" or "Write" that is semantically meaningless in the revoke context. The previous model encoded revocation as requestedAccess = "Revoke", avoiding this. Consider either removing requestedAccess from required globally, or adding a JSON Schema if/then/else conditional so it is only required when accessType is NOT "Revoke".

  2. openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)

    P1 requestedAccess still required for Revoke operations

    requestedAccess remains in the required array, so any caller setting accessType = "Revoke" must also supply a requestedAccess value ("Read", "Write", or "Admin"). These permission levels are semantically meaningless for a revoke operation and create a confusing API contract. Consider either removing requestedAccess from required, or adding a JSON Schema if/then/else conditional that makes it required only when accessType is not "Revoke".

    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!

Reviews (10): Last reviewed commit: "feat(policy-agent): Revoke as accessType..." | Re-trigger Greptile

Greptile Summary

This PR extends the Data Access Request governance workflow with three related capabilities: an expiry timer on user approval tasks, two new task statuses (ManualRevoke, Expired), and Revoke as a first-class accessType in the Policy Agent database connector config.

  • Expiry timer: UserApprovalTask now accepts an optional expiryTimer config; ExpireOnTimerImpl fires a Flowable boundary timer that writes the configured transitionId as the node result and optionally closes the OM Task entity with a resolution type (e.g. Expired).
  • Status model: ManualRevoke is added as a non-terminal status (access still live, waiting for human confirmation) and Expired as a terminal status; ListFilter, TaskRepository, and TaskWorkflowHandler are updated consistently with a single isTerminalStatus source of truth.
  • Policy Agent schema: Revoke is added to DatabaseAccessType; all generated TypeScript files are in sync; policyAgentTaskDefinition.json drops the hard maxItems: 3 constraint on branches so the revoke path can declare ['revoked', 'manual'] separately from the grant path.

Confidence Score: 5/5

Safe to merge — all three feature areas (expiry timer, new statuses, Revoke accessType) are internally consistent and the generated TypeScript files are in sync with the JSON schema changes.

The status model is updated consistently across TaskRepository, ListFilter, TaskWorkflowHandler, TaskResource, and the test suite. The expiry timer implementation correctly guards against double-resolve and malformed UUIDs. The policyAgentTaskDefinition branches constraint was relaxed intentionally to support the two-branch revoke path, and the TypeScript sync issues flagged in earlier rounds are resolved in this version.

No files require special attention. ExpireOnTimerImpl has one minor style inconsistency (using NON_TERMINAL_STATUSES directly instead of isTerminalStatus()) but it is functionally correct.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/ExpireOnTimerImpl.java New Flowable JavaDelegate that handles boundary timer expiry: sets RESULT_VARIABLE, optionally closes the OM Task entity via TaskRepository.resolveTask, and guards against double-resolve and malformed UUIDs with early returns and broad exception catch.
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java Adds ManualRevoke to NON_TERMINAL_TASK_STATUSES, introduces a Set-view NON_TERMINAL_STATUSES for O(1) membership checks, and exposes a static isTerminalStatus() method as the single source of truth. Expired resolution type mapping added.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/UserApprovalTask.java Adds attachExpiryTimerIfConfigured that wires a Flowable interrupting boundary timer to the user task; validates durationVariable and transitionId at workflow deploy time with fast-fail IllegalArgumentExceptions.
openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json Adds Revoke to the accessType enum with an updated description clarifying grant vs revoke semantics. requestedAccess remains required (intentionally preserved for audit/UI display per PR description).
openmetadata-spec/src/main/resources/json/schema/governance/workflows/elements/nodes/automatedTask/policyAgentTaskDefinition.json Adds accessType override field to config; removes maxItems:3 constraint on branches (allowing revoke path to declare fewer branches) and updates branch description to document both grant and revoke paths.
openmetadata-spec/src/main/resources/json/schema/entity/tasks/task.json Adds ManualRevoke to TaskEntityStatus and Expired to both TaskEntityStatus and TaskResolutionType enums, consistent with the rest of the PR.
openmetadata-service/src/main/java/org/openmetadata/service/tasks/TaskWorkflowHandler.java Replaces the hardcoded Open/InProgress guard with TaskRepository.isTerminalStatus() in the direct-resolution fallback path; adds Expired case to resolutionType and status-to-transitionId switch statements.
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java Correctly adds ManualRevoke to the active status group and Expired to the closed status group, consistent with the lifecycle semantics defined in TaskRepository.
openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTaskTest.java Adds terminal assertion for Expired and non-terminal assertion for ManualRevoke, covering both new statuses added in this PR.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[UserApprovalTask subprocess starts] --> B{Has assignees?}
    B -- Yes --> C[User Task waiting for approval]
    B -- No --> D[AutoApprove ServiceTask]

    C -- "User approves/rejects" --> E[EndEvent → result written]
    D --> E

    C -- "expiryTimer boundary fires\n(ISO 8601 duration elapsed)" --> F[ExpireOnTimerImpl]
    F --> G{closeAsResolution\nconfigured?}
    G -- Yes --> H{Task already\nterminal?}
    H -- No --> I[TaskRepository.resolveTask\ne.g. Expired]
    H -- Yes --> J[Skip double-resolve\nlog + continue]
    G -- No --> K[Result variable only\ndownstream node closes task]
    I --> E
    J --> E
    K --> E

    E --> L{Parent workflow reads\nRESULT_VARIABLE}
    L -- granted --> M[GrantedAccess node]
    L -- denied --> N[DeniedAccess node]
    L -- expired --> O[AutoRevoke / Close node]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[UserApprovalTask subprocess starts] --> B{Has assignees?}
    B -- Yes --> C[User Task waiting for approval]
    B -- No --> D[AutoApprove ServiceTask]

    C -- "User approves/rejects" --> E[EndEvent → result written]
    D --> E

    C -- "expiryTimer boundary fires\n(ISO 8601 duration elapsed)" --> F[ExpireOnTimerImpl]
    F --> G{closeAsResolution\nconfigured?}
    G -- Yes --> H{Task already\nterminal?}
    H -- No --> I[TaskRepository.resolveTask\ne.g. Expired]
    H -- Yes --> J[Skip double-resolve\nlog + continue]
    G -- No --> K[Result variable only\ndownstream node closes task]
    I --> E
    J --> E
    K --> E

    E --> L{Parent workflow reads\nRESULT_VARIABLE}
    L -- granted --> M[GrantedAccess node]
    L -- denied --> N[DeniedAccess node]
    L -- expired --> O[AutoRevoke / Close node]
Loading

Comments Outside Diff (1)

  1. openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)

    P1 requestedAccess is still required when accessType is "Revoke"

    requestedAccess remains in the required array, so callers performing a revoke operation must supply a value like "Read" or "Write" that is semantically meaningless in the revoke context. The previous model encoded revocation as requestedAccess = "Revoke", avoiding this. Consider either removing requestedAccess from required globally, or adding a JSON Schema if/then/else conditional so it is only required when accessType is NOT "Revoke".

  2. openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)

    P1 requestedAccess still required for Revoke operations

    requestedAccess remains in the required array, so any caller setting accessType = "Revoke" must also supply a requestedAccess value ("Read", "Write", or "Admin"). These permission levels are semantically meaningless for a revoke operation and create a confusing API contract. Consider either removing requestedAccess from required, or adding a JSON Schema if/then/else conditional that makes it required only when accessType is not "Revoke".

    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!

Reviews (23): Last reviewed commit: "Merge branch 'main' into policy_agent_re..." | Re-trigger Greptile

…s enum

Add a "Revoke" value to the requestedAccess enum in databasePolicyConfig so a
Data Access Request can ask the policy agent to remove access, not just grant it.
The connector-side handling (Snowflake) lives in the Collate repo.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI review requested due to automatic review settings June 22, 2026 05:09
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for revocation semantics in Policy Agent database policy configuration by extending the requestedAccess enum in the OpenMetadata JSON Schema. This fits into the schema-first model approach where backend/UI clients consume generated models derived from openmetadata-spec schemas.

Changes:

  • Adds "Revoke" to metadataIngestion/policyagentconfig/databasePolicyConfig.json requestedAccess enum.

@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.

@github-actions
github-actions Bot requested a review from a team as a code owner June 22, 2026 05:15
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 1 failure(s), 49 flaky

✅ 4006 passed · ❌ 1 failed · 🟡 49 flaky · ⏭️ 21 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 2 795 0 13 8
🟡 Shard 3 804 0 5 7
🟡 Shard 4 804 0 6 5
🟡 Shard 5 842 0 13 0
🔴 Shard 6 761 1 12 1

Genuine Failures (failed on all attempts)

❌ Pages/LogsViewer.spec.ts › Logs page shows breadcrumb, summary, and log viewer or empty state after opening from bundle suite pipeline tab (shard 6)
Error: Failed to trigger pipeline 7600b82c-e3b4-40f4-b612-347d19081eb5: 400
🟡 49 flaky test(s) (passed on retry)
  • Features/BulkEditEntity.spec.ts › Database (shard 2, 2 retries)
  • Features/BulkEditEntity.spec.ts › Database Schema (shard 2, 2 retries)
  • Features/BulkEditEntity.spec.ts › Table (shard 2, 1 retry)
  • Features/BulkEditOperationBadges.spec.ts › Glossary bulk edit search filters rows and clear restores them (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Database Schema (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Table (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Keyboard Delete selection (shard 2, 1 retry)
  • Features/Container.spec.ts › Container page should show Schema and Children count (shard 2, 1 retry)
  • Features/Container.spec.ts › expand / collapse should not appear after updating nested fields for container (shard 2, 1 retry)
  • Features/Container.spec.ts › Copy column link button should copy the column URL to clipboard (shard 2, 1 retry)
  • Features/ContextCenter.spec.ts › clicking a memory row opens the view-only modal (shard 2, 1 retry)
  • Features/Glossary/GlossaryCRUDOperations.spec.ts › should create glossary with mutually exclusive enabled (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should move nested term to root level of same glossary (shard 2, 1 retry)
  • Features/KnowledgeCenterTextEditor.spec.ts › Rich Text Editor - Text Formatting (shard 3, 1 retry)
  • Features/Permissions/EntityPermissions.spec.ts › Directory allow common operations permissions (shard 3, 1 retry)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 2 retries)
  • Features/RestoreEntityInheritedFields.spec.ts › Validate restore with Inherited domain and data products assigned (shard 3, 2 retries)
  • Features/SearchIndexNestedColumns.spec.ts › oversized deeply nested column indexes and an in-limit column name is searchable (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Sql Query (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Number (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Time (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Set table-cp custom property on column and verify in UI (shard 4, 2 retries)
  • Pages/CustomProperties.spec.ts › Set enum custom property on column and verify in UI (shard 4, 2 retries)
  • Pages/DataContracts.spec.ts › Contract Status badge should be visible on condition if Contract Tab is present/hidden by Persona (shard 4, 1 retry)
  • Pages/Entity.spec.ts › Glossary Term Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Team as Owner Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Tag and Glossary Selector should close vice versa (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Domain Add, Update and Remove (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Update description (shard 5, 1 retry)
  • Pages/Entity.spec.ts › UpVote & DownVote entity (shard 5, 1 retry)
  • ... and 19 more

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings June 24, 2026 05:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 out of 6 changed files in this pull request and generated 1 comment.

@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 June 24, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 out of 6 changed files in this pull request and generated 3 comments.

@github-actions

github-actions Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.15% (70841/112168) 46% (40914/88925) 47.45% (12644/26644)

@harshsoni2024
harshsoni2024 force-pushed the policy_agent_revoke_access_oss branch from bed6476 to 2f32a7e Compare June 24, 2026 06:46
@github-actions

github-actions Bot commented Jul 1, 2026

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.

yan-3005 added a commit that referenced this pull request Jul 1, 2026
…x branches schema

Follow-up bot-review pass on PR #29267.

1. TaskRepository: NON_TERMINAL_STATUSES now derived via
   Set.copyOf(NON_TERMINAL_TASK_STATUSES) — single source of truth,
   can't drift. CreateTaskTest already guards the list; the set
   inherits that guard automatically.

2. TaskWorkflowHandler.java:212: dropped fully-qualified
   `org.openmetadata.service.jdbi3.TaskRepository` — TaskRepository is
   already imported at L49. Matches project Java style.

3. policyAgentTaskDefinition.json branches schema was locked at exactly
   3 items (["granted","manual","denied"]). The revoke path uses
   ["revoked","manual"] (2 items) — collate's DataAccessRequestTaskWorkflow
   already declares that. Loosen the constraint to minItems=1 and
   document that node authors declare only the branches their delegate
   emits. Also corrected the accessType-override description to match
   the actual connector behavior (revoke strips whatever the principal
   holds; requestedAccess is preserved for audit/UI, not used to decide
   what to tear down).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 1, 2026 12:12
@gitar-bot

gitar-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 7 resolved / 7 findings

Integrates automated expiry timers, new task statuses, and a Revoke access type into the governance workflow engine. All requested schema updates, backend implementation guards, and TypeScript type syncs are complete with no remaining issues.

✅ 7 resolved
✅ Bug: Generated TS enums out of sync after moving Revoke to accessType

📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:20 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:26 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts:55-59 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts:72-77 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts:85-89 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts:102-107 📄 openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts:2969-2973 📄 openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts:2986-2991 📄 openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts:3499-3503 📄 openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts:3516-3521 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts:7682-7686 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts:7699-7704 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:16-21
The latest commit (fix: Revoke as accessType) moved "Revoke" from the requestedAccess enum to the accessType enum in databasePolicyConfig.json. The schema now reads:

  • accessType: ["FullAccess", "ColumnLevel", "Masked", "Revoke"]
  • requestedAccess: ["Read", "Write", "Admin"]

However, the generated TypeScript files were last regenerated in the earlier commit 2f32a7e8 while Revoke was still under requestedAccess. They were NOT regenerated after this move, so all five generated files are now inconsistent with the schema:

  • RequestedAccess enum still contains Revoke (should not).
  • AccessType enum is missing Revoke (should have it).

Affected generated files (verified):

  • generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts (AccessType L55-59 lacks Revoke; RequestedAccess L72-77 has Revoke)
  • generated/metadataIngestion/policyAgentPipeline.ts (L85-89 / L102-107)
  • generated/api/services/ingestionPipelines/createIngestionPipeline.ts (L2969-2973 / L2986-2991)
  • generated/entity/services/ingestionPipelines/ingestionPipeline.ts (L3499-3503 / L3516-3521)
  • generated/metadataIngestion/workflow.ts (L7682-7686 / L7699-7704)

Fix: re-run the TypeScript schema generation so the generated AccessType enums gain Revoke and the RequestedAccess enums drop it, keeping the front-end types consistent with the JSON schema (and the Java types generated from javaType).

✅ Quality: "Revoke" placed in requestedAccess conflicts with its "permission level" semantics

📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:10 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:22-27
Revoke was added to the requestedAccess enum, whose description is "Permission level being requested" (javaType DatabaseRequestedAccess, alongside Read/Write/Admin). Revoke is an operation/action, not a permission level, so this overloads a single field with two orthogonal concepts. Concretely, a payload can only carry one requestedAccess value, so when it is set to Revoke the connector loses the information about which privilege (Read/Write/Admin) is being revoked. Downstream connector authors reading the schema (the Snowflake REVOKE implementation lives in the Collate repo) will have no in-schema guidance on how to resolve this.

The schema is internally consistent now (the generated TS in all five files matches), so this is not a sync bug, but consider either: (a) modeling revoke as an accessType/action separate from the privilege level, or (b) at minimum updating the requestedAccess description (and the grant-centric principalType/databaseName/principal descriptions) to document the revoke semantics so the value's meaning is unambiguous. Note the companion dataAccessRequestPayload.json still omits Revoke; confirm Revoke is only set programmatically and not user-submittable, otherwise that schema diverges.

✅ Quality: accessType enum duplicated inline instead of shared $ref

📄 openmetadata-spec/src/main/resources/json/schema/governance/workflows/elements/nodes/automatedTask/policyAgentTaskDefinition.json:27-31 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:16-21
The new accessType override in policyAgentTaskDefinition.json (lines 27-31) hardcodes the enum ["FullAccess", "ColumnLevel", "Masked", "Revoke"] inline. The identical list of valid access types already exists as a reusable definition in databasePolicyConfig.json (#/definitions/accessType, lines 16-21). Because the two are independent literals, a future change to one (e.g. adding/removing an access type) can silently leave the other out of sync, causing the task-definition override to accept/reject a different set of values than the policy config it overrides. Consider referencing the shared definition via $ref (e.g. "$ref": "../../../../../../metadataIngestion/policyagentconfig/databasePolicyConfig.json#/definitions/accessType") so the two stay aligned, or extracting the enum into a single shared type. This is minor since the values currently match.

✅ Quality: Two near-identical, divergent terminal-status constants in TaskRepository

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:99-110 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:131-140
This commit adds NON_TERMINAL_STATUSES (TaskRepository.java:99-106) right next to the pre-existing NON_TERMINAL_TASK_STATUSES (TaskRepository.java:131-137). The names differ by a single word but the membership differs: the new set includes ManualRevoke, the old one does not. They also diverge from a third predicate, CreateTask.isTerminalTaskStatus, which classifies ManualRevoke as terminal.

Concrete consequences of the divergence on ManualRevoke:

  • TaskRepository.isTerminalStatus(ManualRevoke) returns false (used by ExpireOnTimerImpl double-resolve guard, TaskWorkflowHandler transition guard, and the updateStatus fallback) — i.e. ManualRevoke is treated as in-flight.
  • CreateTask.isTerminalTaskStatus(ManualRevoke) returns true and NON_TERMINAL_TASK_STATUSES excludes it — i.e. duplicate-request gating (listNonTerminalTasksByEntityAndCategory) and supersede logic treat a task awaiting manual revoke as terminal, so a user could file a new Data Access Request for the same entity while a revoke is still pending.

This is both a maintainability hazard (a future dev will almost certainly pick the wrong one of two sibling constants with nearly identical names) and a likely behavioral bug for the ManualRevoke lifecycle. Recommend consolidating to a single source of truth for non-terminal/terminal status (or at minimum renaming the new constant to something unambiguous like TRANSITIONABLE_STATUSES) and aligning the ManualRevoke classification with CreateTask.isTerminalTaskStatus / NON_TERMINAL_TASK_STATUSES.

✅ Quality: Schema description claims TimedOut maps to Expired, but it maps to Failed

📄 openmetadata-spec/src/main/resources/json/schema/governance/workflows/elements/nodes/userTask/userApprovalTask.json:155 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:1134-1135 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/UserApprovalTask.java:326
The closeAsResolution description in userApprovalTask.json states: "the final taskStatus is derived from it by TaskRepository — TimedOut maps to Expired". However TaskRepository.mapResolutionToStatus maps TimedOut -> TaskEntityStatus.Failed and Expired -> TaskEntityStatus.Expired (TaskRepository.java:1134-1135). A workflow author who reads this description and sets closeAsResolution: "TimedOut" expecting the task to land in Expired will instead get Failed. The Javadoc in UserApprovalTask.attachExpiryTimerIfConfigured ("TimedOut → Expired") repeats the same incorrect mapping, while ExpireOnTimerImpl's Javadoc correctly says "Expired → Expired". Update the schema description and the UserApprovalTask comment to reflect the actual mapping.

...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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 13 out of 24 changed files in this pull request and generated 2 comments.

@github-actions

github-actions Bot commented Jul 1, 2026

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 left a comment

Copy link
Copy Markdown
Contributor

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 14 out of 25 changed files in this pull request and generated 2 comments.

yan-3005 and others added 2 commits July 1, 2026 17:59
Squashed bot-review addressal commit.

TaskRepository.java
- Single source of truth for non-terminal statuses: NON_TERMINAL_TASK_STATUSES
  (the canonical List, guarded by CreateTaskTest for DAR duplicate-check) with
  NON_TERMINAL_STATUSES derived as Set.copyOf(...). The two can't drift.
- ManualRevoke added to the list: at ManualRevoke the workflow is parked
  waiting for a human to confirm the revoke — access is still live at the
  source, so a new DAR against the same entity must be blocked.

CreateTask.java
- isTerminalTaskStatus() now treats ManualRevoke as non-terminal, matching
  TaskRepository. Prevents the divergence bots flagged where the DAR
  duplicate-check and the workflow-lifecycle predicate disagreed.

ListFilter.java
- 'active' status group now includes 'ManualRevoke' (still live).
- 'closed' status group now includes 'Expired' (terminal auto-expire).

TaskWorkflowHandler.java
- Dropped fully-qualified `org.openmetadata.service.jdbi3.TaskRepository`
  at the terminal-status guard; TaskRepository is already imported.

CreateTaskTest.java
- Added explicit assertions for Expired (terminal) and ManualRevoke
  (non-terminal) so future status changes can't silently regress the
  boundary.

Schema docs
- userApprovalTask.json expiryTimer.closeAsResolution description: was
  "TimedOut maps to Expired" — actually TimedOut→Failed and Expired→Expired.
  Corrected to match TaskRepository.mapResolutionToStatus.
- UserApprovalTask.java Javadoc: same correction.
- policyAgentTaskDefinition.json branches schema: was locked at exactly
  ["granted","manual","denied"] (min/maxItems=3) which prevented the
  revoke node from declaring only ["revoked","manual"]. Relaxed to
  minItems=1 with a description explaining that node authors declare
  only the branches their delegate actually emits.
- policyAgentTaskDefinition.json accessType override description now
  says revoke strips whatever the principal holds (a revoke takes back
  everything, not a specific level); requestedAccess is preserved for
  audit/UI display only.

Generated TS types regenerated to match the schema changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Jul 1, 2026

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 left a comment

Copy link
Copy Markdown
Contributor

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 14 out of 25 changed files in this pull request and generated 3 comments.

…ail fast on misconfigured expiryTimer

Follow-up bot findings on PR #29267 review 4609780598.

1. CreateTask.isTerminalTaskStatus now delegates to
   TaskRepository.isTerminalStatus. The two hand-rolled predicates
   had identical membership after the ManualRevoke sync but could
   silently drift the next time a new TaskEntityStatus is added.
   Single source of truth is TaskRepository.NON_TERMINAL_TASK_STATUSES.

2. UserApprovalTask.attachExpiryTimerIfConfigured used to silently
   skip when expiryTimer.durationVariable or transitionId was blank.
   A workflow author would deploy a broken definition and only find
   out when a task got stranded at runtime with no timer ever firing.
   Now throws IllegalArgumentException at parse time so the deploy
   fails visibly and the JSON gets fixed.

Not applied: Copilot's suggestion to treat null as terminal in
TaskRepository.isTerminalStatus — the current caller pattern at
TaskWorkflowHandler:212 relies on null-status falling through to
applyTaskResolution rather than throwing. Flipping the semantic
would need a matching caller refactor; deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@yan-3005 I've opened a new pull request, #29664, to work on those changes. Once the pull request is ready, I'll request review from you.

sonika-shah
sonika-shah previously approved these changes Jul 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@yan-3005

yan-3005 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@gitar-bot

gitar-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 7 resolved / 7 findings

Adds Revoke to the accessType enum and enables automated task expiration via boundary timers and new lifecycle statuses. All schema, backend, and TypeScript type sync issues have been resolved.

✅ 7 resolved
✅ Bug: Generated TS enums out of sync after moving Revoke to accessType

📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:20 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:26 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts:55-59 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts:72-77 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts:85-89 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts:102-107 📄 openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts:2969-2973 📄 openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts:2986-2991 📄 openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts:3499-3503 📄 openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts:3516-3521 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts:7682-7686 📄 openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts:7699-7704 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:16-21
The latest commit (fix: Revoke as accessType) moved "Revoke" from the requestedAccess enum to the accessType enum in databasePolicyConfig.json. The schema now reads:

  • accessType: ["FullAccess", "ColumnLevel", "Masked", "Revoke"]
  • requestedAccess: ["Read", "Write", "Admin"]

However, the generated TypeScript files were last regenerated in the earlier commit 2f32a7e8 while Revoke was still under requestedAccess. They were NOT regenerated after this move, so all five generated files are now inconsistent with the schema:

  • RequestedAccess enum still contains Revoke (should not).
  • AccessType enum is missing Revoke (should have it).

Affected generated files (verified):

  • generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts (AccessType L55-59 lacks Revoke; RequestedAccess L72-77 has Revoke)
  • generated/metadataIngestion/policyAgentPipeline.ts (L85-89 / L102-107)
  • generated/api/services/ingestionPipelines/createIngestionPipeline.ts (L2969-2973 / L2986-2991)
  • generated/entity/services/ingestionPipelines/ingestionPipeline.ts (L3499-3503 / L3516-3521)
  • generated/metadataIngestion/workflow.ts (L7682-7686 / L7699-7704)

Fix: re-run the TypeScript schema generation so the generated AccessType enums gain Revoke and the RequestedAccess enums drop it, keeping the front-end types consistent with the JSON schema (and the Java types generated from javaType).

✅ Quality: "Revoke" placed in requestedAccess conflicts with its "permission level" semantics

📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:10 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:22-27
Revoke was added to the requestedAccess enum, whose description is "Permission level being requested" (javaType DatabaseRequestedAccess, alongside Read/Write/Admin). Revoke is an operation/action, not a permission level, so this overloads a single field with two orthogonal concepts. Concretely, a payload can only carry one requestedAccess value, so when it is set to Revoke the connector loses the information about which privilege (Read/Write/Admin) is being revoked. Downstream connector authors reading the schema (the Snowflake REVOKE implementation lives in the Collate repo) will have no in-schema guidance on how to resolve this.

The schema is internally consistent now (the generated TS in all five files matches), so this is not a sync bug, but consider either: (a) modeling revoke as an accessType/action separate from the privilege level, or (b) at minimum updating the requestedAccess description (and the grant-centric principalType/databaseName/principal descriptions) to document the revoke semantics so the value's meaning is unambiguous. Note the companion dataAccessRequestPayload.json still omits Revoke; confirm Revoke is only set programmatically and not user-submittable, otherwise that schema diverges.

✅ Quality: accessType enum duplicated inline instead of shared $ref

📄 openmetadata-spec/src/main/resources/json/schema/governance/workflows/elements/nodes/automatedTask/policyAgentTaskDefinition.json:27-31 📄 openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:16-21
The new accessType override in policyAgentTaskDefinition.json (lines 27-31) hardcodes the enum ["FullAccess", "ColumnLevel", "Masked", "Revoke"] inline. The identical list of valid access types already exists as a reusable definition in databasePolicyConfig.json (#/definitions/accessType, lines 16-21). Because the two are independent literals, a future change to one (e.g. adding/removing an access type) can silently leave the other out of sync, causing the task-definition override to accept/reject a different set of values than the policy config it overrides. Consider referencing the shared definition via $ref (e.g. "$ref": "../../../../../../metadataIngestion/policyagentconfig/databasePolicyConfig.json#/definitions/accessType") so the two stay aligned, or extracting the enum into a single shared type. This is minor since the values currently match.

✅ Quality: Two near-identical, divergent terminal-status constants in TaskRepository

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:99-110 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:131-140
This commit adds NON_TERMINAL_STATUSES (TaskRepository.java:99-106) right next to the pre-existing NON_TERMINAL_TASK_STATUSES (TaskRepository.java:131-137). The names differ by a single word but the membership differs: the new set includes ManualRevoke, the old one does not. They also diverge from a third predicate, CreateTask.isTerminalTaskStatus, which classifies ManualRevoke as terminal.

Concrete consequences of the divergence on ManualRevoke:

  • TaskRepository.isTerminalStatus(ManualRevoke) returns false (used by ExpireOnTimerImpl double-resolve guard, TaskWorkflowHandler transition guard, and the updateStatus fallback) — i.e. ManualRevoke is treated as in-flight.
  • CreateTask.isTerminalTaskStatus(ManualRevoke) returns true and NON_TERMINAL_TASK_STATUSES excludes it — i.e. duplicate-request gating (listNonTerminalTasksByEntityAndCategory) and supersede logic treat a task awaiting manual revoke as terminal, so a user could file a new Data Access Request for the same entity while a revoke is still pending.

This is both a maintainability hazard (a future dev will almost certainly pick the wrong one of two sibling constants with nearly identical names) and a likely behavioral bug for the ManualRevoke lifecycle. Recommend consolidating to a single source of truth for non-terminal/terminal status (or at minimum renaming the new constant to something unambiguous like TRANSITIONABLE_STATUSES) and aligning the ManualRevoke classification with CreateTask.isTerminalTaskStatus / NON_TERMINAL_TASK_STATUSES.

✅ Quality: Schema description claims TimedOut maps to Expired, but it maps to Failed

📄 openmetadata-spec/src/main/resources/json/schema/governance/workflows/elements/nodes/userTask/userApprovalTask.json:155 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:1134-1135 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/UserApprovalTask.java:326
The closeAsResolution description in userApprovalTask.json states: "the final taskStatus is derived from it by TaskRepository — TimedOut maps to Expired". However TaskRepository.mapResolutionToStatus maps TimedOut -> TaskEntityStatus.Failed and Expired -> TaskEntityStatus.Expired (TaskRepository.java:1134-1135). A workflow author who reads this description and sets closeAsResolution: "TimedOut" expecting the task to land in Expired will instead get Failed. The Javadoc in UserApprovalTask.attachExpiryTimerIfConfigured ("TimedOut → Expired") repeats the same incorrect mapping, while ExpireOnTimerImpl's Javadoc correctly says "Expired → Expired". Update the schema description and the UserApprovalTask comment to reflect the actual mapping.

...and 2 more resolved from earlier reviews

Options

Display: compact → Showing less information.

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

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

This branch was previously deployed

1 inactive deployment
test — ede60693 Deployed Jul 2, 2026 by anuj-kumary via playwright-ci-postgresql (4, 6) #54317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Revoke & task expiration functionality to DAR.

7 participants