Repository navigation
[Fix][Zeta] Make job status parsing locale independent - #11894
Conversation
|
Looks good to me. Thanks for your contribution! |
DanielLeens
left a comment
There was a problem hiding this comment.
What Problem Does This PR Solve?
JobStatus.fromString(String status) upper-cases the input with String.toUpperCase() (JVM default locale) before calling JobStatus.valueOf(...). Under a Turkish (tr/tr-TR) default JVM locale, Java's well-known locale-sensitive casing rule converts lowercase i to İ (dotted capital I, U+0130) instead of the ASCII I, so "finished".toUpperCase() becomes "FİNİSHED", which doesn't match the enum constant FINISHED — JobStatus.valueOf(...) throws IllegalArgumentException. This PR switches to toUpperCase(Locale.ROOT), the standard fix for exactly this class of bug (locale-independent case conversion for programmatic string matching), and adds a regression test that reproduces the failure under tr-TR.
1. Code Change Review
1.1 Core Logic Analysis
Before: return JobStatus.valueOf(status.toUpperCase());
After: return JobStatus.valueOf(status.toUpperCase(Locale.ROOT));
This is the textbook-correct fix for the "Turkish locale bug" — a genuine, frequently-cited JDK gotcha (not a novel or exotic edge case), and Locale.ROOT is the idiomatic choice here (language-neutral Unicode default rules) rather than hardcoding e.g. Locale.US, which is the pattern recommended by the JDK docs themselves for this exact situation.
Runtime-path check (important — did I verify the normal path actually reaches this code): I searched the entire apache/seatunnel tree (main sources, excluding this PR's own new test) for callers of JobStatus.fromString and JobStatus.valueOf. There are no other callers anywhere in the repository — the only place fromString is invoked is the new JobStatusTest added by this PR itself. So today, no in-tree SeaTunnel job-execution path (CLI, REST, Zeta master/worker, checkpoint/restore, etc.) is affected by this bug, because nothing in-repo currently calls this method. This doesn't make the fix wrong — fromString is a public static method on a public enum in seatunnel-engine-common, which is a library consumed outside this repo (external tooling, SDK users, the web console/other Whale-family products that depend on this jar), so a latent locale bug in a public parsing API is still worth fixing defensively. I just want to be explicit that the practical blast radius today is "public API correctness for external consumers," not "currently-running production job status parsing," since no current in-tree caller exercises it.
1.2 Compatibility Impact
Fully compatible. Locale.ROOT and the JVM default locale produce identical output for every locale except a small set of locale-specific casing exceptions (Turkish i/İ/ı/I, and similarly Azerbaijani; Lithuanian has some dot-related lowercase quirks but not relevant here). For any JVM not running under one of those locales, behavior is byte-for-byte unchanged. No config/API/serialization changes.
1.3 Performance / Side-Effect Analysis
None — same-cost string operation, no new allocations of consequence, no new IO/locking.
1.4 Error Handling and Logging
No issues found. The method's failure mode (IllegalArgumentException from valueOf on a genuinely-unrecognized status string) is unchanged for actually-invalid input; this PR only removes a false-positive failure for the Turkish-locale case.
2. Code Quality Assessment
2.1 Coding Standards
Clean, minimal, single-line fix consistent with the rest of the file. No new public method/field was added that would require a fresh Javadoc.
2.2 Test Coverage and Test Stability
Stable, and notably well-guarded against the exact class of flakiness this kind of test usually introduces. Locale.setDefault(...) mutates process-wide, shared JVM static state — a real risk for test-suite flakiness if another test running concurrently (or afterward) depends on the default locale. The author correctly:
- Saves
Locale.getDefault()before mutating and restores it in afinallyblock, so the mutation can't leak into other tests even if the assertion fails. - Annotates the test with
@ResourceLock("default-locale")(JUnit 5), which prevents this test from running concurrently with any other test that also declares the same resource lock — the standard, correct JUnit 5 mechanism for guarding shared global mutable state under parallel test execution. (Note this only protects against other tests that also declare the same lock name; it's a convention-based guard, not an OS-level lock — but it's the right tool and the right usage for this repo's JUnit 5 test setup.) - The regression test was verified to fail pre-fix with the exact expected error (
No enum constant ... JobStatus.FİNİSHED), per the PR description — good practice, confirms the test actually exercises the bug rather than trivially passing either way.
Rating: Stable.
2.3 Documentation Updates
None included; none required — internal parsing-correctness fix, no user-facing config or behavior contract change.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise, minimal fix — addresses the actual root cause (locale-sensitive case conversion) with the standard idiomatic JDK fix, no over-engineering.
3.2 Maintainability
Trivial to maintain; a one-line change with a test that pins the exact failure mode it prevents.
3.3 Extensibility
N/A for a fix this small.
3.4 Historical-Version Compatibility
No state/checkpoint/serialization impact. Behavior is identical for all locales except the Turkish-family exception, where it goes from "throws" to "works correctly" — a strict improvement, not a semantic change for any currently-working case.
4. Issue Summary
No blocking issues found.
5. Merge Recommendation
Conclusion: Ready to merge after fixes
- Blockers — must be fixed:
- CI (environmental, not PR-caused): The fork's
Buildrun (https://github.com/hiSandog/seatunnel/actions/runs/32330154129, head628c16b0) failed after ~5h19m. I checked the actual failing jobs and none of them touch this PR's code:Run / unit-test (8, windows-latest)— failed at[ERROR] Failed to execute goal on project connector-druid: Could not resolve dependencies ... transfer failed for .../druid-processing-24.0.1.jar: Read timed out— a pure Maven Central network timeout unrelated toseatunnel-engine-common.Run / all-connectors-it-7 (11, ubuntu-latest)andRun / doris-connector-it (11, ubuntu-latest)— unrelated connector/IT modules this PR doesn't touch.
This is textbook CI infrastructure flake, not a real failure introduced by this diff (a 2-file change confined toseatunnel-engine-common'sJobStatus.java/JobStatusTest.java). Recommended next step: re-run the failed jobs (Run / unit-test (8, windows-latest),Run / all-connectors-it-7,Run / doris-connector-it) rather than patching any code.
- Draft status: this PR is currently marked as a draft — worth converting to "Ready for review" once the CI re-run comes back green, so it can move toward merge.
- CI (environmental, not PR-caused): The fork's
- Recommended fixes — non-blocking: none.
The fix itself is correct, minimal, and well-tested, including a thoughtful guard (@ResourceLock + try/finally) against the shared-global-state flakiness that Locale.setDefault-based tests commonly introduce. Once CI is green (a rerun should suffice — the failures are unrelated infra flake) and the PR is marked ready for review, this looks mergeable as-is. Thanks for tracking down a real, if narrow-blast-radius-today, JDK locale gotcha!
|
Following up on my previous review — both blockers I flagged are now resolved as of the current head (
With both items cleared, my technical conclusion moves from "Ready to merge after fixes" to Ready to merge — I have no remaining blockers from my side. A maintainer with write/approve permission can take it from here to finalize the merge decision. Thanks again for the clean fix! |
DanielLeens
left a comment
There was a problem hiding this comment.
CI-recovery follow-up on this same head (628c16b0).
My 2026-08-20 review concluded "Ready to merge after fixes" with exactly two blockers, both non-code:
- CI: the fork's
Buildrun had failed on an unrelated Maven Central network timeout (connector-druiddependency resolution) plus two unrelated connector/IT jobs — diagnosed as infra flake, not caused by this diff. - Draft status: the PR was still marked as a draft.
Both are now cleared:
- Current CI on this exact head is fully green (
Build,Notify test workflow,labelerallpass). - The PR is no longer a draft.
No code-level concerns were raised in Section 4 of my original review ("No blocking issues found"), and there have been no new commits since. CI and draft status were the only two things keeping this from merging, so I'm changing my conclusion to Approve.
Thanks again for tracking down a real, if narrow-blast-radius-today, JDK locale gotcha!
davidzollo
left a comment
There was a problem hiding this comment.
+1
LGTM
Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here!
Please ignore the following message if you have joined in the Slack~
To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
Slack workspace link: https://s.apache.org/seatunnel-slack
This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄
Purpose of this pull request
JobStatus.fromStringcurrently uppercases status values with the JVM default locale. Under a Turkish default locale,finishedbecomesFİNİSHED, soJobStatus.valueOfthrows anIllegalArgumentException.This patch uses
Locale.ROOTfor locale-independent enum parsing and adds a regression test that exercises the Turkish-locale case.Does this PR introduce any user-facing change?
Yes. Lowercase job status values are now parsed consistently regardless of the JVM default locale. Behavior in locales unaffected by special case mappings remains unchanged.
How was this patch tested?
A regression test was added in
JobStatusTestand was verified to fail before the fix withNo enum constant ... JobStatus.FİNİSHED.The following checks pass:
./mvnw -q -pl seatunnel-engine/seatunnel-engine-common -am -Dtest=JobStatusTest -Dsurefire.failIfNoSpecifiedTests=false -Dskip.spotless=true test ./mvnw -q spotless:apply CYPRESS_INSTALL_BINARY=0 ./mvnw -q -DskipTests verifyCYPRESS_INSTALL_BINARY=0only skips downloading the Cypress browser binary, which is not used by the-DskipTestsverification.Check list
incompatible-changes.mdentry.