test(amber): add unit tests for workflow-core PartitionInfo, WorkflowRuntimeException, WorkflowContext#4806
Conversation
…RuntimeException, WorkflowContext Closes apache#4804 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4806 +/- ##
============================================
+ Coverage 42.04% 42.08% +0.03%
- Complexity 2161 2170 +9
============================================
Files 980 980
Lines 36292 36292
Branches 3783 3783
============================================
+ Hits 15260 15272 +12
+ Misses 20110 20100 -10
+ Partials 922 920 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds ScalaTest unit coverage for three previously untested common/workflow-core components, focusing on partition semantics, workflow-context defaults/mutability, and WorkflowRuntimeException constructor/toString behavior.
Changes:
- Add
PartitionInfoSpeccoveringsatisfies,merge,RangePartition.applyfallback behavior, and current@JsonSubTypesregistration. - Add
WorkflowRuntimeExceptionSpeccovering constructor overloads, null-cause behavior, andtoString. - Add
WorkflowContextSpeccovering companion defaults, default construction, field reassignment, and constructor overrides.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/WorkflowContextSpec.scala | Tests pinned defaults and mutability/override behavior for WorkflowContext. |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala | Tests partition compatibility/merge rules and inspects Jackson subtype registration. |
| common/workflow-core/src/test/scala/org/apache/texera/amber/core/WorkflowRuntimeExceptionSpec.scala | Tests WorkflowRuntimeException constructors, cause/worker capture, and toString. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ixed The original spec said "register all concrete subclasses" but its body asserted that OneToOnePartition is NOT in the set. Split into two tests: one that pins the current registration set without claiming completeness, and one wrapped in pendingUntilFixed that asserts the intended contract (OneToOnePartition is registered). The latter flips to a deliberate failure once the bug is fixed, prompting removal of the marker.
# Conflicts: # common/workflow-core/src/test/scala/org/apache/texera/amber/core/workflow/PartitionInfoSpec.scala
What changes were proposed in this PR?
Adds scalatest coverage for three small
common/workflow-coremodules that had no dedicated specs:PartitionInfoSpec—satisfiesreflexivity + UnknownPartition universal-accepter + non-symmetric semantics,mergesame/different/RangePartition-override,RangePartition.applyfactory's empty-names fallback to UnknownPartition,@JsonSubTypesregistration set, case-class equality.WorkflowRuntimeExceptionSpec— all four constructor overloads (message-only, message + cause + workerId, cause + workerId, cause-only, no-arg), null-cause fallback,toStringreturning the raw message field.WorkflowContextSpec— companion-object pinned defaults (workflow id1L, execution id1L), default-constructed instance honours those,varfield reassignment, constructor argument override.Any related issues, documentation, discussions?
Closes #4804.
Bug pinned in the spec with explanatory comment (filed separately as a Bug issue): the
@JsonSubTypesannotation onPartitionInfodoes not registerOneToOnePartition, so Jackson cannot deserialize a polymorphic payload that selects that subclass via thetypefield. The other five concrete partitions are all registered.How was this PR tested?
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-7)