You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "DanielLeens (via GitHub)" <gi...@apache.org> on 2026/09/05 16:20:16 UTC

[I] [Improve][Zeta] Add a JobStatus ordinal guard test and replace ordinal comparisons with explicit state sets [seatunnel]

DanielLeens opened a new issue, #12124:
URL: https://github.com/apache/seatunnel/issues/12124

   ## Description
   
   This is a hardening task. There is no current failure caused by the `JobStatus` enum order; the goal is to make the existing coupling explicit and guarded.
   
   Verified at `dev` commit `97d461bc0773399d632fd078735736ecd44f5f0b`:
   
   - Internal RPC transports the raw ordinal: `GetJobStatusOperation.java:81` (`response = future.get().ordinal();`). Clients decode it with `JobStatus.values()[ordinal]` (`ClientJobProxy.java:154`, `JobClient.java:121`); REST services decode the same RPC result (`rest/service/BaseService.java:386`, `rest/service/JobInfoService.java:360`) and then emit text (`BaseService.java:437`, `jobStatus.toString()`). The external HTTP API is therefore textual; the coupling is the internal RPC/client contract.
   - Control flow relies on enum order: `PhysicalPlan.java:207` and `:254` use `jobStatus.ordinal() <= JobStatus.PENDING.ordinal()` in cancel/stop; `:105` and `:115` index a timestamp array by ordinal; `diagnostic/JobRuntimeDiagnostics.java:134` consumes that array by ordinal.
   - Tests: `ClusterFaultToleranceIT.java:121-122` and `ClusterFaultToleranceTwoPipelineIT.java:264-265` compare `getJobStatus().ordinal() >= JobStatus.RUNNING.ordinal()`; `JobStatusTest` covers locale conversion only. No test pins the ordinal table.
   
   ## Expected outcome
   
   - A unit test that pins the exact `JobStatus` ordinal table so any reorder or insertion fails loudly.
   - Replace ordinal range comparisons in `PhysicalPlan` with explicit state sets.
   - A name-based, versioned RPC transport is a separate design item and is not required for this issue.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Add a JobStatus ordinal guard test and replace ordinal comparisons with explicit state sets [seatunnel]

Posted by "CryoThrust (via GitHub)" <gi...@apache.org>.
CryoThrust commented on issue #12124:
URL: https://github.com/apache/seatunnel/issues/12124#issuecomment-5560395010

   I would like to take this hardening task. I will keep the scope limited to a pinned JobStatus ordinal compatibility test and replacing ordinal range checks in PhysicalPlan with explicit state sets, without changing the internal RPC wire format. I will add focused tests for cancellation/stop behavior and preserve the existing semantics for each state. Please let me know if someone is already working on it.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Add a JobStatus ordinal guard test and replace ordinal comparisons with explicit state sets [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12124:
URL: https://github.com/apache/seatunnel/issues/12124#issuecomment-5564710508

   Thanks @CryoThrust for picking this up and for keeping the scope tight — a pinned JobStatus ordinal compatibility test plus replacing the ordinal range checks in PhysicalPlan with explicit state sets is exactly what this task calls for, and leaving the internal RPC wire format untouched is the right call.
   
   Nobody else has claimed this, so it's yours. A few things I'd like to see covered in the PR you mentioned (#12156) so we can review it efficiently:
   
   1. **Ordinal guard test**: please make sure it asserts the full ordinal table for every JobStatus value (not just the pre-start ones), with a clear failure message explaining that reordering the enum breaks internal RPC compatibility. That way a future contributor inserting a new state in the middle gets a direct hint instead of a cryptic mismatch.
   2. **Explicit state sets in PhysicalPlan**: for each ordinal comparison you replace, it would help to note in the PR description (or a short code comment) which states the original range check covered, so reviewers can confirm the membership set is semantically identical and no state silently fell in or out.
   3. **Cancellation/stop tests**: you mentioned adding focused tests for these paths — please include cases for a job that is cancelled before it starts and one that is cancelled after it has started, since those are the two branches the pre-start membership check distinguishes.
   
   Once those are in place, ping me on the PR and I'll take a look. Thanks again!
   
   <!-- streview-comment:870 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Improve][Zeta] Add a JobStatus ordinal guard test and replace ordinal comparisons with explicit state sets [seatunnel]

Posted by "CryoThrust (via GitHub)" <gi...@apache.org>.
CryoThrust commented on issue #12124:
URL: https://github.com/apache/seatunnel/issues/12124#issuecomment-5560416611

   I opened PR #12156 with the scoped hardening change: explicit pre-start status membership in PhysicalPlan plus a guard test for the internal JobStatus ordinal table. The RPC wire format is unchanged.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org