[Improve][Zeta] Add a JobStatus ordinal guard test and replace ordinal comparisons with explicit state sets
- Dominant language
- Java
- Stars
- 9.7k
- Forks
- 2.4k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 204
Description
## 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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the JobStatus enum, JobStatusTest, and the ordinal use sites in PhysicalPlan.java and diagnostic/JobRuntimeDiagnostics.java. Review GetJobStatusOperation.java, ClientJobProxy.java, and JobClient.java to understand the internal RPC contract, then run the named ClusterFaultToleranceIT and ClusterFaultToleranceTwoPipelineIT cases. Done means the exact ordinal table is guarded and PhysicalPlan no longer uses ordinal range comparisons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100