Skip to content

feat(policy-agent): Revoke as accessType enum in databasePolicyConfig - #29392

Merged
harshsoni2024 merged 3 commits into
policy_agent_revoke_access_ossfrom
policy_agent_revoke_access_accessType
Jun 25, 2026
Merged

harshsoni2024 merged 3 commits into
policy_agent_revoke_access_ossfrom
policy_agent_revoke_access_accessType

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Changes

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


Summary by Gitar

  • Schema updates:
    • Added Revoke to accessType enum in databasePolicyConfig.json.
    • Removed Revoke from requestedAccess enum in databasePolicyConfig.json.

This will update automatically on new commits.

Greptile Summary

This PR reclassifies "Revoke" from the requestedAccess enum into the accessType enum in databasePolicyConfig.json and regenerates the five corresponding TypeScript files. The intent is to model revocation as an access pattern rather than a permission level.

  • JSON schema change: "Revoke" removed from requestedAccess (["Read","Write","Admin","Revoke"] → ["Read","Write","Admin"]) and added to accessType (["FullAccess","ColumnLevel","Masked"] → ["FullAccess","ColumnLevel","Masked","Revoke"]).
  • Schema contract issue (pre-existing open comment): requestedAccess remains in the required array, so any call with accessType = "Revoke" must still supply a requestedAccess value like "Read" or "Write" — values that are semantically meaningless for a revoke. Consider either dropping requestedAccess from required, or adding a JSON Schema if/then/else conditional that makes it required only when accessType is not "Revoke".
  • TypeScript generated files: All five .ts files are updated consistently and mirror the schema change correctly.

Confidence Score: 4/5

Safe to merge with the caveat that callers performing a Revoke must still supply a requestedAccess value that has no meaningful effect.

The schema correctly moves Revoke to accessType, but requestedAccess remains in required, forcing every Revoke payload to include a permission level (Read/Write/Admin) that is meaningless in that context. This creates a confusing and error-prone API contract that any consumer of the schema will have to work around.

databasePolicyConfig.json — the required array still mandates requestedAccess even for Revoke operations.

Important Files Changed

Filename Overview
openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json Moves Revoke from requestedAccess enum to accessType enum, but requestedAccess remains in the required array, forcing callers to supply a semantically irrelevant value when revoking access.
openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyagentconfig/databasePolicyConfig.ts Auto-generated TypeScript: Revoke added to AccessType enum and removed from RequestedAccess enum, consistent with the JSON schema change.
openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/policyAgentPipeline.ts Auto-generated TypeScript: same enum reclassification applied consistently.
openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts Auto-generated TypeScript: same enum reclassification applied consistently.
openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts Auto-generated TypeScript: same enum reclassification applied consistently.
openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts Auto-generated TypeScript: same enum reclassification applied consistently.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PolicyAgent Request] --> B{accessType}
    B -->|FullAccess| C[requestedAccess required\nRead / Write / Admin]
    B -->|ColumnLevel| C
    B -->|Masked| C
    B -->|Revoke| D[requestedAccess still required ⚠️\nRead / Write / Admin\nbut semantically irrelevant]
    C --> E[Grant applied]
    D --> F[Revoke applied]

    style D fill:#ffcccc,stroke:#cc0000
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[PolicyAgent Request] --> B{accessType}
    B -->|FullAccess| C[requestedAccess required\nRead / Write / Admin]
    B -->|ColumnLevel| C
    B -->|Masked| C
    B -->|Revoke| D[requestedAccess still required ⚠️\nRead / Write / Admin\nbut semantically irrelevant]
    C --> E[Grant applied]
    D --> F[Revoke applied]

    style D fill:#ffcccc,stroke:#cc0000
Loading

Comments Outside Diff (2)

  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 (3): Last reviewed commit: "Merge branch 'policy_agent_revoke_access..." | Re-trigger Greptile

@github-actions

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 24, 2026
@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 24, 2026 07:05
"type": "string",
"javaType": "org.openmetadata.schema.metadataIngestion.policyagentconfig.DatabaseAccessType",
"enum": ["FullAccess", "ColumnLevel", "Masked"]
"enum": ["FullAccess", "ColumnLevel", "Masked", "Revoke"]

@gitar-bot gitar-bot Bot Jun 24, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Edge Case: requestedAccess still required when accessType is Revoke

This PR moves "Revoke" out of the requestedAccess enum and into the accessType enum, so revocation is now expressed as accessType = "Revoke". However, requestedAccess remains in the top-level required array (line 74). As a result, any caller issuing a revoke must still supply one of Read/Write/Admin, a permission level that has no meaning in a revoke context. Previously revocation was encoded as requestedAccess = "Revoke", which avoided this contradiction.

This forces callers (and the generated TS type requestedAccess: RequestedAccess) to send a semantically meaningless value, and there is no longer any way to validate that a revoke request omits an irrelevant permission level. Consider either dropping requestedAccess from the global required list, or adding a JSON Schema conditional so it is required only when accessType is not "Revoke". Remember to re-run make generate after editing the schema so the generated TS/Java types stay in sync.

Require requestedAccess only when accessType is not Revoke via an if/then conditional.:

"required": ["principal", "databaseName", "accessType"],
"if": {
  "not": { "properties": { "accessType": { "const": "Revoke" } } }
},
"then": {
  "required": ["requestedAccess"]
},
"dependencies": {
  "tableName": ["schemaName"],
  "columnName": ["tableName"]
},

Was this helpful? React with 👍 / 👎

@github-actions

github-actions Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 3 failure(s), 17 flaky

✅ 4450 passed · ❌ 3 failed · 🟡 17 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 320 0 5 4
🔴 Shard 2 831 3 3 9
🟡 Shard 3 838 0 1 7
🟡 Shard 4 833 0 3 10
🟡 Shard 5 833 0 1 50
🟡 Shard 6 795 0 4 8

Genuine Failures (failed on all attempts)

❌ Features/BulkImport.spec.ts › Database service (shard 2)
�[31mTest timeout of 500000ms exceeded.�[39m
❌ Features/BulkImport.spec.ts › Database Schema (shard 2)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: locator('.rdg-cell-details')
Timeout: 15000ms
�[32m- Expected  - 1�[39m
�[31m+ Received  + 1�[39m

�[2m  Array [�[22m
�[32m-   "Entity created",�[39m
�[31m+   "#FIELD_REQUIRED: Field 1 is required;#FIELD_REQUIRED: Field 13 is required",�[39m
�[2m    "Entity updated",�[22m
�[2m    "Entity created",�[22m
�[2m    "Entity updated",�[22m
�[2m  ]�[22m

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for locator('.rdg-cell-details')�[22m
�[2m    8 × locator resolved to 0 elements�[22m
�[2m    11 × locator resolved to 4 elements�[22m

❌ Features/ContextCenterPermission.spec.ts › user with view-only permission cannot see create or delete actions, but can use share/vote/conversation actions (shard 2)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveClass�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('upvote-btn').locator('svg')
Expected pattern: �[32m/fill-blue-500/�[39m
Received string:  �[31m"tw:fill-utility-blue-500 tw:stroke-white"�[39m
Timeout: 15000ms

Call log:
�[2m  - Expect "toHaveClass" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('upvote-btn').locator('svg')�[22m
�[2m    - locator resolved to <svg width="18" height="18" fill="none" stroke-width="2" aria-hidden="true" viewBox="0 0 24 24" class="tw:fill-none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">…</svg>�[22m
�[2m    - unexpected value "tw:fill-none"�[22m
�[2m    18 × locator resolved to <svg width="18" height="18" fill="none" stroke-width="2" aria-hidden="true" viewBox="0 0 24 24" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" class="tw:fill-utility-blue-500 tw:stroke-white">…</svg>�[22m
�[2m       - unexpected value "tw:fill-ut
🟡 17 flaky test(s) (passed on retry)
  • Pages/AISettings.spec.ts › persists MCP Chat configuration after save (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › User without permission (shard 1, 2 retries)
  • Flow/SearchRBAC.spec.ts › User without permission (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a dashboard-scoped user sees dashboards but never tables (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 2 retries)
  • Features/BulkEditEntity.spec.ts › Glossary (shard 2, 1 retry)
  • Features/BulkImport.spec.ts › Keyboard Delete selection (shard 2, 1 retry)
  • Features/ContextCenter.spec.ts › edit-memory button on the row opens the modal in edit mode (shard 2, 1 retry)
  • Features/Table.spec.ts › Table pagination with sorting should works (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Number (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Entity Reference (shard 4, 1 retry)
  • Pages/DataInsightReportApplication.spec.ts › Uninstall application (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 6, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary CSV import rejects unknown relation type (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/UserDetails.spec.ts › Admin user can edit teams from the user profile (shard 6, 1 retry)

📦 Download artifacts

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

@harshsoni2024
harshsoni2024 merged commit bfe5d3c into policy_agent_revoke_access_oss Jun 25, 2026
38 of 45 checks passed
@harshsoni2024
harshsoni2024 deleted the policy_agent_revoke_access_accessType branch June 25, 2026 15:05
@gitar-bot

gitar-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 resolved / 1 findings

Adds 'Revoke' to the accessType enum but leaves requestedAccess as a required field, creating a semantic mismatch. The generated TypeScript types are also out of sync with the schema.

⚠️ Edge Case: requestedAccess still required when accessType is Revoke

📄 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-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:74

This PR moves "Revoke" out of the requestedAccess enum and into the accessType enum, so revocation is now expressed as accessType = "Revoke". However, requestedAccess remains in the top-level required array (line 74). As a result, any caller issuing a revoke must still supply one of Read/Write/Admin, a permission level that has no meaning in a revoke context. Previously revocation was encoded as requestedAccess = "Revoke", which avoided this contradiction.

This forces callers (and the generated TS type requestedAccess: RequestedAccess) to send a semantically meaningless value, and there is no longer any way to validate that a revoke request omits an irrelevant permission level. Consider either dropping requestedAccess from the global required list, or adding a JSON Schema conditional so it is required only when accessType is not "Revoke". Remember to re-run make generate after editing the schema so the generated TS/Java types stay in sync.

Require requestedAccess only when accessType is not Revoke via an if/then conditional.
"required": ["principal", "databaseName", "accessType"],
"if": {
  "not": { "properties": { "accessType": { "const": "Revoke" } } }
},
"then": {
  "required": ["requestedAccess"]
},
"dependencies": {
  "tableName": ["schemaName"],
  "columnName": ["tableName"]
},
🤖 Prompt for agents
Code Review: Adds 'Revoke' to the accessType enum but leaves requestedAccess as a required field, creating a semantic mismatch. The generated TypeScript types are also out of sync with the schema.

1. ⚠️ Edge Case: requestedAccess still required when accessType is Revoke
   Files: 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-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json:74

   This PR moves "Revoke" out of the `requestedAccess` enum and into the `accessType` enum, so revocation is now expressed as `accessType = "Revoke"`. However, `requestedAccess` remains in the top-level `required` array (line 74). As a result, any caller issuing a revoke must still supply one of `Read`/`Write`/`Admin`, a permission level that has no meaning in a revoke context. Previously revocation was encoded as `requestedAccess = "Revoke"`, which avoided this contradiction.
   
   This forces callers (and the generated TS type `requestedAccess: RequestedAccess`) to send a semantically meaningless value, and there is no longer any way to validate that a revoke request omits an irrelevant permission level. Consider either dropping `requestedAccess` from the global `required` list, or adding a JSON Schema conditional so it is required only when `accessType` is not `"Revoke"`. Remember to re-run `make generate` after editing the schema so the generated TS/Java types stay in sync.

   Fix (Require requestedAccess only when accessType is not Revoke via an if/then conditional.):
   "required": ["principal", "databaseName", "accessType"],
   "if": {
     "not": { "properties": { "accessType": { "const": "Revoke" } } }
   },
   "then": {
     "required": ["requestedAccess"]
   },
   "dependencies": {
     "tableName": ["schemaName"],
     "columnName": ["tableName"]
   },

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.42% (70680/111437) 45.9% (40625/88504) 47.81% (12367/25864)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

chirag-madlani pushed a commit that referenced this pull request Jul 2, 2026
…s enum (#29267)

* feat(policy-agent): add Revoke to databasePolicyConfig requestedAccess 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]>

* Update generated TypeScript types

* feat(policy-agent): Revoke as accessType enum in databasePolicyConfig (#29392)

* feat(governance): add accessType override to policyAgentTaskDefinition

Lets a PolicyAgent workflow node force the accessType sent to the agent
(FullAccess/ColumnLevel/Masked/Revoke) regardless of the request payload,
so the DAR revoke path can route through the agent with accessType=Revoke
while preserving the original requestedAccess level (Read/Write/Admin)
from the payload — the connector then tears down the same level the
requester originally received.

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

* Update generated TypeScript types

* refactor(governance): $ref shared accessType enum in policyAgentTaskDefinition

The accessType override on policyAgentTaskDefinition was duplicating the
[FullAccess, ColumnLevel, Masked, Revoke] enum literal that already lives
on databasePolicyConfig#/definitions/accessType. Two independent literals
silently drift the moment one side adds or removes a value.

Replace the inline type + enum with a $ref to the shared definition so the
override always tracks the policy-config enum. The generated
PolicyAgentTaskDefinition.Config.getAccessType() now returns the same
DatabaseAccessType used elsewhere; callers only ever read .value() on it
so the binding change is source-compatible.

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

* Update generated TypeScript types

* feat(governance): user-task expiry timer + Expired task status (#29596)

* feat(governance): user-task expiry timer with Expired status

Add a Flowable boundary-timer mechanism that lets a workflow author auto-fire
a user task after an ISO 8601 duration elapses, optionally closing the
underlying Task entity with a configurable resolutionType.

Schema (additive):
- userApprovalTask.json: new optional config.expiryTimer
  { durationVariable, transitionId, closeAsResolution? }. durationVariable
  names the process variable whose value Flowable evaluates as the
  ISO 8601 timer duration; transitionId is written into the node result
  variable so the outer workflow edge with that condition routes downstream;
  closeAsResolution, when set, makes ExpireOnTimerImpl resolve the OM Task
  with that resolutionType (TaskRepository.mapResolutionToStatus maps to the
  matching status — TimedOut → Expired).
- task.json: add Expired to taskStatus enum so the TimedOut → Expired mapping
  surfaces a dedicated terminal status (no more overloading Failed).

Engine wiring:
- UserApprovalTask.attachExpiryTimerIfConfigured attaches an interrupting
  BoundaryEvent with TimerEventDefinition("${<durationVariable>}") to the
  user-task; on fire it routes through a service task (ExpireOnTimerImpl) into
  the subprocess endEvent, so the outer workflow picks the matching condition.
- ExpireOnTimerImpl writes node.result = transitionId and, if
  resolutionTypeExpr is set, calls TaskRepository.resolveTask with that
  resolution. The OM Task close is wrapped in a try/catch so the BPMN flow
  always advances even if the resolve call fails.

Mapping change:
- TaskRepository.mapResolutionToStatus: TimedOut → Expired (was Failed).
  TimedOut had no callers in OSS before this PR; the new mapping reflects the
  semantic that "task ran out of time" deserves its own status rather than
  reading as a system failure.
- TaskWorkflowHandler switch on getTargetTaskStatus updated to cover Expired
  alongside Failed (both map back to TimedOut on the reverse path).

Scale: per-task cost is one ACT_RU_TIMER_JOB row; engine-wide acquisition
loop (timerJobAcquisitionInterval, default 5s) handles dispatch — no
per-task polling. Crash-safe and multi-replica safe via Flowable's standard
LOCK_OWNER atomic acquire.

Generic — not DAR-specific. Any workflow that wires expiryTimer onto a
userApprovalTask inherits the timer + auto-resolve behavior.

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

* Update generated TypeScript types

* fix(governance): expiry-timer review fixes (gitar + greptile)

Address review feedback on the user-task expiry timer:

1) gitar #2 + Failed status reachability — add Expired to TaskResolutionType
   enum (was missing) and split the reverse mapping so Failed stays reachable
   via TaskResolutionType.TimedOut (TimedOut → Failed, restored) while
   Expired gets its own resolutionType (Expired → Expired). Prior version
   collapsed both onto TimedOut, silently rewriting any workflow that used
   targetTaskStatus=Failed. Now Failed and Expired are independent statuses
   each reachable via their matching resolutionType, no behavior change for
   existing workflows.

2) gitar #1 + greptile P2 — ExpireOnTimerImpl now skips resolveTask when the
   task is already in a terminal status. Prevents the race where the user
   resolves the task via API while the timer-job acquisition loop has
   already picked up the boundary timer in a separate transaction (would
   otherwise overwrite Completed/Approved/Revoked with Expired and fire
   postUpdate hooks twice — IncidentTcrsSyncHandler etc. can't assume
   same-status transitions are idempotent).

3) greptile P1 — wrap UUID.fromString inside the try-catch in
   ExpireOnTimerImpl. A malformed taskEntityId would otherwise throw
   IllegalArgumentException out of execute(), causing Flowable to retry +
   dead-letter the timer job, leaving the workflow instance stuck. Now logs
   + lets BPMN flow advance.

4) DAR form schema requires `duration` — boundary timer expression
   ${accessDuration} would throw at user-task entry if no duration was
   supplied on the DAR payload, rolling back task entry. Making duration
   required at the form-schema layer rejects such DARs at the API edge
   instead of letting them break the workflow downstream. Pairs with the
   parseability validation on the Collate side
   (RunAllPolicyAgentsDelegate.isValidIso8601Duration).

5) TaskWorkflowHandler + TaskWorkflowLifecycleResolver — exhaustive switch
   over TaskResolutionType updated to cover the new Expired case (defaults
   to "expired" transition id).

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

* Update generated TypeScript types

* fix(governance): expiry close must fetch full task or it erases comments

gitar-bot #4 (re-scan finding): ExpireOnTimer.resolveTaskExpired loaded the
Task with the narrow field set "assignees,reviewers,about,createdBy,payload,
resolution", omitting comments. TaskRepository.clearFields sets comments=null
when the field is not requested, and resolveTask -> storeEntity then
serializes the in-memory Task back via JsonUtils.pojoToJson — silently
overwriting all existing comments on auto-close.

Every other resolveTask caller in OSS loads getFields("*") (or explicitly
includes comments) for exactly this reason; switch ExpireOnTimer to match.
Comments on the task survive the auto-close instead of getting wiped.

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

* fix(governance): add ManualRevoke status + stop stamping spurious Completed resolution on transitional moves

Two related task-lifecycle fixes surfaced while validating the expiry-timer
work end-to-end:

1) Add ManualRevoke to TaskEntityStatus. AwaitingRevoke stage in the DAR
   workflow currently stamps tasks as InProgress, which is semantically
   wrong — nothing is actively in progress, the task is parked waiting for
   a human to confirm the manual revoke. ManualRevoke names the substate
   explicitly so UI badges + reporting can distinguish "in-flight" from
   "stuck pending human." Additive enum, exhaustive switches in
   TaskWorkflowHandler updated.

2) Stop auto-stamping resolution.type=Completed on transitional status
   moves. The updateStatus path in TaskRepository previously stamped a
   default Completed resolution whenever the new status was outside
   {Open, InProgress, Pending} — that included Approved and Granted, both
   transitional substates of an in-flight DAR. Result: tasks at ApprovedAccess
   showed resolution.type=Completed even though they hadn't actually
   resolved, leaking into downstream consumers + audit. Replace the narrow
   3-status skip list with a shared NON_TERMINAL_STATUSES set / isTerminalStatus
   helper so a Completed fallback only fires when the status is genuinely
   terminal (Rejected / Completed / Cancelled / Failed / Revoked / Expired).

3) ExpireOnTimerImpl now uses TaskRepository.NON_TERMINAL_STATUSES instead
   of its own copy — one source of truth for "is this task still in flight".

Generated TS types regenerated for ManualRevoke across the four files that
expose TaskStatus.

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

* Update generated TypeScript types

* fix(tasks): allow ManualRevoke to be resolved (TaskResource guard + TaskWorkflowHandler fallback)

Both task-resolve guards rejected ManualRevoke as "already in status" — they
were written for the legacy {Open, InProgress} (+ Approved/Granted for DAR)
allow-list. With ManualRevoke as the new status for AwaitingRevoke, the
markAsRevoked transition got a 400 even though the user task was active.

- TaskResource.validateTaskCanBeResolved: extend the
  Approved/Granted-with-transitions check to include ManualRevoke.
- TaskWorkflowHandler fallback path: use
  TaskRepository.NON_TERMINAL_STATUSES (one source of truth) instead of the
  inline {Open, InProgress} check; covers ManualRevoke + Approved + Granted +
  Pending automatically.

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

* fix(tasks): bot-nit fixes — drop fully-qualified Set, use isTerminalStatus null-safe helper

- TaskRepository.NON_TERMINAL_STATUSES: use imported `Set` (already imported) instead of `java.util.Set` (gitar nit).
- TaskWorkflowHandler: route the terminal-status guard through `TaskRepository.isTerminalStatus()` so `task.getStatus()==null` no longer NPEs out of `Set.of(...).contains(null)` (greptile P1).

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix(tasks,policy-agent): address bot-review findings on PR #29267

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

* Update generated TypeScript types

* fix(tasks): delegate CreateTask terminal-status to TaskRepository + fail 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]>

* Add duration payload to task api

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ram Narayan Balaji <[email protected]>
Co-authored-by: Ram Narayan Balaji <[email protected]>
Co-authored-by: Anujkumar Yadav <[email protected]>

This branch was previously deployed

1 inactive deployment
test — 90e4bce8 Deployed Jun 25, 2026 by harshsoni2024 via playwright-ci-postgresql (1, 6) #53179
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant