Skip to content

fix(workflow-compiling-service): LogicalLink OperatorIdentity round-trip#5729

Open
wwong0 wants to merge 1 commit into
apache:mainfrom
wwong0:fix/5042-logicallink-operatoridentity-round-trip
Open

fix(workflow-compiling-service): LogicalLink OperatorIdentity round-trip#5729
wwong0 wants to merge 1 commit into
apache:mainfrom
wwong0:fix/5042-logicallink-operatoridentity-round-trip

Conversation

@wwong0

@wwong0 wwong0 commented Jun 16, 2026

Copy link
Copy Markdown

What changes were proposed in this PR?

Bug fix: LogicalLink @JsonCreator constructor (amber and workflow-compiling-service)

@JsonCreator was previously placed on the String convenience constructor of LogicalLink in both modules. OperatorIdentity is a case class that Jackson serializes as an object ({"id":"op-A"}), not a plain string. When reading back a serialized LogicalLink, Jackson dispatched to the @JsonCreator String constructor but could not coerce the {"id":"op-A"} object node to a String, causing any writeValueAsStringreadValue round-trip to fail with MismatchedInputException.

The fix introduces a private readOperatorIdentity(node: JsonNode, fieldName: String) helper in the companion object and moves @JsonCreator to a new JsonNode constructor that delegates to it. The helper accepts both the plain-string shape (front-end input) and the object shape (serialized form), maps null/absent ids to OperatorIdentity(null), and rejects malformed nodes. The String convenience constructor is retained but no longer carries @JsonCreator.

Any related issues, documentation, discussions?

Closes #5042
This PR continues and adopts work from #5175

How was this PR tested?

The new workflow-compiling-service LogicalLinkSpec adds unit coverage of LogicalLink and readOperatorIdentity model-level logic that existing tests do not cover and pins the leniency contract (no require guards in the compiler-service variant).

The existing amber LogicalLinkSpec was updated to match the renamed constructor section, drop the now-invalid MismatchedInputException expectation, and add a passing round-trip test.

Run with:

sbt "WorkflowExecutionService/testOnly *LogicalLinkSpec"

Result: 18/18 tests pass

sbt "WorkflowCompilingService/testOnly *LogicalLinkSpec"

Result: 15/15 tests pass

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Sonnet 4.6

…ound-trip

Prior to this change, `@JsonCreator` was placed on the `String`
convenience constructor in both `amber` and `workflow-compiling-service`
`LogicalLink`. Jackson serialises `OperatorIdentity` as an object
(`{"id":"op-A"}`), so any round-trip through `writeValueAsString` /
`readValue` failed with `MismatchedInputException` because the String
constructor cannot accept an object node.

Fix: add a private `readOperatorIdentity(JsonNode, String)` helper to
the companion object and move `@JsonCreator` to a new `JsonNode`
constructor that delegates to it. The helper handles the string shape
(front-end input), the object shape (serialised form), null/absent
fields, and rejects non-text / non-object nodes with
`IllegalArgumentException`.

The new `workflow-compiling-service` `LogicalLinkSpec` adds direct unit
coverage of the `readOperatorIdentity` branches that the existing
HTTP-layer-only `WorkflowCompilationResourceSpec` did not reach. It also
pins the leniency contract (no `require` guards) and the Jackson
annotation contract (`@JsonProperty` key pinning, round-trip fidelity).
The `amber` `LogicalLinkSpec` is updated to match the renamed constructor
section, drop the now-invalid MismatchedInputException expectation, and add
the round-trip test.

Closes apache#5042
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your first contribution to Texera, @wwong0!

If you're looking for a good place to start, browse issues labeled starter-task; they're scoped to be approachable for newcomers.

You can drive common housekeeping yourself by commenting one of these commands on its own line:

  • Issues. Comment /take to assign an open issue to yourself, or /untake to release it. You can find unclaimed work with the search filter is:issue is:open no:assignee.
  • Sub-issues. To link issues into a parent/child hierarchy, comment /sub-issue #5166 #5222 on the parent to attach those children (or /unsub-issue #5166 #5222 to detach them). From a child issue, comment /parent-issue #5166 to set its parent, or /unparent-issue to clear it (the current parent is detected automatically). References may be written as #5166 or as a bare 5166; cross-repository references are not supported.
  • Pull requests (author only). Comment /request-review @user to request a review from someone, or /unrequest-review @user to withdraw that request.

Each command must match exactly: /take this will not work, only /take does. For the full contribution flow, see CONTRIBUTING.md.

@github-actions github-actions Bot added engine fix platform Non-amber Scala service paths labels Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine fix platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LogicalLink: writeValueAsString / readValue is not round-trippable for OperatorIdentity fields

1 participant