Repository navigation
feat(policy-agent): add Revoke to databasePolicyConfig requestedAccess enum - #29267
Conversation
…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]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
There was a problem hiding this comment.
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"tometadataIngestion/policyagentconfig/databasePolicyConfig.jsonrequestedAccessenum.
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
🔴 Playwright Results — 1 failure(s), 49 flaky✅ 4006 passed · ❌ 1 failed · 🟡 49 flaky · ⏭️ 21 skipped
Genuine Failures (failed on all attempts)❌
|
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
bed6476 to
2f32a7e
Compare
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
…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]>
Code Review ✅ Approved 7 resolved / 7 findingsIntegrates 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
✅ Quality: "Revoke" placed in requestedAccess conflicts with its "permission level" semantics
✅ Quality: accessType enum duplicated inline instead of shared $ref
✅ Quality: Two near-identical, divergent terminal-status constants in TaskRepository
✅ Quality: Schema description claims TimedOut maps to Expired, but it maps to Failed
...and 2 more resolved from earlier reviews OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
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]>
✅ TypeScript Types Auto-UpdatedThe generated TypeScript types have been automatically updated based on JSON schema changes in this PR. |
…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]>
|
|
Code Review ✅ Approved 7 resolved / 7 findingsAdds ✅ 7 resolved✅ Bug: Generated TS enums out of sync after moving Revoke to accessType
✅ Quality: "Revoke" placed in requestedAccess conflicts with its "permission level" semantics
✅ Quality: accessType enum duplicated inline instead of shared $ref
✅ Quality: Two near-identical, divergent terminal-status constants in TaskRepository
✅ Quality: Schema description claims TimedOut maps to Expired, but it maps to Failed
...and 2 more resolved from earlier reviews OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |



Fix #29663
Changes
Adds
"Revoke"to theaccessTypeenum inmetadataIngestion/policyagentconfig/databasePolicyConfig.json:Summary by Gitar
expiryTimertoUserApprovalTaskto support automated task resolution via boundary timers.ExpireOnTimerImplfor handling timer-driven state transitions and task closures.ManualRevokeandExpiredtask statuses totask.jsonand backend handlers.isTerminalStatusutility inTaskRepositoryto prevent redundant resolution updates.Revoketo theDatabaseAccessTypeenum indatabasePolicyConfig.json.accessTypeoverride support toPolicyAgentTaskDefinitionto 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]%%{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]Comments Outside Diff (1)
openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)requestedAccessis still required whenaccessTypeis"Revoke"requestedAccessremains in therequiredarray, 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 asrequestedAccess = "Revoke", avoiding this. Consider either removingrequestedAccessfromrequiredglobally, or adding a JSON Schemaif/then/elseconditional so it is only required whenaccessTypeis NOT"Revoke".openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)requestedAccessstill required for Revoke operationsrequestedAccessremains in therequiredarray, so any caller settingaccessType = "Revoke"must also supply arequestedAccessvalue ("Read","Write", or"Admin"). These permission levels are semantically meaningless for a revoke operation and create a confusing API contract. Consider either removingrequestedAccessfromrequired, or adding a JSON Schemaif/then/elseconditional that makes it required only whenaccessTypeis 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), andRevokeas a first-classaccessTypein the Policy Agent database connector config.UserApprovalTasknow accepts an optionalexpiryTimerconfig;ExpireOnTimerImplfires a Flowable boundary timer that writes the configuredtransitionIdas the node result and optionally closes the OM Task entity with a resolution type (e.g.Expired).ManualRevokeis added as a non-terminal status (access still live, waiting for human confirmation) andExpiredas a terminal status;ListFilter,TaskRepository, andTaskWorkflowHandlerare updated consistently with a singleisTerminalStatussource of truth.Revokeis added toDatabaseAccessType; all generated TypeScript files are in sync;policyAgentTaskDefinition.jsondrops the hardmaxItems: 3constraint onbranchesso 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
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]%%{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]Comments Outside Diff (1)
openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)requestedAccessis still required whenaccessTypeis"Revoke"requestedAccessremains in therequiredarray, 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 asrequestedAccess = "Revoke", avoiding this. Consider either removingrequestedAccessfromrequiredglobally, or adding a JSON Schemaif/then/elseconditional so it is only required whenaccessTypeis NOT"Revoke".openmetadata-spec/src/main/resources/json/schema/metadataIngestion/policyagentconfig/databasePolicyConfig.json, line 74 (link)requestedAccessstill required for Revoke operationsrequestedAccessremains in therequiredarray, so any caller settingaccessType = "Revoke"must also supply arequestedAccessvalue ("Read","Write", or"Admin"). These permission levels are semantically meaningless for a revoke operation and create a confusing API contract. Consider either removingrequestedAccessfromrequired, or adding a JSON Schemaif/then/elseconditional that makes it required only whenaccessTypeis 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