aglinxinyuan opened a new pull request, #4956:
URL: https://github.com/apache/texera/pull/4956
### What changes were proposed in this PR?
Adds `LogicalLinkSpec` covering the case class at
`amber/src/main/scala/org/apache/texera/workflow/LogicalLink.scala`. It has two
construction paths (the primary case-class constructor + a secondary
`@JsonCreator` overload that takes raw `String` op-ids) and ships across the
wire / persisted in saved workflows, but had no unit test.
| Surface | Pinned |
| --- | --- |
| Primary constructor | Four fields exposed as constructed. |
| Secondary `@JsonCreator` constructor | Wraps raw `String` op-ids in
`OperatorIdentity`; equal to a primary-constructor link with the same content. |
| Case-class `equals` / `hashCode` | Structural equality across the four
fields, plus distinguishing field-by-field (`fromOpId` mismatch,
`toPortId.internal` mismatch). |
| Identifier acceptance | Dashes, dots, digits, and the empty string are
accepted without normalization. |
| Self-loop links | `fromOpId == toOpId` is structurally allowed (cycles are
rejected at higher layers, not here). |
| Jackson deserialization (`JSONUtils.objectMapper`) | `treeToValue` from a
JSON object with raw-string op-ids dispatches to the `@JsonCreator` string
overload and produces the expected fields. |
| `@JsonProperty` JSON field names | `fromOpId` / `toOpId` / `fromPortId` /
`toPortId` pinned on the wire so a renamed Scala field can't silently break
saved workflows. |
| `writeValueAsString` ↔ `readValue` asymmetry | Confirmed NOT
round-trippable: `writeValueAsString` emits OperatorIdentity as `{"id":"op-A"}`
(object form), but the `@JsonCreator` String overload that Jackson dispatches
to on read can't accept an object for `fromOpId`. The asymmetry is pinned so a
future fix (object `@JsonCreator` overload or custom `@JsonDeserialize`) flips
this on purpose. |
| Missing-field default behavior | Missing op-id fields silently produce
`OperatorIdentity(null)` — no validation in the `@JsonCreator` path. Pinned so
a future non-null check fails this on purpose. |
No production code changed; this is test-only.
### Any related issues, documentation, discussions?
Closes #4955
### How was this PR tested?
```
sbt "WorkflowExecutionService/Test/testOnly
org.apache.texera.workflow.LogicalLinkSpec"
# → 12 tests, all pass
sbt "WorkflowExecutionService/Test/scalafmtCheck"
# → clean
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]