Skip to content

Refactor workflow input namespaces to typed helper#29739

Open
yan-3005 wants to merge 11 commits into
mainfrom
refactor/input-namespaces-typed
Open

Refactor workflow input namespaces to typed helper#29739
yan-3005 wants to merge 11 commits into
mainfrom
refactor/input-namespaces-typed

Conversation

@yan-3005

@yan-3005 yan-3005 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add nested static WorkflowVariableHandler.InputNamespaces record for workflow input namespace maps
  • update workflow delegates to read namespaces through the typed helper instead of ad hoc maps
  • clean CreateTask payload handling to use schema/record types for DAR and recognizer feedback payloads

Tests

  • mvn -pl openmetadata-service spotless:apply
  • mvn -pl openmetadata-service -Dtest=WorkflowVariableHandlerInputNamespacesTest,CreateTaskTest test
  • git diff --check

Greptile Summary

This PR refactors how workflow delegates resolve per-input variable namespaces: instead of each delegate calling JsonUtils.readOrConvertValue(...) and casting to a raw Map<String, String>, all delegates now delegate to the new WorkflowVariableHandler.InputNamespaces record, which centralises the JSON/Map dispatch and null handling. The CreateTask payload logic is also lifted from ad-hoc map manipulation to typed schema classes (DataAccessRequestPayload, RecognizerFeedbackTaskPayload).

  • WorkflowVariableHandler.InputNamespaces is a new nested record that handles both String-JSON and pre-deserialized Map inputs, always returns a non-null immutable result, and exposes namespaceFor/namespaceForOrDefault helpers used uniformly across ~15 delegate classes.
  • CreateTask's DAR and recognizer-feedback payload handling is refactored from raw Map manipulation to typed POJOs; the new readDataAccessRequestPayload / readRecognizerFeedbackTaskPayload helpers now throw IllegalArgumentException on invalid payloads (previously silently falling back) — this is verified by new test cases.
  • RunIngestionPipelineDelegate removes the now-unused inputNamespaceMap local variable, leaving inputNamespaceMapExpr declared but never evaluated.

Confidence Score: 5/5

Safe to merge — the refactor is mechanical and well-tested; the only finding is a leftover unused field declaration.

All delegate classes are updated consistently to use InputNamespaces. The new null-safety guarantee (compact constructor normalises null to Map.of()) removes a class of NPE risk that existed before. The CreateTask payload changes are covered by explicit exception-path tests. The only rough edge is the orphaned inputNamespaceMapExpr field in RunIngestionPipelineDelegate, which is cosmetic and does not affect runtime behaviour.

RunIngestionPipelineDelegate.java — the inputNamespaceMapExpr field is declared but never evaluated after this change.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandler.java Adds InputNamespaces record with sound null handling (compact constructor normalises null to empty map) and dual-path dispatch for String-JSON vs Map inputs.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/createAndRunIngestionPipeline/RunIngestionPipelineDelegate.java Removed the unused inputNamespaceMap local variable, but the injected field inputNamespaceMapExpr remains declared and is now never read — dead code.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java Cleanly migrates DAR and recogniser-feedback payload handling to typed schema POJOs; new helpers throw on invalid payloads instead of silently falling back, which is tested explicitly.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/flowable/MainWorkflow.java Removes the now-unnecessary null guard (InputNamespaces.read never returns null) and iterates over namespaces() directly; logic is equivalent.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/flowable/BaseDelegate.java Protected field renamed from inputNamespaceMap to inputNamespaces; all subclasses that relied on the Map are updated consistently.
openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandlerInputNamespacesTest.java Good coverage of InputNamespaces.read: String-JSON, pre-converted Map, null input, and null-valued entries.
openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTaskTest.java Tests updated to pass the new taskType parameter; adds coverage for JSON-string payloads and throws-on-invalid-payload paths.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before
        A1[Delegate.execute] -->|readOrConvertValue| B1[Map inputNamespaceMap]
        B1 -->|.get| C1[namespace String]
        C1 --> D1[varHandler.getNamespacedVariable]
    end

    subgraph After
        A2[Delegate.execute] -->|InputNamespaces.from or .read| B2[InputNamespaces record]
        B2 -->|.namespaceFor| C2[namespace or null]
        B2 -->|.namespaceForOrDefault| C3[namespace with fallback]
        C2 --> D2[varHandler.getNamespacedVariable]
        C3 --> D2
    end

    subgraph InputNamespaces.read
        R1{rawValue instanceof String?} -->|Yes| R2[JsonUtils.readValue]
        R1 -->|No| R3[JsonUtils.convertValue]
        R2 --> R4[new InputNamespaces]
        R3 --> R4
        R4 -->|null map| R5[Map.of via compact ctor]
        R4 -->|non-null| R6[unmodifiableMap LinkedHashMap]
    end
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
    subgraph Before
        A1[Delegate.execute] -->|readOrConvertValue| B1[Map inputNamespaceMap]
        B1 -->|.get| C1[namespace String]
        C1 --> D1[varHandler.getNamespacedVariable]
    end

    subgraph After
        A2[Delegate.execute] -->|InputNamespaces.from or .read| B2[InputNamespaces record]
        B2 -->|.namespaceFor| C2[namespace or null]
        B2 -->|.namespaceForOrDefault| C3[namespace with fallback]
        C2 --> D2[varHandler.getNamespacedVariable]
        C3 --> D2
    end

    subgraph InputNamespaces.read
        R1{rawValue instanceof String?} -->|Yes| R2[JsonUtils.readValue]
        R1 -->|No| R3[JsonUtils.convertValue]
        R2 --> R4[new InputNamespaces]
        R3 --> R4
        R4 -->|null map| R5[Map.of via compact ctor]
        R4 -->|non-null| R6[unmodifiableMap LinkedHashMap]
    end
Loading

Reviews (9): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Copilot AI review requested due to automatic review settings July 3, 2026 15:55
@yan-3005 yan-3005 added the safe to test Add this label to run secure Github workflows on PRs label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 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.

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

This PR refactors how Flowable workflow delegates resolve input namespaces by introducing a typed helper (WorkflowVariableHandler.InputNamespaces) and migrating existing delegates away from ad hoc Map handling. It also tightens task payload handling in CreateTask by using schema/record types for Data Access Request (DAR) and recognizer feedback payloads.

Changes:

  • Add WorkflowVariableHandler.InputNamespaces record and migrate delegates/listeners to use it.
  • Update workflow graph validation to consume namespace mappings via the helper.
  • Refactor CreateTask payload merging/parsing to use DataAccessRequestPayload and a typed recognizer payload record, with updated unit tests.

Reviewed changes

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

Show a summary per file
File Description
openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandlerInputNamespacesTest.java Adds unit coverage for parsing/reading the new InputNamespaces helper.
openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTaskTest.java Updates assertions to validate DAR payload merging now returns DataAccessRequestPayload.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandler.java Introduces the InputNamespaces typed helper for namespace lookups.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/flowable/MainWorkflow.java Switches workflow node validation to iterate namespaces via InputNamespaces.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/flowable/BaseDelegate.java Stores parsed namespaces as InputNamespaces instead of a raw Map.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/SetApprovalAssigneesImpl.java Uses InputNamespaces for namespaced variable reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/CreateRecognizerFeedbackApprovalTaskImpl.java Uses InputNamespaces for recognizer/related entity variable resolution.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/CheckFeedbackSubmitterIsReviewerImpl.java Uses InputNamespaces for recognizer feedback variable resolution.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/AutoApproveServiceTaskImpl.java Uses InputNamespaces for related entity variable resolution.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java Refactors payload namespace reads + DAR expiration handling + recognizer payload typing.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/sink/SinkTaskDelegate.java Uses InputNamespaces for entity list / related entity namespace selection.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/runApp/RunAppDelegate.java Uses InputNamespaces for related entity variable resolution.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/SetGlossaryTermStatusImpl.java Uses InputNamespaces for related entity / updatedBy namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/SetEntityCertificationImpl.java Uses InputNamespaces for related entity / updatedBy namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/SetEntityAttributeImpl.java Uses InputNamespaces for related entity / updatedBy namespace reads; simplifies comments.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/RollbackEntityImpl.java Uses InputNamespaces for related entity / updatedBy namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/RejectRecognizerFeedbackImpl.java Uses InputNamespaces for recognizer feedback / updatedBy namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/DataCompletenessImpl.java Uses InputNamespaces for related entity namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/CheckEntityAttributesImpl.java Uses InputNamespaces for related entity namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/CheckChangeDescriptionTaskImpl.java Uses InputNamespaces for related entity namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/ApplyRecognizerFeedbackImpl.java Uses InputNamespaces for recognizer feedback / updatedBy namespace reads.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/createAndRunIngestionPipeline/RunIngestionPipelineDelegate.java Uses InputNamespaces for workflow input namespace handling.
openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/createAndRunIngestionPipeline/CreateIngestionPipelineDelegate.java Uses InputNamespaces for related entity namespace reads.

Copilot AI review requested due to automatic review settings July 3, 2026 15:58

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

Copilot AI review requested due to automatic review settings July 3, 2026 16:40
@gitar-bot

gitar-bot Bot commented Jul 3, 2026

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

Refactors workflow input namespaces and task payloads to use typed helper records, eliminating ad-hoc maps and unchecked casts. All session findings related to NPEs, redundant copies, and schema field injection have been resolved.

✅ 5 resolved
Edge Case: InputNamespaces throws NPE on null namespace values

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandler.java:30-33
The new InputNamespaces compact constructor does namespaces = namespaces != null ? Map.copyOf(namespaces) : Map.of();. Map.copyOf throws NullPointerException if the map contains any null key or value, whereas the previous code stored the raw map and called map.get(var) which tolerated (and simply returned) null values. So a workflow input-namespace map such as {"relatedEntity": null} would previously proceed with a null namespace (treated as node/global scope in getNamespacedVariable), but now throws NPE inside the delegate's try block, surfacing as a BpmnError/workflow runtime exception. Namespace values are normally non-null strings so the likelihood is low, but this is a genuine behavior change introduced by the refactor. Consider filtering null values (e.g. build the copy explicitly and skip/permit nulls) if defensive tolerance of malformed maps is desired.

Quality: Stale @SuppressWarnings("unchecked") after removing cast

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/ApplyRecognizerFeedbackImpl.java:28-31 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/RejectRecognizerFeedbackImpl.java:29-32
In ApplyRecognizerFeedbackImpl and RejectRecognizerFeedbackImpl, the @SuppressWarnings("unchecked") annotation that previously guarded the JsonUtils.readOrConvertValue(..., Map.class) unchecked assignment is now left in place directly above the new InputNamespaces inputNamespaces = InputNamespaces.from(...) declaration, which performs no unchecked operation. The annotation is now dead and misleading. Remove it to keep the code clean (it may also trigger an 'unnecessary @SuppressWarnings' lint warning depending on compiler settings).

Bug: withGrantExpirationDate injects schema default fields into payload

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:887-901
The DAR schema (dataAccessRequestPayload.json) defines defaults (requestedAccess defaults to Read, columns defaults to []). Previously withGrantExpirationDate preserved the original map verbatim and only added expirationDate, so the persisted task payload contained exactly the keys the caller supplied. Now the method returns a fully-typed DataAccessRequestPayload produced via JsonUtils.convertValue(...).withExpirationDate(...), which materializes those schema defaults. When the task payload is re-serialized/persisted, fields like requestedAccess=Read and columns=[] will now appear even if they were absent in the original request. Additionally, because the default (strict) ObjectMapper is used, any DAR payload map carrying keys outside the schema (additionalProperties:false) would fail conversion (caught, returns payload unchanged), silently skipping expiration computation. Both effects are unlikely to matter for well-formed DAR payloads, but confirm downstream consumers don't depend on the pre-refactor field set. If exactness matters, merge expirationDate without round-tripping through the typed default-bearing record.

Edge Case: withGrantExpirationDate still injects schema defaults for non-Map payloads

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:903-909
The commit fixes the previously-reported default-field injection only for the payload instanceof Map branch. The fallback return darPayload.withExpirationDate(expiration) still round-trips through the typed DataAccessRequestPayload, which re-materializes schema default fields (e.g. requestedAccess, columns) that the input did not carry — the exact behavior the Map branch was added to avoid. In practice workflow payloads are always deserialized JSON Maps, so this branch is effectively dead, but if a payload ever arrives as a POJO/JsonNode the old bug re-surfaces and is untested (the new tests only cover the Map path). Consider either normalizing all payloads to a Map before merging, or documenting/asserting that this branch is unreachable.

Quality: Redundant map copy in withGrantExpirationDate

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:904-905
JsonUtils.convertValue(payload, PAYLOAD_MAP_TYPE) already returns a fresh mutable LinkedHashMap, so the immediately following merged = new LinkedHashMap<>(merged) performs a second, unnecessary copy. The extra allocation can be dropped without changing behavior.

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

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

Comments suppressed due to low confidence (1)

openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/flowable/MainWorkflow.java:116

  • validateNode() can throw a NullPointerException when an input namespace entry has a null/blank value (namespace.equals(...)). Since InputNamespaces explicitly preserves null values, this should be handled explicitly (e.g., skip null/blank namespaces) to avoid crashing workflow validation with an NPE.
      for (Map.Entry<String, String> entry : inputNamespaces.namespaces().entrySet()) {
        String variable = entry.getKey();
        String namespace = entry.getValue();

        if (namespace.equals(GLOBAL_NAMESPACE)) {

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 has reached their quota limit.

Apply the Java simplicity rules from CLAUDE.md to the touched helpers:
- single return per method
- one-line comment on each instanceof explaining why the input is untyped
  (Flowable delivers process variables as raw Object, Jackson variable
  shape for Task.payload)
- drop redundant 'public static' on nested records (records are implicitly
  static; visibility already inherited)
- trim commentary in readDataAccessRequestPayload / readRecognizerFeedbackTaskPayload

Behavior unchanged. 66 unit tests still pass:
mvn -pl openmetadata-service test -Dtest=WorkflowVariableHandlerInputNamespacesTest,CreateTaskTest
@yan-3005 yan-3005 force-pushed the refactor/input-namespaces-typed branch from 95640c4 to a6e80fd Compare July 6, 2026 12:34
# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java
Copilot AI review requested due to automatic review settings July 6, 2026 12:37

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 has reached their quota limit.

@gitar-bot

gitar-bot Bot commented Jul 6, 2026

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

Centralizes workflow input namespace resolution into a typed InputNamespaces record and migrates CreateTask payloads to schema-based POJOs. This refactor improves type safety and null handling, resolving all previous findings.

✅ 8 resolved
Edge Case: InputNamespaces throws NPE on null namespace values

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowVariableHandler.java:30-33
The new InputNamespaces compact constructor does namespaces = namespaces != null ? Map.copyOf(namespaces) : Map.of();. Map.copyOf throws NullPointerException if the map contains any null key or value, whereas the previous code stored the raw map and called map.get(var) which tolerated (and simply returned) null values. So a workflow input-namespace map such as {"relatedEntity": null} would previously proceed with a null namespace (treated as node/global scope in getNamespacedVariable), but now throws NPE inside the delegate's try block, surfacing as a BpmnError/workflow runtime exception. Namespace values are normally non-null strings so the likelihood is low, but this is a genuine behavior change introduced by the refactor. Consider filtering null values (e.g. build the copy explicitly and skip/permit nulls) if defensive tolerance of malformed maps is desired.

Quality: Stale @SuppressWarnings("unchecked") after removing cast

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/ApplyRecognizerFeedbackImpl.java:28-31 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/impl/RejectRecognizerFeedbackImpl.java:29-32
In ApplyRecognizerFeedbackImpl and RejectRecognizerFeedbackImpl, the @SuppressWarnings("unchecked") annotation that previously guarded the JsonUtils.readOrConvertValue(..., Map.class) unchecked assignment is now left in place directly above the new InputNamespaces inputNamespaces = InputNamespaces.from(...) declaration, which performs no unchecked operation. The annotation is now dead and misleading. Remove it to keep the code clean (it may also trigger an 'unnecessary @SuppressWarnings' lint warning depending on compiler settings).

Bug: withGrantExpirationDate injects schema default fields into payload

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:887-901
The DAR schema (dataAccessRequestPayload.json) defines defaults (requestedAccess defaults to Read, columns defaults to []). Previously withGrantExpirationDate preserved the original map verbatim and only added expirationDate, so the persisted task payload contained exactly the keys the caller supplied. Now the method returns a fully-typed DataAccessRequestPayload produced via JsonUtils.convertValue(...).withExpirationDate(...), which materializes those schema defaults. When the task payload is re-serialized/persisted, fields like requestedAccess=Read and columns=[] will now appear even if they were absent in the original request. Additionally, because the default (strict) ObjectMapper is used, any DAR payload map carrying keys outside the schema (additionalProperties:false) would fail conversion (caught, returns payload unchanged), silently skipping expiration computation. Both effects are unlikely to matter for well-formed DAR payloads, but confirm downstream consumers don't depend on the pre-refactor field set. If exactness matters, merge expirationDate without round-tripping through the typed default-bearing record.

Edge Case: withGrantExpirationDate still injects schema defaults for non-Map payloads

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:903-909
The commit fixes the previously-reported default-field injection only for the payload instanceof Map branch. The fallback return darPayload.withExpirationDate(expiration) still round-trips through the typed DataAccessRequestPayload, which re-materializes schema default fields (e.g. requestedAccess, columns) that the input did not carry — the exact behavior the Map branch was added to avoid. In practice workflow payloads are always deserialized JSON Maps, so this branch is effectively dead, but if a payload ever arrives as a POJO/JsonNode the old bug re-surfaces and is untested (the new tests only cover the Map path). Consider either normalizing all payloads to a Map before merging, or documenting/asserting that this branch is unreachable.

Quality: Redundant map copy in withGrantExpirationDate

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:904-905
JsonUtils.convertValue(payload, PAYLOAD_MAP_TYPE) already returns a fresh mutable LinkedHashMap, so the immediately following merged = new LinkedHashMap<>(merged) performs a second, unnecessary copy. The extra allocation can be dropped without changing behavior.

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

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

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

Labels

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.

3 participants