fix(workflow-compiling-service): LogicalLink OperatorIdentity round-trip#5729
Open
wwong0 wants to merge 1 commit into
Open
fix(workflow-compiling-service): LogicalLink OperatorIdentity round-trip#5729wwong0 wants to merge 1 commit into
wwong0 wants to merge 1 commit into
Conversation
…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
Contributor
|
👋 Thanks for your first contribution to Texera, @wwong0! If you're looking for a good place to start, browse issues labeled You can drive common housekeeping yourself by commenting one of these commands on its own line:
Each command must match exactly: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Bug fix:
LogicalLink@JsonCreatorconstructor (amberandworkflow-compiling-service)@JsonCreatorwas previously placed on theStringconvenience constructor ofLogicalLinkin both modules.OperatorIdentityis a case class that Jackson serializes as an object ({"id":"op-A"}), not a plain string. When reading back a serializedLogicalLink, Jackson dispatched to the@JsonCreatorString constructor but could not coerce the{"id":"op-A"}object node to aString, causing anywriteValueAsString→readValueround-trip to fail withMismatchedInputException.The fix introduces a private
readOperatorIdentity(node: JsonNode, fieldName: String)helper in the companion object and moves@JsonCreatorto a newJsonNodeconstructor 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 toOperatorIdentity(null), and rejects malformed nodes. TheStringconvenience 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-serviceLogicalLinkSpecadds unit coverage ofLogicalLinkandreadOperatorIdentitymodel-level logic that existing tests do not cover and pins the leniency contract (norequireguards in the compiler-service variant).The existing
amberLogicalLinkSpecwas updated to match the renamed constructor section, drop the now-invalidMismatchedInputExceptionexpectation, and add a passing round-trip test.Run with:
Result: 18/18 tests pass
Result: 15/15 tests pass
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Sonnet 4.6