aglinxinyuan opened a new pull request, #5739:
URL: https://github.com/apache/texera/pull/5739

   ### What changes were proposed in this PR?
   
   Pin behavior of three small operator-package utility / contract classes in 
`common/workflow-operator/`. The value is regression coverage against 
accidental renames, default-value drift, and Jackson-annotation drift — there 
is no heavy infrastructure involved. No production-code changes.
   
   | Spec | Source class | Tests |
   | --- | --- | --- |
   | `OperatorDescriptorUtilsSpec` | `OperatorDescriptorUtils` (object) | 11 |
   | `PropertyNameConstantsSpec` | `PropertyNameConstants` (object) | 5 |
   | `PortDescriptorSpec` | `PortDescriptor` (trait) + `PortDescription` (case 
class) | 10 |
   
   All three spec files follow the `<srcClassName>Spec.scala` one-to-one 
convention.
   
   **Behavior pinned — `OperatorDescriptorUtils.equallyPartitionGoal`**
   
   | Surface | Contract |
   | --- | --- |
   | Exact division (`100 / 4`) | every worker gets `25` |
   | Inexact (`10 / 3`, remainder 1) | `[4, 3, 3]` — first worker gets +1 |
   | Inexact (`11 / 3`, remainder 2) | `[4, 4, 3]` — first two workers each get 
+1 |
   | Result length | always equals `totalNumWorkers` |
   | Sum invariant | `parts.sum == goal` for every case |
   | `goal = 0` | every worker gets `0` |
   | `totalNumWorkers = 1` | single entry equal to `goal` |
   
   **Behavior pinned — `OperatorDescriptorUtils.toImmutableMap`**
   
   | Surface | Contract |
   | --- | --- |
   | Empty java map | returns `Map.empty` |
   | Populated java map | every entry preserved |
   | Source mutation after conversion | does NOT leak into the returned Scala 
map (no lazy view) |
   | Return type | `scala.collection.immutable.Map[K, V]` (compile-time 
enforced) |
   
   **Behavior pinned — `PropertyNameConstants`**
   
   | Surface | Contract |
   | --- | --- |
   | Logical-plan keys (`OPERATOR_ID`, `OPERATOR_TYPE`, `OPERATOR_LIST`, 
`OPERATOR_LINK_LIST`, `OPERATOR_VERSION`, `ORIGIN_OPERATOR_ID`, 
`DESTINATION_OPERATOR_ID`) | exact canonical String values |
   | Common operator keys (`ATTRIBUTE_NAMES`, `ATTRIBUTE_NAME`, 
`RESULT_ATTRIBUTE_NAME`, `SPAN_LIST_NAME`, `TABLE_NAME`) | exact canonical 
String values |
   | Physical-plan keys (`WORKFLOW_ID`, `EXECUTION_ID`, `PARALLELIZABLE`, 
`LOCATION_PREFERENCE`, `PARTITION_REQUIREMENT`, `INPUT_PORTS`, `OUTPUT_PORTS`, 
`IS_ONE_TO_MANY_OP`, `SUGGESTED_WORKER_NUM`) | exact canonical String values |
   | All constants together | distinct values (no accidental alias) |
   | No constant carries leading / trailing whitespace | enforced by `_.trim` 
round-trip |
   
   **Behavior pinned — `PortDescriptor` / `PortDescription`**
   
   | Surface | Contract |
   | --- | --- |
   | `PortDescriptor` defaults | `inputPorts` / `outputPorts` are `null` 
(Jackson sets them post-construction); both are mutable `var`s |
   | `PortDescription` constructor | preserves every field; `dependencies` 
defaults to `List.empty` |
   | Case-class equality / `copy` | standard semantics |
   | `@JsonIgnoreProperties("allowMultiInputs")` | present on `PortDescription` 
— verified via reflection (backward-compat for pre-PR-#4379 workflows) |
   | Legacy-JSON deserialization | a JSON payload that still includes 
`allowMultiInputs` deserializes WITHOUT `UnrecognizedPropertyException` |
   | JSON round-trip | preserves `portID` / `displayName` / 
`disallowMultiInputs` / `isDynamicPort` / `dependencies` |
   
   ### Any related issues, documentation, discussions?
   
   Closes #5735.
   
   ### How was this PR tested?
   
   Pure unit-test additions; verified locally with:
   
   - `sbt "WorkflowOperator/testOnly 
org.apache.texera.amber.operator.util.OperatorDescriptorUtilsSpec 
org.apache.texera.amber.operator.metadata.PropertyNameConstantsSpec 
org.apache.texera.amber.operator.PortDescriptorSpec"` — 26 tests, all green
   - `sbt scalafmtCheckAll` — clean
   - CI to confirm
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.7 [1M context])


-- 
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]

Reply via email to