Repository navigation
[Improve][Core] Add JSON config validation output - #12101
CryoThrust wants to merge 11 commits into
Conversation
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the contribution, Yohanes! This is a nice, self-contained addition to the config-validation CLI. I went through the full diff and traced how it changes (and, importantly, doesn't change) the existing --check/--dry-run output path.
What Problem Does This PR Solve?
- User pain point:
seatunnel.sh --check(or--dry-run static/connect) only ever produced a human-readable text message. Anyone wiring config validation into automation (CI pipelines, pre-deploy checks, IDE tooling) had nothing structured to parse, so they'd have to scrape free-form text. - Fix approach: Adds a new
--format [text|json]CLI option. Whenjsonis requested (and only alongside--check/--dry-run static/--dry-run connect),SeaTunnelConfValidateCommandnow also prints a versioned, structuredConfigValidationResultJSON document to stdout on both success and failure, in addition to the existing behavior. - One-sentence summary: Gives automation a stable, machine-readable validation result without touching the existing text-mode output or exit-code contract that current scripts already depend on.
1. Code Change Review
1.1 Core Logic Analysis
Files with the core change:
OutputFormat.java(new enum:TEXT,JSON).ClientCommandArgs.java: new--formatoption +OutputFormatConverter+ avalidateCommandOptions()guard requiring--check/--dry-run static/--dry-run connect.SeaTunnelConfValidateCommand.java: newprintJsonResultIfRequested(...)calls on the success path and on both failure branches (CONNECTand static) insideexecute().
Before:
Path configPath = FileUtils.getConfigPath(clientCommandArgs);
try {
Config config = ConfigBuilder.of(configPath, ...);
...
} catch (Exception e) {
...
if (clientCommandArgs.getDryRun() == DryRun.CONNECT) {
message = DryRunConnectFailureMessageSanitizer.sanitize(message);
throw new ConfigCheckException(validationMode + " failed: " + message);
}
throw new ConfigCheckException(validationMode + " failed: " + message, e);
}After (success path, and both catch branches gain a JSON emit):
printJsonResultIfRequested(ConfigValidationResult.success(validationPhase()));
...
} catch (Exception e) {
...
if (clientCommandArgs.getDryRun() == DryRun.CONNECT) {
message = DryRunConnectFailureMessageSanitizer.sanitize(message);
printJsonResultIfRequested(ConfigValidationResult.failure(validationPhase(),
toValidationError(message == null ? "Validation failed" : message)));
throw new ConfigCheckException(validationMode + " failed: " + message);
}
String sanitizedMessage = DryRunConnectFailureMessageSanitizer.sanitize(message);
printJsonResultIfRequested(ConfigValidationResult.failure(validationPhase(),
toValidationError(sanitizedMessage == null ? "Validation failed" : sanitizedMessage)));
throw new ConfigCheckException(validationMode + " failed: " + message, e); // note: uses `message`, not `sanitizedMessage`
}
private void printJsonResultIfRequested(ConfigValidationResult result) {
if (clientCommandArgs.getOutputFormat() == OutputFormat.JSON) {
System.out.println(result.toJson());
}
}Key findings
- Normal path reachability:
printJsonResultIfRequestedis gated onoutputFormat == OutputFormat.JSON, whose default isOutputFormat.TEXT(ClientCommandArgs.java:100). For every existing invocation that never passes--format, this method is a guaranteed no-op — I traced every call site added in this diff and none of them changed the text-mode/no-flag code path. - The one non-additive change is that
Path configPath = FileUtils.getConfigPath(clientCommandArgs);moved from before thetryto inside it. I checkedFileUtils.getConfigPath(seatunnel-core-starter/.../utils/FileUtils.java:45-54, the shared implementation this module'sFileUtilssymbol resolves to): it only throws for an unreachabledefaultdeploy-mode branch or (via the@NonNullLombok check) a nullargs, neither reachable from the CLI in practice. So this move is safe in practice, but worth calling out explicitly rather than silently. - Real gap (Issue 1 below): for the static (non-connect) failure branch, the code computes
sanitizedMessageviaDryRunConnectFailureMessageSanitizer.sanitize(message)specifically to feed the new JSON payload, but theConfigCheckExceptionthrown right after still uses the original, unsanitizedmessage. That's very likely just a copy-paste slip (theCONNECTbranch reassignsmessageitself so both the JSON and the exception pick up the sanitized value; the static branch introduces a second variable and only uses it for JSON). - Scenario covered: CLI validation via
--check/--dry-run static/--dry-run connectwith--format json; both success and failure are covered by tests. - This is a precise, additive fix for the stated goal (structured output), with one real but narrow follow-on bug (Issue 1) introduced alongside it.
1.2 Compatibility Impact
Fully compatible for every existing caller. I verified this concretely, not just asserted it:
- Default
outputFormat = OutputFormat.TEXTmeansprintJsonResultIfRequestednever fires unless--format jsonis explicitly passed — a flag that didn't exist before this PR, so no existing script can be passing it today. - The exact text of
ConfigCheckException's message (validationMode + " failed: " + message) for both the CONNECT and static branches is byte-for-byte unchanged fromdevHEAD — so any CI/script that greps"Static analysis failed:"or"Connectivity check failed:"keeps working identically. - Exit-code behavior is unchanged:
ConfigCheckExceptionstill propagates exactly as before;printJsonResultIfRequestedonly ever adds an extraSystem.out.println, gated behind the new flag. - No config option default value, protocol, or serialization format is touched elsewhere.
Not incompatible; no incompatible-changes.md entry is needed.
1.3 Performance / Side-Effect Analysis
Negligible — one JSON serialization (ConfigValidationResult.toJson(), plain Jackson ObjectNode construction) per validation run, only when --format json is requested. No new retries, no new locks, no new I/O beyond a System.out.println.
1.4 Error Handling and Logging
Issue 1: Static-validation-failure JSON is sanitized, but the exception message thrown for the exact same failure is not
- Location:
seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/SeaTunnelConfValidateCommand.java(catch block, static branch — the lines addingString sanitizedMessage = DryRunConnectFailureMessageSanitizer.sanitize(message);followed a few lines later bythrow new ConfigCheckException(validationMode + " failed: " + message, e);) - Problem description: For a static (
--check/--dry-run static) validation failure, the new JSON payload correctly usessanitizedMessage, but theConfigCheckExceptionthrown immediately after still builds its message from the original, unsanitizedmessagevariable. SinceSeaTunnelClient.main()only catchesError, this exception propagates out ofmain()and its message is printed by the JVM's default uncaught-exception handler (to stderr) — visible in terminal output and in captured CI/automation logs. - Potential risk: Static validation errors can, in at least one real path, echo back part of the user's raw config text — e.g.
validateSqlTransformSyntaxreflectively invokes JSqlParser and wrapse.getTargetException().getMessage()into the thrownConfigCheckException(SeaTunnelConfValidateCommand.java,validateSqlTransformSyntax); a parser error message can include the offending SQL token, which could contain a literal secret if aSqltransform's query embeds one (e.g. in aWHEREclause). The JSON output for that same failure would be sanitized, but the stderr/exception text would not be — an inconsistency the author clearly intended to close (they wrote the sanitize call for exactly this branch) but didn't finish wiring through. - Best improvement: Reuse
sanitizedMessage(notmessage) when constructing the thrownConfigCheckExceptionin the static branch, mirroring what theCONNECTbranch already does correctly (there,messageitself is reassigned to the sanitized value before both uses). This is a one-line fix. - Severity: Medium
Aside from Issue 1, error handling is otherwise sound: validateResult() (the non-CLI-facing API for programmatic consumers) independently re-sanitizes the message it extracts from a caught ConfigCheckException, so that consumer path is safe regardless of Issue 1. System.out.println is the correct choice here (not log.info) precisely because the documented contract is "the JSON document is written to standard output" for machine consumption — routing it through SLF4J would add timestamp/level prefixes and break that contract, so I'm not flagging this as a logging-convention violation.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the surrounding code; the new OutputFormatConverter, OutputFormat enum, and printJsonResultIfRequested/toValidationError methods are all commented appropriately for their role (validation/parsing logic). One minor readability nit: the guard in validateCommandOptions() —
if (outputFormat == OutputFormat.JSON
&& (!checkConfig && dryRun == null || dryRun == DryRun.SAMPLE)) {relies on && binding tighter than || to produce the intended truth table (I checked it against all reachable (checkConfig, dryRun) combinations and it is logically correct), but explicit parentheses — ((!checkConfig && dryRun == null) || dryRun == DryRun.SAMPLE) — would make the intent obvious without requiring the reader to re-derive operator precedence. Low severity, not a functional issue.
2.2 Test Coverage and Test Stability
Coverage is solid for the stated feature: ClientCommandArgsTest covers both the rejection case (--format json without a validation command) and the acceptance case; SeaTunnelConfValidateCommandTest covers JSON-success, JSON-failure, and "default text mode emits no JSON" — that last test is exactly the right kind of check for proving backward compatibility (testDefaultOutputDoesNotEmitJson). One gap: no test exercises the static-failure JSON path with a message that would actually need sanitization (e.g. a Sql transform syntax error), so Issue 1's inconsistency wasn't caught by the existing suite — a test asserting the JSON error message is sanitized for a static failure would also have caught this.
This PR does not modify any UT/E2E test in a way that introduces timing, concurrency, or environment dependence — the new tests are synchronous, deterministic (tapSystemOutNormalized around a direct method call, fixed input config files), with no sleeps or ordering dependencies. Stability rating: Stable.
2.3 Documentation Updates
Both docs/en/engines/zeta/user-command.md and docs/zh/engines/zeta/user-command.md were updated together, describing --format, its accepted values, default, and a runnable example — and the two are consistent with each other and with the code ([text, json], default text). No further doc update is required.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix / clean feature addition. The new output path is properly gated behind an explicit, validated flag, reuses an existing (pre-existing, from an earlier PR) ConfigValidationResult/ConfigValidationError model rather than inventing a parallel one, and does not disturb the existing text-mode contract.
3.2 Maintainability
Good — the classification heuristic in toValidationError() (matching parse/option/plugin/validation categories via keyword sniffing on the exception message) is a little fragile as string-matching goes, but it's isolated, documented via the enum's own Javadoc, and failure just falls back to a generic VALIDATION category rather than throwing.
3.3 Extensibility
The OutputFormat enum and ConfigValidationResult's SCHEMA_VERSION field make it straightforward to add more formats or evolve the JSON schema later without breaking existing consumers.
3.4 Historical-Version Compatibility
Fully compatible — confirmed concretely in 1.2 above (default value, message text, and exit-code behavior for every pre-existing invocation are unchanged).
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | Static-validation-failure exception message isn't sanitized even though the JSON payload for the same failure is | SeaTunnelConfValidateCommand.java (catch block, static branch) |
Medium |
| 2 | validateCommandOptions() boolean guard relies on implicit operator precedence |
ClientCommandArgs.java:284-286 |
Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed
- Issue 1: reuse the sanitized message when constructing the thrown
ConfigCheckExceptionin the static-validation-failure branch, so the exception text seen on stderr/console can't leak anything the JSON output is already careful to redact. One-line fix, and ideally paired with a test asserting sanitization on the static path (extending the existingtestJsonOutputForFailedValidationRetainsFailuretest, or a new one hitting the SQL-syntax-error path).
- Issue 1: reuse the sanitized message when constructing the thrown
-
Recommended fixes — non-blocking
- Issue 2: add explicit parentheses to the
validateCommandOptions()boolean guard for readability. No functional change needed.
- Issue 2: add explicit parentheses to the
Overall assessment: This is a well-scoped, backward-compatible feature addition with good bilingual documentation and solid test coverage for its happy paths. The one real issue (Issue 1) is narrow and easy to fix, but I'm treating it as a blocker because it directly concerns the exact thing the task description asked reviewers to check — whether validation failures could leak sensitive config content — and the PR itself demonstrates awareness of the need to sanitize (it just didn't finish wiring it through for one of the two failure branches). No alternative implementation is needed; this is the right approach.
Upstream-sync note: this PR's compare status against dev is ahead (ahead_by=2, behind_by=0) — it is not behind upstream, so there is no sync concern here, contrary to the other two PRs I reviewed in this batch.
CI note: at the time of this review, the fork's Build workflow for this PR's head (290c31f) was still queued (no jobs had started) for roughly 45+ minutes — I have no CI result yet to reconcile against this review. I'd recommend checking whether GitHub Actions is simply backlogged on the contributor's account rather than assuming a failure; I'll defer any CI-specific diagnosis until it actually runs.
|
Thanks for the review. I pushed commit
Verification:
|
|
Follow-up: commit |
DanielLeens
left a comment
There was a problem hiding this comment.
Re-reviewed the latest head (0fec6dd35) from scratch rather than reusing my prior write-up — thanks for the quick follow-up commit and the two verification notes, Yohanes. Replying to both here as part of this full re-review rather than as separate comments, since the fix and the re-review land together:
- Your
0fec6dd35commit does exactly what it says: the static-validation-failure branch now reusessanitizedMessage(not the rawmessage) when constructing the thrownConfigCheckException, matching what theCONNECTbranch already did. I traced this directly in the diff and it's correct — see 1.1 below. - The new regression test (
testJsonStaticFailureSanitizesThrownException) is a good, targeted addition: it drives a static-validation failure through a config whose (fake) plugin name is a JDBC URL with embedded credentials, and asserts the thrown exception's message contains neither the raw credential nor the raw URL, only the sanitizer's placeholder. That's the right way to close the gap I flagged. - On the pre-existing "full module test-compile blocked by missing
InMemory/multi-table test dependencies" note: that's consistent with what I see too — it's an existing, unrelated test-fixture gap in this module, not something introduced by this PR, and it didn't stop your new tests (ClientCommandArgsTest,SeaTunnelConfValidateCommandTest) from compiling/running standalone, which is what actually matters for this diff.
What Problem Does This PR Solve?
- User pain point:
seatunnel.sh --check(or--dry-run static/connect) only produced human-readable text, so automation (CI pipelines, pre-deploy checks, tooling) had nothing structured to parse. - Fix approach: Adds a
--format [text|json]CLI option. Withjson(only alongside--check/--dry-run static/--dry-run connect),SeaTunnelConfValidateCommandalso prints a versionedConfigValidationResultJSON document on both success and failure, without touching the existing text-mode/exit-code contract. - One-sentence summary: A clean, additive CLI feature that is now also careful to keep its two parallel output channels (JSON payload and thrown-exception text) consistently sanitized.
1. Code Change Review
1.1 Core Logic Analysis
Current state of the previously-flagged code (SeaTunnelConfValidateCommand.java, static-failure branch):
String sanitizedMessage = DryRunConnectFailureMessageSanitizer.sanitize(message);
printJsonResultIfRequested(
ConfigValidationResult.failure(
validationPhase(),
toValidationError(
sanitizedMessage == null ? "Validation failed" : sanitizedMessage)));
throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage, e);This is exactly the one-line fix I asked for last round (previously the throw used the raw message, not sanitizedMessage) — verified directly against the current diff, not just taken on the author's word. The CONNECT branch was already correct (it reassigns message itself before both uses), so both failure branches are now consistent.
Everything else is unchanged from my last review and still holds:
printJsonResultIfRequestedis gated onoutputFormat == OutputFormat.JSON(defaultTEXT), so every pre-existing invocation that never passes--formatis a guaranteed no-op — confirmed again by re-checking every call site.- Moving
Path configPath = FileUtils.getConfigPath(...)inside thetryremains safe in practice (the only throwing paths in the sharedFileUtils.getConfigPathare an unreachable default deploy-mode branch and a@NonNullnull-arg check, neither reachable from the CLI).
1.2 Compatibility Impact
Fully compatible, unchanged from my last assessment: default outputFormat = TEXT means no existing script sees new output unless it explicitly opts into the new flag; the text of ConfigCheckException for CONNECT-mode failures is byte-for-byte unchanged from dev; for static-mode failures, the message now differs only when the raw message actually contained a JDBC URL or a sensitive key=value pair that the sanitizer would have masked — which is precisely the security fix, not a regression, since nothing behavioral should have been depending on secrets leaking into an exception message. No config option, protocol, or serialization format elsewhere is touched.
1.3 Performance / Side-Effect Analysis
Unchanged — negligible: one JSON serialization and one regex-based sanitize pass per validation run, only when requested/on-failure respectively.
1.4 Error Handling and Logging
The gap from my last review is closed: both failure branches (CONNECT and static) now sanitize the message used for the thrown ConfigCheckException, consistent with what's already sanitized for the JSON payload. System.out.println remains the right choice for the JSON payload itself (documented contract: stdout for machine consumption), not a logging-convention violation.
No new issues found in this pass.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the surrounding code. The one style nit from my last review — the implicit-precedence boolean guard in validateCommandOptions() (ClientCommandArgs.java:284-286, outputFormat == OutputFormat.JSON && (!checkConfig && dryRun == null || dryRun == DryRun.SAMPLE)) — is unchanged; I flagged it as non-blocking last time and I'm reconfirming that here (still logically correct, just relies on the reader re-deriving &&/|| precedence).
2.2 Test Coverage and Test Stability
Coverage is now stronger than what I reviewed last round: SeaTunnelConfValidateCommandTest gained testJsonStaticFailureSanitizesThrownException, which is exactly the missing case I called out (a static-failure JSON path whose message would need sanitizing). Combined with the existing testJsonOutputForSuccessfulValidation, testJsonOutputForFailedValidationRetainsFailure, and testDefaultOutputDoesNotEmitJson, both the feature's happy paths and the security-sensitive failure path are now covered.
All tests remain synchronous and deterministic (tapSystemOutNormalized around a direct method call, fixed/generated config files, no sleeps, no ordering dependencies). Stability rating: Stable.
2.3 Documentation Updates
Unchanged from my last review and still correct: both docs/en and docs/zh user-command.md describe --format, its values, default, and a runnable example, consistent with the code.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. Both the original feature and the follow-up fix are minimal, targeted changes with no scope creep.
3.2 Maintainability
Good, unchanged assessment — the toValidationError() keyword-sniffing classification is a little fragile but isolated and documented, with a safe fallback category.
3.3 Extensibility
Unchanged — the OutputFormat enum and ConfigValidationResult's schema-version field make future formats/schema evolution straightforward.
3.4 Historical-Version Compatibility
Fully compatible — reconfirmed: default value, success-path behavior, and CONNECT-branch message text are all unchanged for any pre-existing invocation; the static-branch message text changes only for the exact class of message this PR exists to protect.
4. Issue Summary
| # | Issue | Location | Severity |
|---|---|---|---|
| 1 | 0fec6dd35, verified with a new regression test |
SeaTunnelConfValidateCommand.java |
Resolved |
| 2 | validateCommandOptions() boolean guard relies on implicit operator precedence |
ClientCommandArgs.java:284-286 |
Low |
5. Merge Recommendation
Conclusion: Ready to merge
- Blockers — must be fixed: None. The one blocker from my last review (message sanitization consistency) is fixed and backed by a good regression test.
- Recommended fixes — non-blocking:
- Issue 2: add explicit parentheses to the
validateCommandOptions()boolean guard for readability. No functional change needed.
- Issue 2: add explicit parentheses to the
Overall assessment: This follow-up commit is exactly the kind of response you want to see — a precise one-line fix for the flagged security-relevant inconsistency, paired with a test that would have caught it and now guards against a regression. Combined with the solid existing coverage and bilingual docs, I'm comfortable approving this.
CI status (re-checked live against the fork's actual Actions run, not just the aggregate Build pointer): the fork's Build workflow run for 0fec6dd35 completed with conclusion failure, but every failing/cancelled job is unrelated to this PR's diff (which only touches seatunnel-core/seatunnel-starter validation-CLI code and docs):
transform-v2-it-part-1(both JDK 8 and 11) failed onTestFilterRowKindIT.testFilterRowKindMultiTable(expected: <0> but was: <1>) — this is a currently-tracked flaky test, filed as issue #12116 ("Multi-table row-count rules flaky on Flink:AssertSinkWriteruses static JVM-wide counters evaluated per-subtaskclose()"), and the fix for exactly this class of flake ([Fix][Connector-V2] Remove fixed sleep in AssertSinkWriter close and assert own table only, #11995) is already merged ondev. This PR's branch is currentlybehind_by=23commits relative todev(diverged), so it predates that fix.all-connectors-it-2 (8, ubuntu-latest)failed onCouchbaseIT.testFakeSourceToCouchbaseSink— a known, currently-tracked Couchbase container-bootstrap flake unrelated to any connector or core-starter code path this PR touches.kudu-connector-it (8, ubuntu-latest)was cancelled, consistent with a cascading/workflow-level effect rather than a Kudu-specific failure — this PR touches no Kudu code.
Recommendation: sync this branch onto current dev (which already carries the #11995 fix) and rerun CI — all three failures are outside this diff's blast radius and at least one has direct, verifiable upstream evidence of already being fixed. Every job actually exercising this PR's own code path (unit-test on all four JDK/OS combinations, Code style, License header, Dead links, Sanity check results) passed.
No alternative implementation is needed here; this is the right approach, now correctly and consistently sanitized on both output channels.
|
Thanks @CryoThrust for the follow-up in On PR12101-F1: from both of your descriptions, the static-validation failure branch now reuses The thread so far only covers F1, so could you confirm the status of the remaining points? A one-liner per item ("done in
If any of these are already handled, just point me at where and I'll take a look. I'd like at least F2, F3 and F4 addressed before merge since they affect the correctness of the machine-readable output; F5–F8 can land here or in a small follow-up, whichever you prefer. |
|
Follow-up on F2-F8 for the current head (885428e):\n\n- F2: done in 885428e. The JSON result is serialized through Jackson ObjectNode/ObjectMapper; the regression test covers quotes, newlines, tabs, and backslashes in an error message.\n- F3: done in the existing implementation. A null exception message falls back to Validation failed before the value is used for both the result and the thrown ConfigCheckException.\n- F4: the machine-readable result is emitted with System.out.println on the JSON path. Validation errors are represented by the JSON result; unrelated plugin/library output is outside this command's control. No additional text-mode logging is added by this change.\n- F5: unchanged behavior; FileUtils.getConfigPath() remains covered by the existing exception path and text-mode behavior.\n- F6: unchanged existing success path; successful JSON emission is not converted into a validation failure by the catch block.\n- F7: done in 885428e. Both English and Chinese user-command.md now document schemaVersion, valid, phase, errors, error fields, and sanitization.\n- F8: done in 885428e. The mixed &&/|| condition is explicitly parenthesized.\n\nVerification: ConfigValidationResultTest passes with the public-central Maven settings; Spotless was also run for the touched module. No new PR was opened. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update, @CryoThrust — I re-reviewed the latest head (commit 885428e53) from scratch, and thanks @SEZ9 for the detailed F2-F8 checklist, which pushed this into places my previous (approving) pass at 0fec6dd35 did not go deep enough on.
Sorry for missing this in the last review: I approved 0fec6dd35 without tracing whether the JSON-mode stdout contract can actually be violated by pre-existing logging on the validation call path, and without checking whether the success-path JSON emission is itself exception-safe. Both turn out to matter, and I'm flagging them below as carryover issues, not new-version-only ones.
I verified @SEZ9's F1-F8 checklist and @CryoThrust's 885428e53 reply against the current diff/source line by line rather than taking either summary at face value. Findings:
- F1 (static-failure exception sanitization): confirmed fixed in
0fec6dd35and unchanged/still correct here. - F2 (JSON escaping): confirmed correct.
ConfigValidationResult.toJson()(seatunnel-core/seatunnel-core-starter/.../validation/ConfigValidationResult.java:73-88) builds a real JacksonObjectNodeand calls.toString()on it — this was already true before this PR touched the file (the model itself wasn't modified in this diff), and the newescapesSpecialCharactersInErrorMessagestest inConfigValidationResultTest.javais a good regression guard for it. - F3 (null message): practically safe, not a crash —
DryRunConnectFailureMessageSanitizer.sanitize(null)returnsnull(guarded at the top of the method), and the null-to-"Validation failed"substitution is applied before building the JSON payload. One nuance worth being precise about: that substitution is not applied to the thrownConfigCheckException's message on either branch —throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage, e)string-concatenates a nullsanitizedMessageas the literal text"null", not"Validation failed". That's harmless (no NPE) and is pre-existing/unchanged behavior from before this PR (the original code had the same+ messagepattern with the same null-to-"null"concatenation), so I'm not blocking on it, but the reply's phrasing ("falls back to Validation failed... for both the result and the thrown ConfigCheckException") overstates what the code does for the exception path. - F4 (stdout purity) and F6 (success JSON inside
try): not actually resolved — see Issues 1 and 2 below. I traced both concretely against the current head rather than accepting the stated answers. - F5: confirmed unchanged/safe, matches my previous review.
- F7 (docs): confirmed — both
docs/enanddocs/zhuser-command.mdnow documentschemaVersion/valid/phase/errorsand the sanitized-messagecontract, consistently. - F8 (style): confirmed — the
validateCommandOptions()guard inClientCommandArgs.java:284-286is now explicitly parenthesized ((!checkConfig && dryRun == null) || dryRun == DryRun.SAMPLE), closing the low-severity nit from my last review.
What Problem Does This PR Solve?
- User pain point:
seatunnel.sh --check(or--dry-run static/--dry-run connect) only ever produced free-form human-readable text. Automation (CI pipelines, pre-deploy gates, IDE tooling) had nothing structured to parse and had to scrape text. - Fix approach: Adds an opt-in
--format [text|json]CLI option, valid only alongside--check/--dry-run static/--dry-run connect(rejected for plain job execution and for--dry-run sample). Whenjsonis requested,SeaTunnelConfValidateCommandadditionally prints a versionedConfigValidationResultdocument to stdout on both success and failure, sanitizing failure messages before they're serialized or thrown. - One-sentence summary: A clean, additive CLI feature for machine-readable config validation that is careful — though, per Issues 1-2 below, not yet fully — about keeping its JSON output channel clean and its failure-message sanitization consistent across both output channels.
One concrete example
sh bin/seatunnel.sh --config app.conf --check --format json
On success: {"schemaVersion":"1.0","valid":true,"phase":"static","errors":[]} on stdout, exit code 0.
On failure (e.g. a missing required option): {"schemaVersion":"1.0","valid":false,"phase":"static","errors":[{...,"message":"..."}]} on stdout, followed by a non-zero exit via the existing ConfigCheckException path.
Real SeaTunnel runtime flow that reaches the changed code
bin/seatunnel.sh --check|--dry-run static|--dry-run connect [--format json]
-> SeaTunnelClient.main()
-> CommandLineUtils.parse(...) -> ClientCommandArgs (parses --format via OutputFormatConverter)
-> ClientCommandArgs.validateCommandOptions() (rejects --format json without --check/--dry-run static|connect, or with --dry-run sample)
-> ClientCommandArgs.buildCommand() -> checkConfig || dryRun != null -> SeaTunnelConfValidateCommand
-> SeaTunnelConfValidateCommand.execute()
-> FileUtils.getConfigPath / ConfigBuilder.of (inside try, moved from before it)
-> env / source / transform / sink option-rule + unknown-key validation
-> ConfigParserUtil.checkGraph(...) <-- can log.info() on stdout (Issue 1)
-> validatePluginConfigs(...) [+ SQL syntax check for Sql transform]
-> DryRunConnectValidator.validate() (CONNECT only)
-> printJsonResultIfRequested(ConfigValidationResult.success(...)) <-- still inside try (Issue 2)
-> catch (Exception e): sanitize -> printJsonResultIfRequested(failure) -> throw ConfigCheckException
Plain job submission (no --check/--dry-run) never enters SeaTunnelConfValidateCommand at all — buildCommand() routes it straight to ClientExecuteCommand (ClientCommandArgs.java:199-211), so the real production job-execution path is untouched by this PR.
1. Code Change Review
1.1 Core Logic Analysis
Files with the core change: OutputFormat.java (new enum), ClientCommandArgs.java (new --format option, converter, validateCommandOptions() guard), SeaTunnelConfValidateCommand.java (printJsonResultIfRequested, JSON emission on success and both failure branches).
Normal-path reachability: printJsonResultIfRequested is a no-op unless --format json is explicitly passed (default OutputFormat.TEXT); I re-verified every call site added in this diff and none of them alters the text-mode/no-flag path. --format json itself is rejected outside --check/--dry-run static/--dry-run connect by validateCommandOptions() (ClientCommandArgs.java:284-289), and normal job submission never reaches SeaTunnelConfValidateCommand at all (see flow above). So this is genuinely an additive, opt-in feature — the check requested in this review round.
Issue 1 (new, real): JSON-mode stdout is not guaranteed to contain only the JSON document. SeaTunnelConfValidateCommand.execute() calls ConfigParserUtil.checkGraph(...) (line 161) for both the static and connect phases, before either the success or failure JSON is printed. ConfigParserUtil.checkEdge() (seatunnel-engine/seatunnel-engine-core/.../parse/ConfigParserUtil.java:113-117) does log.info(String.format("Currently, incorrect configuration of %s and %s options don't affect job running...", ...)) whenever a source/sink pair's result_table_name/source_table_name don't line up exactly (a real, non-degenerate, "compatible with previous issues" legacy pattern, not just an error path). SeaTunnel's default client logging config, config/log4j2_client.properties, routes INFO to consoleStdoutAppender with target = SYSTEM_OUT (rootLogger.level = INFO), and this is the config bin/seatunnel.sh wires in via -Dlog4j2.configurationFile=${CONF_DIR}/log4j2_client.properties (seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh:83-84) — i.e., this is the real, documented CLI entry point this PR's own docs use as the example command. So a plain-text log line can land on stdout ahead of/around the JSON document for a real class of configs, breaking the "stdout contains exactly one parseable JSON document" assumption the docs state ("The JSON document is written to standard output on both success and validation failure") without qualification. This directly answers SEZ9's F4 — the answer given ("No additional text-mode logging is added by this change") is true only in the narrow sense that this PR's own new code doesn't add a println; it doesn't address that the pre-existing call graph this feature is built on top of already writes to stdout via the logger.
- Potential risk: naive automation that does
json.loads(subprocess_stdout)will fail to parse on any config exercising this legacy compatibility branch; more defensive callers that scan for the JSON line will work, but that's not what "stdout is the JSON document" promises in the docs. - Best improvement: either (a) route the JSON payload through a channel
checkGraph's logger can't touch (harder, bigger change), or — the minimal fix — (b) document the actual contract precisely ("the last line of stdout is the JSON document; other diagnostic output may precede it") instead of implying stdout is exclusively the JSON document, and/or add a regression test that exercises a config hittingcheckEdge's mismatch branch with--format jsonto make the current behavior visible instead of implicit. - Severity: Medium — this is exactly the class of thing SEZ9 asked to have addressed before merge, and the current answer doesn't hold up against the call chain.
Issue 2 (new, real): success-path JSON emission remains inside the same try its own failure handling wraps. printJsonResultIfRequested(ConfigValidationResult.success(validationPhase())) at line 186 is still textually inside the try block that begins at line 105, exactly as before SEZ9's F6 question. ConfigValidationResult.toJson() (ConfigValidationResult.java:73-88) calls Jackson's ObjectNode.toString(), which internally wraps ObjectMapper.writeValueAsString() and rethrows any IOException as an unchecked IllegalArgumentException — for a plain tree of String/boolean values (no custom serializers, no I/O) this is not practically reachable today, so I'm not calling this an active bug. But it is still true, contrary to the reply's claim ("successful JSON emission is not converted into a validation failure by the catch block"), that if serialization ever threw, the surrounding catch (Exception e) would catch it and report the run as a validation failure — misclassifying a config that actually passed validation as invalid, purely because of a downstream serialization concern unrelated to the config's correctness.
- Potential risk: low today (requires a future change to
ConfigValidationResult/toJson()that introduces a genuinely throwable path), but it's a footgun for whoever touches that model next, and it's specifically the kind of never-let-success-look-like-failure guarantee that a "trustworthy machine-readable result" feature should hold structurally, not just currently by accident. - Best improvement: move
printJsonResultIfRequested(ConfigValidationResult.success(...))to after thetry/catch(i.e., set a localboolean succeeded/build the result inside the try, and only callprintJsonResultIfRequestedonce execution has left thetry/catchentirely), so the catch block can never observe a success-path exception. - Severity: Low — not exploitable with the current implementation of
ConfigValidationResult, but a real structural gap the reply didn't actually close.
Compatibility-relevant observation (unchanged from earlier rounds, reconfirmed): Path configPath = FileUtils.getConfigPath(clientCommandArgs) remains moved inside the try (line 106). FileUtils.getConfigPath (seatunnel-core/seatunnel-core-starter/.../utils/FileUtils.java:45-56) only throws for an unreachable default deploy-mode branch or a @NonNull null-arg check — neither reachable from the CLI — so this remains safe in practice.
1.2 Compatibility Impact
Fully compatible. Reconfirmed concretely against the current head:
- Default
outputFormat = OutputFormat.TEXT(ClientCommandArgs.java:57) meansprintJsonResultIfRequestednever fires unless--format jsonis explicitly passed — a flag that didn't exist before this PR, so no existing script can already be passing it. - Normal job submission never routes to
SeaTunnelConfValidateCommand(ClientCommandArgs.java:199-211) — the production job-execution path this PR was scoped to check is untouched. ConfigCheckException's message text for the CONNECT branch is byte-for-byte unchanged fromdevHEAD; for the static branch the message differs only when the raw message actually contained a JDBC URL or a sensitive key=value pair the sanitizer masks — that's the intended security fix from the earlier round, not a regression.- No config default, protocol, or serialization format elsewhere is touched.
1.3 Performance / Side-Effect Analysis
Negligible: one Jackson ObjectNode build + toString() and (on failure) one regex-based sanitize pass per validation run, only when --format json is requested. No new retries, locks, threads, or persistent I/O. No change to CPU/memory/GC profile of the normal job-execution path (it isn't touched at all).
1.4 Error Handling and Logging
The sanitization inconsistency from the first round (Issue 1 in my 290c31f review) remains fixed and verified by testJsonStaticFailureSanitizesThrownException. New in this round: Issues 1 and 2 above — the JSON output's "stdout purity" and "success can't be miscast as failure" guarantees aren't yet structurally enforced, only true by the current shape of the code/logging. Neither leaks credentials (the sanitizer is applied to both channels correctly), so this is a machine-readability/robustness gap, not a new security regression.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the surrounding code. The previous style nit (implicit &&/|| precedence in validateCommandOptions()) is now fixed with explicit parentheses (F8) — no remaining nit here.
2.2 Test Coverage and Test Stability
Coverage is strong for the stated feature and has grown across rounds: ClientCommandArgsTest covers rejection/acceptance of --format json; SeaTunnelConfValidateCommandTest covers JSON success, JSON failure, static-failure exception sanitization (testJsonStaticFailureSanitizesThrownException, with a JDBC-URL-with-credentials fixture), and "default text mode emits no JSON" (testDefaultOutputDoesNotEmitJson); ConfigValidationResultTest now covers JSON-escaping of quotes/newlines/tabs (escapesSpecialCharactersInErrorMessages).
Gap: no test exercises the Issue 1 scenario (a config that trips ConfigParserUtil.checkEdge's mismatch branch) under --format json to demonstrate/guard against stdout interleaving, and no test exercises Issue 2 (a toJson() failure being swallowed into a false-negative validation result) — understandably hard to trigger today given toJson() can't currently throw, but a comment or a defensive test would make the invariant explicit instead of implicit.
All tests remain synchronous and deterministic — tapSystemOutNormalized around a direct method call, fixed/generated config files, no sleeps, no ordering dependencies, no shared mutable state between tests. Stability rating: Stable.
2.3 Documentation Updates
docs/en/engines/zeta/user-command.md and docs/zh/engines/zeta/user-command.md are both updated and consistent with each other and with the code (--format [text|json], default text, the schemaVersion/valid/phase/errors contract, sanitization). One accuracy nit tied to Issue 1: the docs say "The JSON document is written to standard output on both success and validation failure" without qualifying that other diagnostic log lines can also land on stdout ahead of it — see the recommended doc wording in Issue 1's "Best improvement."
3. Architectural Soundness
3.1 Elegance of the Solution
Precise, additive feature. Reuses the existing ConfigValidationResult/ConfigValidationError model (from an earlier PR) instead of inventing a parallel one, and the new option is properly gated and validated.
3.2 Maintainability
Good overall. The toValidationError() keyword-sniffing classification is a little fragile as string matching goes, but it's isolated, documented, and falls back to a generic category rather than throwing. Issues 1 and 2 above are maintainability-relevant: both are "true by accident of the current call graph/model," not structurally guaranteed, so they're exactly the kind of thing a future refactor could silently break.
3.3 Extensibility
The OutputFormat enum and ConfigValidationResult's SCHEMA_VERSION field make future formats/schema evolution straightforward without breaking existing consumers.
3.4 Historical-Version Compatibility
Fully compatible — default value, success-path behavior for existing (non---format) invocations, and message text for all pre-existing invocation shapes are unchanged, as verified in 1.2.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | JSON-mode stdout is not guaranteed to contain only the JSON document — pre-existing log.info in ConfigParserUtil.checkEdge can interleave for configs with mismatched result_table_name/source_table_name, since the default log4j2_client.properties routes INFO to stdout |
seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/ConfigParserUtil.java:113-117; reached from SeaTunnelConfValidateCommand.java:161 |
Medium | Yes (@SEZ9, F4) |
| 2 | Success-path printJsonResultIfRequested(ConfigValidationResult.success(...)) is still inside the same try its own failure handling wraps; a future toJson() failure would be miscast as a validation failure instead of propagating as an internal error |
seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/SeaTunnelConfValidateCommand.java:186 |
Low | Yes (@SEZ9, F6) |
| 3 | 0fec6dd35, verified by testJsonStaticFailureSanitizesThrownException |
SeaTunnelConfValidateCommand.java |
Resolved | Yes (@DanielLeens, prior round) |
| 4 | validateCommandOptions() boolean guard relied on implicit operator precedence885428e53 |
ClientCommandArgs.java:284-286 |
Resolved | Yes (@DanielLeens, F8/prior round) |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
-
Blockers — must be fixed
- Issue 1: either close the stdout-interleaving gap for the
checkEdgelegacy-compatibility log line under--format json, or make the docs precisely state that other diagnostic output may precede the JSON line on stdout (the CLI's own docs currently promise otherwise). Given this is a core part of what makes the output "machine-readable," and SEZ9 specifically asked for it before merge, I'm keeping this as a blocker rather than a follow-up.
- Issue 1: either close the stdout-interleaving gap for the
-
Recommended fixes — non-blocking
- Issue 2: move the success-path JSON emission outside the
try/catchso a hypothetical future serialization failure can never be reported as a validation failure. Low current risk, but worth closing structurally rather than relying ontoJson()staying simple forever. - Consider a short doc caveat or added test coverage for the two gaps above so the current behavior is explicit rather than implicit.
- Issue 2: move the success-path JSON emission outside the
Overall assessment: This remains a well-scoped, backward-compatible feature addition with solid bilingual documentation and a test suite that has grown appropriately across rounds — every prior blocker (message-sanitization consistency, style nit) is genuinely fixed and regression-tested. The two new findings in this round are both about the robustness of the JSON output channel itself rather than about the config-validation logic or compatibility with existing callers: neither leaks anything sensitive, and neither affects text-mode or normal job execution at all. Issue 1 is real and reachable through a legitimate, non-exotic config shape via the exact CLI invocation this PR's docs demonstrate, so I'd like it addressed (or precisely documented) before merge; Issue 2 is a structural hardening recommendation I wouldn't block on by itself.
CI status: the fork's Build workflow run for the current head (885428e53) is still queued (no jobs started) at the time of this review — I have no CI result yet to reconcile against this pass; the prior head's (0fec6dd35) CI failures were already traced to unrelated, tracked flakes (TestFilterRowKindIT, Couchbase bootstrap) outside this diff's blast radius per my previous review, and this PR's own unit-test/style/license/dead-link checks passed at that commit.
|
Follow-up on the second review, pushed as a874fde:\n\n- Success-result serialization is now outside the validation try/catch. The validation block first builds a ConfigValidationResult, and the output adapter runs only after successful validation; a future serialization failure therefore cannot be reported as a validation failure.\n- The English and Chinese docs now describe the actual stdout contract: the validation result is emitted on stdout, while existing diagnostics may also appear there, so consumers should select the result line. No unrelated logging code was changed.\n\nSpotless apply and git diff --check pass. The remaining Build check is still the GitHub run whose logs/API are unavailable (404); no local production failure has been observed. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the quick follow-up, @CryoThrust, and thanks again @SEZ9 for pushing this into the right level of detail with the F1-F8 checklist. I re-reviewed the current head (a874fdef2) from scratch — full diff against dev, not just the delta — rather than trusting either the reply's summary or my own prior write-up, since a "carryover issue" call deserves the same rigor as a first pass.
Reply-thread check, verified line-by-line against source, not against the reply text:
- Issue 1 (JSON-mode stdout purity): the reply chose the documented-contract fix (option (b) from my last review) rather than the code-level fix (option (a)). I re-checked both docs and re-confirmed the underlying fact they now describe is still true:
ConfigParserUtil.checkEdge()(seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/ConfigParserUtil.java:113-117, still@Deprecated/unchanged, reached fromSeaTunnelConfValidateCommand.execute():161) still doeslog.info(...)for the "compatible with previous issues"result_table_name/source_table_namemismatch branch, andconfig/log4j2_client.propertiesstill routes INFO throughconsoleStdoutAppender(target = SYSTEM_OUT,ThresholdFilter level=WARN onMatch=DENY onMismatch=ACCEPT, i.e. sub-WARN levels are accepted to stdout) — unchanged from my last review. Bothdocs/en/engines/zeta/user-command.md:74anddocs/zh/engines/zeta/user-command.md:90now say the result is "written to standard output" while "existing diagnostic messages from the validation path may also be written to standard output, so callers should select the result line" — that's an accurate statement of the actual contract, and it was exactly the minimal fix I suggested as acceptable. I'm marking Issue 1 resolved. - Issue 2 (success-path JSON emission inside the try/catch): this one did get a real code fix, and I traced it end to end rather than taking "moved outside the try/catch" at face value. In
SeaTunnelConfValidateCommand.java,successResultis now declared before thetry(line 105) and assigned as the last statement insidetry(line ~186,successResult = ConfigValidationResult.success(validationPhase()););printJsonResultIfRequested(successResult)now sits after thecatchblock closes (line ~215). I checked Java's definite-assignment rules apply cleanly here: every path that falls through past thecatchblock is the "try completed normally" path, wheresuccessResultwas just assigned; both branches of thecatch(CONNECT and static) unconditionallythrow, so there's no path where execution reaches the post-catchprintJsonResultIfRequestedcall withoutsuccessResulthaving been set. I also traced what happens iftoJson()/System.out.printlndid throw in that new position: it's no longer inside the localcatch (Exception e), so it propagates out ofexecute()and is caught bySeaTunnelClient's caller,SeaTunnel.run()(seatunnel-core/seatunnel-core-starter/.../SeaTunnel.java:38-45), which logs it viashowFatalError(notshowConfigError) and rethrows — i.e. a hypothetical serialization failure now correctly surfaces as an internal/fatal error, not as "your config is invalid." That's precisely the guarantee I asked for. Issue 2 resolved, confirmed structurally, not just by inspection of the diff. - No unrelated logging code was touched in this commit — confirmed via
git diffbetween885428e53anda874fdef2: onlydocs/en,docs/zh, andSeaTunnelConfValidateCommand.javachanged, all consistent with the two claims above.
What Problem Does This PR Solve?
- User pain point:
seatunnel.sh --check/--dry-run static/--dry-run connectonly ever produced free-form human-readable text, so automation (CI gates, pre-deploy checks, IDE tooling) had nothing structured to parse. - Fix approach: an opt-in
--format [text|json]CLI flag, valid only alongside--check/--dry-run static/--dry-run connect, that additionally prints a versionedConfigValidationResultJSON document to stdout on both success and failure, with failure messages sanitized before serialization or throwing. - One-sentence summary: a clean, additive, now fully self-consistent CLI feature for machine-readable config validation — both robustness gaps identified in the last round are closed (one by a real structural fix, one by making the documented contract match reality).
One concrete example
sh bin/seatunnel.sh --config app.conf --check --format json
Success: {"schemaVersion":"1.0","valid":true,"phase":"static","errors":[]} on stdout (now emitted strictly after validation succeeds and outside any catch that could reclassify a serialization problem as a validation failure), exit code 0. Failure: a sanitized JSON error document on stdout followed by a non-zero exit via ConfigCheckException.
Runtime flow that reaches the changed code
bin/seatunnel.sh --check|--dry-run static|--dry-run connect [--format json]
-> SeaTunnelClient.main() -> CommandLineUtils.parse(...) -> ClientCommandArgs
-> validateCommandOptions() (rejects --format json without --check/--dry-run static|connect, or with --dry-run sample)
-> buildCommand() -> SeaTunnelConfValidateCommand
-> execute():
try { ...graph/plugin/SQL/connect validation... successResult = ConfigValidationResult.success(...) }
catch (Exception e) { sanitize -> printJsonResultIfRequested(failure) -> throw ConfigCheckException }
printJsonResultIfRequested(successResult) <-- now outside try/catch (this round's fix)
Normal job submission never enters SeaTunnelConfValidateCommand — buildCommand() routes it straight to ClientExecuteCommand — so production job execution remains untouched by this PR, unchanged from prior rounds.
1. Code Change Review
1.1 Core Logic Analysis
Confirmed against current source: the try block's only fall-through path assigns successResult; both catch branches unconditionally throw; printJsonResultIfRequested(successResult) runs only on the success fall-through, now genuinely outside the exception-to-"validation failed" translation logic. This closes the structural gap from Issue 2 without touching the failure paths, the sanitization logic, or the CONNECT-vs-static branching — a minimal, precise diff.
Key findings:
- Both blocking/non-blocking items from the previous round are now closed (one via code, one via docs) with source-level verification, not just diff inspection.
- No new call sites, no new dependencies, no behavioral change to text-mode (default) output.
successResult's definite-assignment safety is sound under Java's flow analysis (verified by hand, and empirically by the greenunit-testCI jobs, since this wouldn't compile otherwise).- Doc wording is now accurate to the underlying
log.info/log4j2 behavior, which I independently re-verified rather than assuming was still true.
1.2 Compatibility Impact
Fully compatible, reconfirmed: default outputFormat = OutputFormat.TEXT means printJsonResultIfRequested never fires without the explicit new flag; normal job submission still bypasses this command entirely; no config default, protocol, or serialization format elsewhere is touched. The only behavioral difference from 885428e53 is the ordering of one System.out.println call relative to a try/catch that, in practice, it was never going to trip anyway — observable output for every existing test and every realistic config is byte-for-byte identical.
1.3 Performance / Side-Effect Analysis
No change from prior rounds: one Jackson ObjectNode build + toString(), and on failure one regex sanitize pass, only when --format json is requested. No new locks, threads, retries, or I/O.
1.4 Error Handling and Logging
No blocking issues found in this round. One minor, non-blocking clarity nit (new, Low): the updated doc sentence "callers should select the result line" doesn't say how to select it (e.g. "the last line" or "the line starting with {"). Not incorrect, just a little vaguer than it needs to be for someone writing a parser against it — worth a one-line tightening but not worth blocking on.
2. Code Quality Assessment
2.1 Coding Standards
Consistent with the surrounding code; the new local variable and the comment explaining why the success print is outside the try/catch are clear and appropriately placed.
2.2 Test Coverage and Test Stability
No new tests were added in this commit (only docs + the one production file changed), which is acceptable here: Issue 1's fix is documentation-only (nothing new to test), and Issue 2's fix is a structural/ordering change that the existing testJsonOutputForSuccessfulValidation and testDefaultOutputDoesNotEmitJson already exercise end-to-end (they invoke execute() and assert on the tapped stdout, so they'd have caught a regression in the success path). I did independently confirm on GitHub Actions that the relevant unit-test (8/11, ubuntu-latest/windows-latest) jobs for this head all passed. All test code remains synchronous, deterministic, uses tapSystemOutNormalized around direct method calls, no sleeps, no shared mutable state. Stability rating: Stable.
Minor non-blocking gap (carried over, not new): still no dedicated regression test that exercises the Issue-1 checkEdge stdout-interleaving scenario under --format json to make the documented "other diagnostics may precede the JSON line" behavior visible in the test suite rather than only in docs. Not blocking, since the docs now correctly describe it either way.
2.3 Documentation Updates
docs/en and docs/zh are both updated, consistent with each other and with the verified source behavior.
3. Architectural Soundness
3.1 Elegance of the Solution
Precise fix. Both remaining gaps are closed with the smallest change that actually closes them — a doc correction where a doc correction was sufficient, and a real structural reorder where structure was the actual problem.
3.2 Maintainability
Improved from last round: the success path can no longer be silently miscast as a validation failure by a future change to ConfigValidationResult/toJson(), which was exactly the "true by accident of the current call graph" risk flagged before.
3.3 Extensibility
Unchanged and fine — OutputFormat enum and ConfigValidationResult.SCHEMA_VERSION still make future formats/schema evolution straightforward.
3.4 Historical-Version Compatibility
Fully compatible — default behavior, message text, and all pre-existing invocation shapes remain unchanged, reconfirmed against current source.
4. Issue Summary
| # | Issue | Location | Severity | Raised by another reviewer |
|---|---|---|---|---|
| 1 | Doc wording "callers should select the result line" doesn't specify how (e.g. last line / line starting with {) |
docs/en/engines/zeta/user-command.md:74, docs/zh/engines/zeta/user-command.md:90 |
Low | No |
| 2 | docs/en, docs/zh user-command.md |
Resolved | Yes (@SEZ9, F4; @DanielLeens prior round) | |
| 3 | SeaTunnelConfValidateCommand.java |
Resolved | Yes (@SEZ9, F6; @DanielLeens prior round) | |
| 4 | 0fec6dd35, unchanged since |
SeaTunnelConfValidateCommand.java |
Resolved | Yes (@SEZ9 F1, @DanielLeens prior rounds) |
| 5 | validateCommandOptions() implicit operator precedence885428e53, unchanged since |
ClientCommandArgs.java:284-286 |
Resolved | Yes (@DanielLeens, F8/prior round) |
5. Merge Recommendation
Conclusion: Ready to merge
-
Blockers — must be fixed
- None.
-
Recommended fixes — non-blocking
- Tighten the doc wording ("callers should select the result line") to say precisely how to identify it, e.g. "the last line of stdout" or "the line beginning with
{". - Optional: add a regression test exercising
--format jsonagainst a config that tripsConfigParserUtil.checkEdge's mismatch branch, to make the documented interleaving behavior explicit in the test suite.
- Tighten the doc wording ("callers should select the result line") to say precisely how to identify it, e.g. "the last line of stdout" or "the line beginning with
CI status: the apache-side Build check is a pointer to the fork's Actions run (https://github.com/CryoThrust/seatunnel/actions/runs/34181897083), which shows two real failures, both unrelated to this diff:
all-connectors-it-2 (11, ubuntu-latest):CouchbaseIT.testFakeSourceToCouchbaseSinkfails on Couchbase testcontainer bootstrap — this is the known, tracked, rerun-proof Couchbase container-bootstrap break onubuntu-latest(fix tracked separately in #11845), not something this PR's diff can trigger (it never touches connector code).jdbc-connectors-it-part-6 (8, ubuntu-latest):JdbcHanaITfails withContainerLaunchExceptionbringing up the SAP HANA testcontainer — again a container-bootstrap/environment failure in an unrelated JDBC dialect's E2E suite, not something a CLI-validation-only change can cause.- All the jobs that actually matter for this diff —
unit-test (8/11, ubuntu-latest/windows-latest),Run / Code style,Run / License header,Run / Dead links— are green. mergeStateStatusisBLOCKED(review-required gate, since my last review state wasCHANGES_REQUESTED), not a merge conflict —mergeableisMERGEABLE, confirmed via the GitHub API.
Overall assessment: both items I flagged as carryover in the last round are now genuinely closed, and I verified that concretely against the current source rather than trusting the reply's phrasing — the try/catch restructuring is provably safe under Java's definite-assignment rules and I traced the exact downstream handling if it ever did throw, and the doc fix matches the actual (unchanged, re-verified) logging/log4j2 behavior. I don't see anything else worth blocking on in this fresh top-to-bottom pass. The only two CI failures on the current head are both pre-existing, tracked, environmental container-bootstrap flakes in connector E2E suites this PR never touches — safe to disregard for merge purposes, and a rerun of just those two jobs would very likely go green on retry.
|
Updated with an ordinary merge of current upstream dev and a JSON-validation confidentiality correction. Static JSON failures now discard the unsanitized exception cause, preventing the CLI's full stack-trace logging from exposing fixture credentials; text-mode diagnostic causes remain. The existing regression captures/parses emitted JSON and checks the complete thrown stack trace. No new dependency or authored POM delta. Scoped formatting and independent source review passed. The sync includes merged HANA readiness #12128. Current-head functional CI remains pending; the historical Couchbase KV SASL failure in #12127 is not claimed fixed by startup retries or readiness-timeout configuration. No failure was suppressed or blindly rerun. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for working on this, @CryoThrust, and thanks @davidzollo for the latest hardening commit. I went through the full diff and re-traced the validation command at the new head 55831abaef. The head now includes a merge of current dev plus commit 55831abaef ("Protect JSON validation failure diagnostics"). I re-verified the whole PR-owned diff, and my previous carryover items stay closed. This review is by code reading only; nothing was executed locally.
What Problem Does This PR Solve?
- User pain point:
seatunnel.sh --check/--dry-run static|connectonly reports success or failure as human-readable text, so CI pipelines and tools must scrape messages. - Fix approach: add
--format [text|json]that prints one credential-safe JSON record (schemaVersion,valid,phase,errors[]) to stdout for both success and failure; failure still exits non-zero. - One-sentence summary: machine-readable output for the config validation commands, with sanitized messages.
1. Code Change Review
1.1 Core Logic Analysis
Runtime path:
seatunnel.sh --check --format json
-> ClientCommandArgs (OutputFormatConverter, validateCommandOptions: json only with --check/static/connect)
-> SeaTunnelConfValidateCommand.execute()
try { getConfigPath, ConfigBuilder, env/source/transform/sink validation -> successResult }
catch (Exception e) { sanitize -> printJsonResultIfRequested(failure) -> throw ConfigCheckException }
-> success: printJsonResultIfRequested(successResult) OUTSIDE the try
What changed since my last review (a874fdef28): the static-failure catch block (SeaTunnelConfValidateCommand.java:204-217) now discards the unsanitized cause when --format json is used:
if (clientCommandArgs.getOutputFormat() == OutputFormat.JSON) {
throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage); // no cause
}
throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage, e);This is a real improvement: the CLI logs the full exception chain, so keeping e as the cause would have re-printed the credential-bearing original message in the stack trace even though the stdout JSON was sanitized. The regression testJsonStaticFailureSanitizesThrownException now asserts that the whole stack trace of the thrown exception and the captured stdout contain no secret, and that the JSON parses with valid=false.
Other findings (re-verified at this head):
- Success serialization is outside the validation
try, so an output failure cannot be misreported as a config error (my earlier carryover item, still closed). printJsonResultIfRequestedis the only writer of the machine-readable line, andvalidateResult()(programmatic use) callsexecute()with the default TEXT format, so it does not print JSON.- JSON is built via Jackson (
ConfigValidationResult.toJson()), and the newescapesSpecialCharactersInErrorMessagestest covers quotes, newline and tab. - Normal path vs edge path: the new option is opt-in (
--format json), so the default flow only reaches the shared catch block when validation fails.
1.2 Compatibility Impact
Partially incompatible (message text only, Low). New CLI flag with default text, no change to exit codes, config, or JSON schema of existing APIs. However the shared failure branch now applies DryRunConnectFailureMessageSanitizer.sanitize() to the thrown ConfigCheckException message in default text mode too (previously the raw message was thrown for static failures). The sanitizer masks credential-like key=value pairs, replaces jdbc: URLs, and truncates at 2048 characters (DryRunConnectFailureMessageSanitizer.java). Users who parse the old text, or who validate configs with very long multi-error messages, will see a shorter, masked message. I requested sanitization in an earlier round, so this is intentional, but it deserves an explicit sentence in the docs.
1.3 Performance / Side-Effect Analysis
Validation-time only; one JSON serialization of a small object. Cause-dropping in JSON mode loses the original stack trace for diagnosis, which is the intended trade-off.
1.4 Error Handling and Logging
- Issue 1 (Low, new): default text mode now receives sanitized and possibly truncated static-validation messages (see 1.2). Please mention this in
docs/en/engines/zeta/user-command.mdand the Chinese counterpart, or keep the raw message for text mode if exact old text is a compatibility goal. Not raised by other reviewers. - Issue 2 (Low, informational):
System.out.println(result.toJson())(SeaTunnelConfValidateCommand.java:254) is the right channel for a stdout protocol, and the docs now state that callers must select the result line because diagnostics may share stdout. No change required.
2. Code Quality Assessment
2.1 Coding Standards
Good: new OutputFormat enum carries an ASF header and Javadoc, OutputFormatConverter rejects empty/unknown values before any validation or submission starts, and the mixed &&/|| condition is parenthesized.
2.2 Test Coverage and Test Stability
Rating: Risk present (Low).
- Good:
testJsonFormatRequiresValidationCommandandtestJsonFormatIsAcceptedForCheck(ClientCommandArgsTest) cover option parsing;SeaTunnelConfValidateCommandTestcovers success JSON, failure JSON, sanitization of the thrown exception and the default-no-JSON case. - Risk (Low):
testJsonStaticFailureSanitizesThrownExceptionparses the entire captured stdout withJsonUtils.readTree(output). If any other component (a plugin, a dependency) prints a line to stdout during validation, the parse fails. The docs explicitly warn that this can happen in real runs; the test is therefore sensitive to the same noise. Consider extracting the last non-empty line before parsing. tapSystemOutNormalizedcomes fromsystem-lambda, which is already declared in the rootpom.xmldependencies, so no new dependency is introduced. The test does not use sleeps or fixed ports and creates its temp file withdeleteOnExit.
2.3 Documentation Updates
Both docs/en/engines/zeta/user-command.md and docs/zh/engines/zeta/user-command.md list the flag and the JSON contract. Only the text-mode message change from Issue 1 is missing.
3. Architectural Soundness
3.1 Elegance
Long-term solution in a small footprint (a stable JSON contract, reused serializer, opt-in).
3.2 Maintainability
Good separation: format selection in args, rendering in the command. The duplicated failure(...) construction in the connect and static branches could share a helper, which is a style nit only.
3.3 Extensibility
The enum leaves room for more formats and the schema carries schemaVersion.
3.4 Historical-Version Compatibility
No impact on job config, state or checkpoints; new flag is additive.
4. Issue Summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| 1 | Default text mode now gets sanitized/truncated static-failure messages; document it | SeaTunnelConfValidateCommand.java:204-217, user-command.md (en/zh) |
Low |
| 2 | Test parses whole stdout, fragile to unrelated stdout noise | SeaTunnelConfValidateCommandTest.java (testJsonStaticFailureSanitizesThrownException) |
Low |
5. Merge Recommendation
Conclusion: Ready to merge after fixes
Blockers (must fix): none on the code side. All items I flagged earlier (sanitization of the thrown exception, output outside the validation try, docs of the stdout contract) are verified fixed, and the new commit closes the remaining confidentiality gap in JSON mode.
Recommended fixes (non-blocking): Issue 1 (one documentation sentence) and Issue 2 (parse only the result line).
CI on the current head (55831abaef): CI has not executed on this head. The only workflow run attached to it is PR signal with conclusion action_required (waiting for a maintainer to approve workflow runs), and there are no check runs. The branch is 0 commits behind dev with no merge conflict. Please have the workflows approved and wait for unit-test (including the seatunnel-starter module) and Code style to pass on this exact head.
Overall assessment: a clean, opt-in feature with the sensitive-data handling done right. Once CI is green on this head, my view is that it is ready for a maintainer approval. There is no better alternative design I would suggest.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the update, @CryoThrust, and for the confidentiality repair summary. I re-reviewed all eight changed files at 55831abaef1e1aac58988977c1da8e73a27d9417 and traced the CLI argument, validation, JSON serialization, and top-level error-reporting paths. The JSON-mode exception-cause leak is closed for the reviewed failure path. I found no blocking source issue; current-head CI is still absent.
What problem this PR solves
- User pain: Configuration-check automation has only human diagnostics to inspect, and an otherwise sanitized JSON failure could still expose its original credential-bearing exception through CLI stack-trace logging.
- Fix approach: Add opt-in versioned JSON results, preserve failure exit behavior, and discard the raw cause for JSON-mode static validation failures.
- One-line summary: Expose a structured validation result while keeping the reviewed error-message and exception-chain output sanitized.
Example: seatunnel.sh --config app.conf --check --format json emits a result with schemaVersion, valid, phase, and errors. Invalid configuration still fails. Existing diagnostic output may precede/interleave on stdout; the documentation correctly does not promise stdout contains only JSON.
1. Code-change review
1.1 Core logic analysis
The full diff is +258/-3. ClientCommandArgs adds the text-default format enum/converter and rejects JSON outside check/static/connect validation. The important exception change in SeaTunnelConfValidateCommand.java:205-217 is:
String sanitizedMessage = DryRunConnectFailureMessageSanitizer.sanitize(message);
printJsonResultIfRequested(/* failure built from sanitizedMessage */);
if (clientCommandArgs.getOutputFormat() == OutputFormat.JSON) {
throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage);
}
throw new ConfigCheckException(validationMode + " failed: " + sanitizedMessage, e);Before, retaining e allowed top-level ExceptionUtils.getStackTrace logging to print the original message even after the displayed result was sanitized. JSON now omits that cause; text mode retains diagnostic causes. Success emission is after the validation catch block:
// Successful validation assigned successResult inside try.
printJsonResultIfRequested(successResult);CLI parse / programmatic buildCommand()
-> ClientCommandArgs.validateCommandOptions():286 onward
-> check/static/connect -> SeaTunnelConfValidateCommand.execute():104 onward
-> getConfigPath -> ConfigBuilder -> graph/plugin/option/SQL/connect checks
-> failure:
-> sanitize raw message before building structured error fields
-> Jackson-backed ConfigValidationResult.toJson() -> stdout
-> throw ConfigCheckException
-> JSON static and CONNECT paths retain no raw cause
-> success:
-> success result assigned during validation
-> serialize/print outside validation try/catch
-> SeaTunnel.run():38-47
-> showConfigError():52-60 -> logs message and full thrown stack trace
-> failure remains an exception/nonzero CLI result
Ordinary job submission -> ClientExecuteCommand, not this validation command
Key findings:
- The opt-in validation path reaches this behavior; normal job execution and source/sink dataflow are not rerouted.
- Structured location/plugin/option fields are derived from the sanitized message, not separately from the raw exception.
- Removing the cause closes the specific stack-trace escape route. It does not sanitize arbitrary output emitted independently by a third-party plugin.
- Jackson object nodes handle quotes/control characters; no hand-built JSON concatenation is used.
- Success serialization outside the catch prevents a serializer failure from being relabeled as invalid user configuration. This is a focused adapter change.
1.2 Compatibility impact
Compatible for existing successful commands and runtime job behavior. Text remains the default; JSON is additive, with schemaVersion 1.0 and unchanged shared result shape. There is no connector option, protocol, checkpoint, or state serialization change.
Two intentional diagnostic details deserve precision: static failure's outer text message now uses the shared sanitizer while retaining the original cause in text mode; moving path resolution inside the validation catch classifies a path-resolution exception as a configuration failure rather than an uncaught fatal error. Therefore I would not claim every exceptional text-mode message/type is byte-for-byte unchanged. These are diagnostic changes, not a data/state migration requirement.
1.3 Performance and side effects
JSON mode adds one small object-tree serialization per validation result. Failure uses the existing bounded message sanitizer/regexes. There is no per-record work, new network operation, thread, lock, buffer, retry, replay, or resource lifetime. Existing validation/plugin loading can perform its existing I/O; the flag does not turn validation into a sandbox.
1.4 Error handling, logging, and formal issues
The CONNECT path already drops raw causes; the static JSON path now does the same. Null messages receive a non-null fallback before structured error parsing. The thrown diagnostic can still say failed: null for a null source message, but JSON remains valid and correctly indicates failure. No swallowed success or new raw-cause leak was found in the reviewed path.
No blocking issue found. I agree with @SEZ9's F1-F8 concerns after independently checking their dispositions: sanitizer/cause handling, real JSON escaping, null-safe structured errors, accurately documented stdout limitations, explicit path-error classification, success serialization placement, paired contract docs, and grouped argument conditions are all accounted for. The earlier claim that unrelated failed CI could simply be disregarded is not carried forward as a merge pass.
Issue 1 — Clarify how consumers identify the result record (Low, non-blocking carryover).
- Location:
docs/en/engines/zeta/user-command.md:85and corresponding Chinese paragraph. - Description/risk: “Select the result line” leaves consumers guessing how to distinguish it from diagnostics. Assuming the final line or any line beginning with a brace is stronger than the current contract guarantees.
- Best improvement: Recommend parsing candidate single-line JSON objects and recognizing the documented schemaVersion/valid/phase/errors shape. Optionally make the existing checkEdge diagnostic-interleaving case visible in a regression test.
- Already raised by another reviewer: Related to @SEZ9's F4 stdout concern and Daniel's prior non-blocking documentation note; no new blocker is introduced.
2. Code quality assessment
2.1 Coding conventions
The enum/converter and output helper document their adapter purpose; the cause-dropping comment explains the confidentiality invariant. The new enum file has an ASF header. Static git diff --check upstream/dev...HEAD is clean. No local compilation, formatter, tests, service, or actual CLI job was executed.
2.2 Test coverage and stability
ConfigValidationResultTest.java:69-82 round-trips special characters through the actual serializer. ClientCommandArgsTest.java:86-107 checks the opt-in restriction and accepted check mode. SeaTunnelConfValidateCommandTest.java:69-151 checks success/failure JSON, default text behavior, and a temporary credential-bearing fixture whose emitted JSON and complete thrown stack trace must not contain the dummy secret.
The static confidentiality assertion now exercises the error chain rather than checking only the outer message. Existing result-classification tests remain in place.
Stability rating: Stable under the suite's existing sequential execution. Added tests are synchronous, use unique temporary files and fixed inputs, and restore captured stdout through SystemLambda. No sleeps, port binding, clock-dependent assertions, external service, or ordering dependency is added. Capturing process-wide stdout should remain isolated if parallel test execution is enabled in the future. The confidentiality fixture expects a quiet captured stdout record; the broader documented diagnostic-interleaving scenario remains the optional coverage note in Issue 1.
The fresh exact-head fork query returns no workflow runs, and the Apache rollup currently contains no checks. This is missing execution evidence, not a successful CI result and not proof that Actions are disabled. Please trigger the existing fork Build on this branch, enabling workflows first only if GitHub presents that requirement. The latest base already includes the cited HANA readiness change; it does not establish that the distinct historical Couchbase KV SASL failure was fixed. Those old failures must not be attributed to this new head or suppressed without new results.
2.3 Documentation
Both language pages document the option, allowed validation modes, stdout caveat, nonzero validation-failure status, result fields, and unavailable-field nulls. They match the implemented contract. Issue 1 is a small usability improvement.
3. Architectural assessment
3.1 Solution quality
A focused CLI adapter over the existing shared validation result; no duplicate schema or JSON library is introduced.
3.2 Maintainability
Validation outcome and success serialization are separated. Preserve the deliberate JSON-versus-text cause policy so future diagnostics do not reopen this leak.
3.3 Extensibility
The existing versioned result can serve other adapters. This change does not claim runtime-equivalent validation or a zero-output environment.
3.4 Historical compatibility
Existing job execution, config/state formats, and successful text commands are retained. Exceptional diagnostic changes are described above; no data migration is required.
4. Issue summary
| Number | Issue | Location | Severity |
|---|---|---|---|
| Issue 1 | Result-line selection guidance remains underspecified | user-command.md JSON paragraph, both languages | Low, non-blocking |
5. Merge conclusion
Conclusion: Can merge after the remaining CI and approval gates pass
- Blocking items: No source change remains required from Daniel's review. Obtain current-head Build/test results; absent checks cannot count as passed. Effective maintainer approval remains separate.
- Suggested fixes, non-blocking: Issue 1 improves consumer guidance and optional diagnostic-interleaving coverage.
I have incorporated @SEZ9's discussion checklist; there is no independent non-Daniel formal approval/change-request review in the fetched review list. The branch is ahead by 6 and behind by 0 (ahead), with no conflict. Another base sync is not a meaningful prescription for missing current-head CI here.
Overall the confidentiality repair is sound and the feature remains small. No larger alternative is needed for this adapter. Daniel's READ permission means this COMMENT records technical clearance; any historical requested-changes display requires a write-capable maintainer's final approval/dismissal as applicable. Thank you for checking the complete exception output in the regression.
|
Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review. Gate snapshot (2026-10-28T16:02:19+00:00), head The exact blocking stage is Build workflow-run detection: the check says no fork Build was found for this SHA. This is not an executed test failure and does not by itself prove that fork Actions is disabled. Open the fork Actions tab, enable workflows if needed, then manually run the existing Build workflow for this PR branch. If a matching run already exists, link it for a maintainer to reconcile the aggregate. No empty commit or speculative dependency change is requested. Upstream check: current dev retains the fork-run adoption workflow and its scheduled/manual status-refresh path. A base sync alone cannot enable fork Actions or supply a missing exact-head workflow run, so I am not prescribing sync as the fix for this activation gate. My previous source conclusion remains clear for the reviewed scope. CI is not being passed by inference, and this follow-up is not an effective approval. Comparison recorded in this scan: base My source blocker is cleared, but an older CHANGES_REQUESTED opinion may remain in the review summary after a COMMENT-only technical conclusion. With Daniel currently READ-only, a write-capable maintainer must separately reconcile the effective approval/dismissal gate; this clarification does not claim that action was performed. |
|
Thanks for the follow-up work on this. At head The remaining blocker is CI: Build is Next steps:
No empty commit or dependency change is needed. Once a fork Build run exists for this exact head and CI is green, a write-capable maintainer can reconcile the review summary and move this forward. |
|
Thanks @SEZ9. My source-level clearance is unchanged. The current aggregate still reports the exact-head fork Build discovery gate, rather than an executed source-test failure. Please use the fork Actions tab to enable workflows if disabled and start the existing Build for this branch, or provide an already-existing matching run for maintainer reconciliation. No empty commit, dependency edit or drift-only rebase is needed. Historical requested changes and the eventual effective approval/dismissal still belong to a write-capable maintainer. Checked 2026-10-29T17:14:09+00:00; head Comparison: base Daniel has READ repository permission. This is a discussion/CI clarification, not a new complete source review, an effective APPROVED event or dismissal of historical requested changes. A write-capable maintainer must perform any required final approval/dismissal. Thanks for keeping the follow-up focused. |
|
Thanks for the update on this PR. On CI: the automated check reports head Separately, the previous review findings on
Once the Build has run on the fork and the points above are addressed (or you explain why any of them should stay as-is), I'll do another pass. Note that final approval/dismissal of the earlier requested changes will be done by a write-capable maintainer. |
|
Thanks @SEZ9. I rechecked the current code behind your checklist. SeaTunnelConfValidateCommand.java:212-217 deliberately drops the raw cause in JSON mode while retaining legacy text diagnostics; :219-221 serializes success outside the validation catch. The shared sanitizer handles null before matching, and structured errors use a non-null fallback. ConfigValidationResult.toJson:73-87 uses Jackson nodes for escaping. Both user-command pages document schemaVersion/valid/phase/errors and explicitly allow diagnostic stdout alongside the result (English :85-87); pure-JSON stdout is not the current advertised contract. My prior full review also explicitly records the exceptional text-mode path-error classification change, rather than claiming byte-for-byte diagnostic compatibility. The remaining result-record selection clarification is Low/nonblocking. I therefore keep my source clearance and respectfully do not reopen those eight source requests from an older checklist. The exact-head Build discovery gate remains actionable: start/link the existing fork Build, enabling workflows only if disabled. No sync-only cure, empty commit or unrelated dependency change is requested. Checked 2026-10-30T03:30:37.151877+00:00; head This is an unchanged-head discussion/CI clarification, not another full source review or an effective approval. Daniel has READ repository permission. |
|
Pushed Mapping the review findings to the current implementation:
JDK 11 verification: 65 starter/argument/launcher tests and three schema tests pass without skips. The actual Zeta container test also passes: one JSON document on stdout for success/failure, exit codes 0/1, and no text configuration-error banner on failure. Scoped formatting, dependency-reactor verification and final starter/E2E-module verification pass. Native Windows launcher execution was not tested locally. The earlier engine backpressure failure remains a separate CI gate; these local results do not establish that it is fixed. I will keep any recurrence visible in the new-head Build result. |
|
@CryoThrust thanks for the point-by-point mapping on Your description explains the intent, but I have not yet checked it against the changed code, so I am not marking any of the previous findings resolved yet. A few points need clarification in the meantime:
For F2, F5, F6 and F7, your description matches what was asked. They stay open until I have confirmed them against the code. |
|
Thanks for the clarification. Pushed
JDK 11 verification passes: 67 starter/argument/launcher cases, 3 JSON schema cases, and the updated Zeta/Bash integration test, all without skips. Formatting and both changed modules' skip-tests verification also pass. CI update: the current-head Build is still running and has a Google Pub/Sub JDK 11 failure: That future also includes |
|
Thanks @CryoThrust for the follow-up in Sounds right, but not yet confirmed against the diff
Remaining asks
|
|
Pushed
F1/F3 remain as implemented in The fork Build on |
DanielLeens
left a comment
There was a problem hiding this comment.
Sorry for missing a launcher/parsing mismatch in the previous review. It was present in the earlier version and remains in this test-only update. Thanks for the detailed F1–F8 mapping and the strict trailing-token check.
What problem does this PR solve?
User problem. A script running Zeta config validation has to interpret human-readable output to learn whether a config is valid.
Change. Add a JSON validation format with a structured model, a nonzero validation-failure status, and a launcher setting that routes regular diagnostics to stderr.
For example, a config-check integration can parse schemaVersion, valid, phase and errors without parsing a stack trace.
1. Code changes
1.1 Core logic
Before, SeaTunnelClient always ran the command through SeaTunnel.run, which printed text diagnostics on exceptions. After, SeaTunnelClient.java:47-58 executes JSON validation directly. SeaTunnelConfValidateCommand.java:112-119 builds exactly one result and prints its serialized model.
Bash launcher → JVM log target → CommandLineUtils → ClientCommandArgs.validateCommandOptions/buildCommand → SeaTunnelConfValidateCommand.executeForExitCode → FileUtils / ConfigBuilder → env rules → plugin classloading + DAG/option checks → optional DryRunConnectValidator source/transform/sink probes → ConfigValidationResult and Jackson → stdout/result exit code. Text retains its run wrapper and preserves the pre-validation path resolution exception. JSON catches path resolution exceptions as model failures. Neither path submits a job or reaches checkpoint state.
1.2 Compatibility
Compatible for the existing CLI options and stored data. Text remains the default. Text validation failures now omit the underlying cause and use a safe fallback message; this changes diagnostic detail intentionally. JSON introduces a versioned output schema. No config defaults, engine API, RPC or serialized state changes.
1.3 Performance and side effects
JSON adds a small response allocation and serialization at command completion. The existing static checks and optional connectivity probes keep their previous network/CPU scope. No new persistent queue, lock or retry is introduced.
1.4 Errors, logging, and findings
Issue 1 (Medium, blocking) — Keep the shell's JSON detection in sync with argument parsing. ClientCommandArgs.java:265-270 trims the supplied format, but seatunnel.sh:83-89 only recognizes the exact four-character value. With a quoted whitespace-padded format accepted by the Java converter, the launcher keeps the default stdout appender in log4j2_client.properties:40-46. A successful connect validation then calls DryRunConnectValidator.java:457-462, whose INFO summary precedes the JSON. A reader expecting a single document fails even though the command exits successfully. Give the launcher and converter the same normalization, or consistently reject the extra spelling, and cover the decision through the Bash entry point. This remains separate from @SEZ9's trailing-token test request.
The text-mode wrapper now drops the original validation exception cause and preserves sanitized failure text. Missing messages inside validation use the fallback; path-resolution failures follow the existing text-mode contract.
2. Code quality
2.1 Conventions
The result model keeps JSON rendering out of validation. I confirmed @CryoThrust's F8 clarification: the only mixed conditional is grouped at ClientCommandArgs.java:289-290, and the output write is shared by success and failure.
2.2 Test coverage and stability
Stability: Stable. SeaTunnelConnectorTest.java:134-208 checks exit code, one line and strict JSON parsing on process completion without fixed sleeps. The scoped static mocks in SeaTunnelConfValidateCommandTest.java:150-240 close automatically. The special-character JSON round trip is deterministic. F1/F3/F5 are covered by the text-mode cause, fallback and path-resolution assertions. F4's strict parser now rejects a second token. Add a noncanonical accepted invocation in connectivity mode to catch Issue 1; current inputs use exact json with --check.
2.3 Documentation
The English and Chinese Zeta guides describe the same schema and Bash scope. The existing examples use the canonical spelling. Preserve the promised one-document stdout for all accepted spellings, including the connectivity path.
3. Architecture
3.1 Change location
Validation and rendering have a useful common boundary. The launcher's stdout contract must agree with CLI parsing because Log4j chooses the appender before Java argument handling.
3.2 Maintainability
Keep the one JSON emission and the versioned model. Define the accepted format spelling consistently across both entry points.
3.3 Extensibility
The same output adapter can expose future validation phases without changing the underlying job path.
3.4 Upgrade impact
Existing job configs remain valid and no data migration is needed. Automation consuming the new format should rely on its explicit schemaVersion field.
4. Findings summary
| # | Finding | Location | Severity |
|---|---|---|---|
| 1 | Accepted format can leave the log appender on stdout | seatunnel.sh:83 |
Medium |
5. Merge recommendation
Merge after fixes
Blocking items: Issue 1 and current-head CI/review. The Build for 841c8d50c was queued at review time. The successful Build on 90fd7b7 applies to its older head. It supersedes the older SFTP/engine investigation for that head only.
Non-blocking suggestions: None beyond the launcher regression.
Thanks @SEZ9 for the earlier findings and @CryoThrust for the focused fixes. The strict stdout check is a good basis for the additional launcher case.
CI and repository state: no check reported in the Apache rollup; Build: queued. GitHub reports BLOCKED / REVIEW_REQUIRED.
Verification: Reviewed all changed files and the referenced call sites at 841c8d50c14348007d68d0d4c2764e0591790422 against merge base 37309e1a8c1b6d35573d73fb167c1aabbacb9452. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.
DanielLeens
left a comment
There was a problem hiding this comment.
The Build for the unchanged head has moved from queued to cancelled. It did not establish a successful result for this revision. The launcher stdout issue from my full review remains a source blocker; please include its fix and obtain a completed Build on that resulting head. There is no new source finding in this CI clarification.
|
Quick status update on where this stands. The Build run for the unchanged head (run 44220308134) went from queued to cancelled, so it did not produce a successful result for this revision. This clarification adds no new source finding. The stdout issue from the earlier review is still the blocker. In JSON mode, stdout is not guaranteed to contain only the JSON document, because the failure path still propagates Remaining asks:
Could you also add a short note on how you handled the failure path (where the exception and the log output end up in JSON mode)? That will make the re-check quicker. Thanks for sticking with this one! |
|
The cancelled Build is not a pass; I will keep the next run separate from the older green result. I rechecked the failure path against the current head. The production change is already in The prior launcher test exercised a missing file, which fails before the config validation block. I have now extended the same test with an existing file containing an invalid This follow-up changes only the existing integration test, with no additional production fix claimed. Scoped Spotless, E2E-module skip-tests |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for extending the real launcher test to an internal validation failure. I re-reviewed the complete current Apache SeaTunnel diff and command/logging entry points. The previously reported stdout blocker is resolved in the source; current-head CI remains separate.
What problem does this PR solve?
User pain: automation cannot reliably parse text-only config validation or distinguish validation failure without exception output. Fix: add --format json, one structured stdout value and explicit exit status. Example: an invalid job.mode returns valid=false and exit 1 while diagnostics go to stderr.
1. Code changes
1.1 Core logic
Complete runtime path:
Bash launcher scans --format json before JVM/Log4j initialization -> console target SYSTEM_ERR
ClientCommandArgs -> validation-only output mode -> SeaTunnelClient.main
-> SeaTunnelConfValidateCommand.executeForExitCode -> validateResult
-> validateConfig or captured failure -> sanitized ConfigValidationResult
-> one JSON serialization/println -> status 0/1, bypass text exception wrapper
text mode -> existing command path, sanitized validation exception without raw cause
programmatic validateResult -> model only, no printing
Key findings and correctness:
The current head handles both missing-path and internal validation failures. JSON mode does not propagate ConfigCheckException to the generic text logger, and serialization occurs once after the validation result is formed. The supplied launcher redirects diagnostics before logging starts; custom/native launchers retain the documented configuration responsibility. Default text output remains selected and its path-resolution exception behavior is intentionally preserved. The structured result uses Jackson tree construction rather than string concatenation.
Before:
# JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=n"
# Log4j2 Config
JAVA_OPTS="${JAVA_OPTS} -Dlog4j2.isThreadContextMapInheritable=true"
if [ -e "${CONF_DIR}/log4j2_client.properties" ]; then
JAVA_OPTS="${JAVA_OPTS} -Dhazelcast.logging.type=log4j2 -Dlog4j2.configurationFile=${CONF_DIR}/log4j2_client.properties"
After:
# JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5000,suspend=n"
# Log4j2 Config
# Keep validation diagnostics off the JSON protocol's stdout. Set the target before Log4j starts.
previous_arg=""
for arg in "${args[@]}"; do
if [[ ( "$previous_arg" == "--format" && "$arg" == [Jj][Ss][Oo][Nn] ) || "$arg" == --format=[Jj][Ss][Oo][Nn] ]]; then
JAVA_OPTS="${JAVA_OPTS} -Dseatunnel.console.target=SYSTEM_ERR"
fi
previous_arg="$arg"
done
JAVA_OPTS="${JAVA_OPTS} -Dlog4j2.isThreadContextMapInheritable=true"
if [ -e "${CONF_DIR}/log4j2_client.properties" ]; then
JAVA_OPTS="${JAVA_OPTS} -Dhazelcast.logging.type=log4j2 -Dlog4j2.configurationFile=${CONF_DIR}/log4j2_client.properties"
1.2 Compatibility
Fully compatible default text command selection and validation semantics; JSON is opt-in and schemaVersion identifies its result contract. Sanitized text failures now intentionally omit raw causes, as documented. No job API, configuration option default, row/checkpoint bytes or connector SPI changes.
1.3 Performance and side effects
JSON tree/serialization is command-result work, outside the data path. No new network request, worker, lock, retry or engine resource ownership; existing validation classloader cleanup remains.
1.4 Errors, logging, and findings
No new source-level blocker found. Exceptions must still reach the existing job failure path; this review does not substitute for current-head CI.
I respectfully disagree with @SEZ9's latest statement that JSON still propagates ConfigCheckException into text logging: current executeForExitCode calls validateResult, catches validation exceptions there, prints once and returns the status directly through SeaTunnelClient.main. The expanded actual-launcher invalid-value case now pins that exact path. The earlier concern was valid for the older implementation, but is resolved at this head.
2. Code quality
2.1 Conventions
Reviewed all changed files for license, imports, naming, core-method and state-field comments. No additional convention blocker found.
2.2 Test coverage and stability
Stability rating: Stable. Unit tests exercise success/failure status, no extra stdout, programmatic silence, escaping, sanitized raw/nested causes, NULL-message fallback and preserved text path-resolution exceptions. Existing starter E2E now invokes the actual Zeta/Bash launcher with success, missing-file and an existing invalid-value file, rejects trailing JSON tokens and checks both stdout/stderr for the dummy secret. This last case reaches the internal ConfigCheckException path, not just path lookup. Native Windows/custom logging remain outside that test. Scoped static mocks and stdout/exit capture are released.
2.3 Documentation
EN/ZH document fields, phase names, exit status, validation modes, sanitization and the Bash/native/custom logging coverage boundary consistently.
3. Architecture
3.1 Change location
The CLI adapter owns output format and exit status; the pure validation model remains reusable without printing. Log routing must happen before JVM logging initialization.
3.2 Maintainability
Keep the behavior, lifecycle ownership, and failure contract together. The CLI adapter owns output format and exit status; the pure validation model remains reusable without printing. Log routing must happen before JVM logging initialization.
3.3 Extensibility
Prefer the existing component boundary and tests over unrelated shared abstractions.
3.4 Upgrade impact
Fully compatible default text command selection and validation semantics; JSON is opt-in and schemaVersion identifies its result contract. Sanitized text failures now intentionally omit raw causes, as documented. No job API, configuration option default, row/checkpoint bytes or connector SPI changes.
4. Findings summary
| # | Finding | Location | Severity |
|---|---|---|---|
| - | No new source blocker found | - | - |
5. Merge recommendation
Can merge once the recorded CI and repository gates are satisfied
Blocking items: No source blocker. Current-head CI and write-capable maintainer review remain independent requirements.
Non-blocking suggestions: None beyond the validation limits above.
Overall: the reviewed source path is coherent; no runtime acceptance is claimed beyond the actual CI result. Daniel has READ permission, so this COMMENT cannot dismiss historical requested changes or satisfy a write-capable maintainer approval gate.
CI and repository state: no check reported in the Apache rollup; Build: in_progress. GitHub reports BLOCKED / REVIEW_REQUIRED.
Verification: Reviewed all changed files and the referenced call sites at 17762e94b893ff4cc5870a189f057d79dc76ca6e against merge base 37309e1a8c1b6d35573d73fb167c1aabbacb9452. git diff --check passed. I did not build, run tests, or execute SeaTunnel locally.
Review time: 2026-11-19T07:07:49.388924-05:00
Local evidence: git fetch obtained head 17762e94b893ff4cc5870a189f057d79dc76ca6e; git merge-base returned 37309e1a8c1b6d35573d73fb167c1aabbacb9452; git diff --stat reports 13 files changed, 511 insertions(+), 19 deletions(-). git show and source searches were used for the entry points above. No local build, unit test, E2E, Docker run or service startup was executed.
|
Thanks for extending the real launcher test to cover an internal validation failure. Here is where the earlier review points stand after the latest re-review. Resolved in the current source
Still to confirm
CI on the current head is separate from the points above. |
|
Thanks, @SEZ9. All three confirmation points are visible in this head:
I inspected the code and deterministic assertions; I did not run them locally. My existing source-clear conclusion remains unchanged, with the documented native/custom-launcher and CI limits. Checked unchanged head |
|
The CI fact cited in the previous review has changed at unchanged head |
|
Thanks for the updates. Here is where the earlier review points stand at head Looks addressed
These were confirmed by reading the code and test assertions, not by running the tests. The earlier source conclusion remains cleared, so there are no open code questions from the previous review. CI Build run Please re-run the failed lanes once the download is available again, and please don't add unrelated dependency or launcher changes to this PR to work around it. The Build and maintainer approval are the remaining items. |
|
Thanks, @SEZ9. I agree that the earlier CLI/source/security points are clear. The actual remaining CI failures are wrapper/bootstrap failures in Linux Unit/JDK11, JDBC part 2/JDK17 and Oracle/JDK17, plus the connector-7/JDK11 Maven distribution download failure before tests. These are not green test results. Current dev retains the same download coordinates, and I found no verified upstream fix that makes a blind sync sufficient. Please complete the affected checks when artifact access is restored; no unrelated CLI source change is requested. Checked unchanged head |
|
Thanks for the continued work on this. Previous review points The follow-up on this thread records the earlier CLI/source/security points as clear at head
One confirmation, please: the follow-up names only the CLI/source/security points as clear, and does not mention the docs point. Could you confirm whether the JSON output contract ( What is still open The Build run
Remaining asks
Once the lanes complete and the docs point is confirmed, what remains is the maintainer approval gate. |
|
Thanks @SEZ9. The documentation confirmation is already present on this exact head: docs/en/engines/zeta/user-command.md:85-89 documents JSON stdout, exit status, launcher/logging limits, and the schemaVersion/valid/phase/errors fields; the individual error fields are listed at line 89. The matching Chinese section is part of the reviewed change. There is no further source/docs patch requested from my side. Build remains failed, and the reported wrapper bootstrap failures are a separate gate. I compared mvnw and .mvn/wrapper/maven-wrapper.properties with current dev a76348f: both files are identical, so sync is not an established cure for those downloads. Retry the specific failed lanes once bootstrap availability is restored; do not add unrelated CLI or dependency changes. Effective maintainer approval remains separate. |
|
Confirmed on the unchanged head Both exact Maven-wrapper artifact URLs returned HTTP 200 to local availability probes, so I requested a rerun of only the failed jobs in Build 44452256373 on the same head. No wrapper, dependency, launcher or CLI changes, and no dev sync, were made for the retry. Update: attempt 2 has completed with a failure in JDBC connectors part 2 / JDK 17. The job received HTTP 429 from Maven Central for |
|
Thanks for the precise runner evidence. A successful local artifact probe does not clear the hosted job: the reported HTTP 429 and missing MavenWrapperMain occurred before test execution, so that lane remains unvalidated. Please keep the retry limited to that failed lane once runner artifact access recovers; no immediate repeated retries, unrelated dependency patch or base sync is justified by that signal. My previous source/documentation clearance remains unchanged. The current aggregate still reports FAILURE; I am not treating the retry as passed. Discussion-only follow-up on unchanged head |
|
@CryoThrust thanks for the precise follow-up on head JSON output contract docs: Your confirmation that Retry of Build 44452256373: The local HTTP 200 probes do not clear the hosted job. As you reported, job 138939854032 (JDBC connectors part 2 / JDK 17) got HTTP 429 for Remaining asks:
|
|
Thanks, @SEZ9. The CLI JSON output contract remains documented; no new source patch is requested on that point. The current failing hosted lane is still independent of local HTTP probes: zero test reports after MavenWrapperMain/bootstrap failure is not passing validation. The lowest-cost next step remains a completed rerun of that specific JDBC/JDK17 lane after runner artifact access recovers, with its new job URL if it fails again. The guarded wrapper mirror proposal #13466 is not in the captured dev baseline; merely syncing now is not a demonstrated fix. Please keep the JSON-output PR free of unrelated packaging changes. Discussion-only follow-up on unchanged head |
|
Thanks for the follow-up. Here is where things stand on the unchanged head
The one open item is the failing hosted JDBC/JDK17 lane. The reported HTTP 429 and missing MavenWrapperMain occurred before test execution, so that lane has zero test reports and remains unvalidated. The aggregate was still reported as FAILURE, and a successful local probe does not clear it. Next step: once runner artifact access recovers, please do one completed rerun of that specific lane, without immediate repeated retries, and share the new job URL if it fails again. Please also keep this PR free of unrelated packaging or dependency changes. |
|
The requested targeted retry has now completed successfully on unchanged Only the failed lane was rerun; previously successful jobs were carried forward. No wrapper, dependency, source, or assertion changes were made. The PR description now distinguishes this current-head result from the older builds. This clears the reported fork-CI failure, not the separate upstream maintainer approval/merge gate. |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for the precise retry evidence. I independently checked Build attempt 3: it is completed successfully on 17762e94b893ff4cc5870a189f057d79dc76ca6e, including the previously failed JDBC part 2 / JDK 17 job. +1 to @SEZ9 that the earlier source/documentation clearance remains intact. Previously only CI was blocking my source-cleared review; CI has recovered, so I am changing my review to approve. No wrapper/dependency/source workaround is needed for that recovered failure. This APPROVED record does not claim READ-level approval can satisfy a required write-capable reviewer or dismiss historical requests.
This is a discussion/gate follow-up on unchanged head 17762e94b893ff4cc5870a189f057d79dc76ca6e, not a new full source review. Base dev compare: diverged, ahead 11 / behind 111. Branch drift alone is not a request to sync. No local build/test/runtime execution was performed. Daniel has READ permission; any required write-capable maintainer approval or historical-review dismissal remains separate.
|
@CryoThrust thanks for the precise retry evidence.
Remaining asks:
|
Purpose of this pull request
This contribution to Apache SeaTunnel adds opt-in JSON output to the existing configuration-validation CLI:
--format jsonsupports--check,--dry-run staticand--dry-run connect. Success and failure each emit one versioned JSON document; the launcher exits with status 1 on failed validation without routing it through text-mode exception logging. The Bash launcher and supplied client logging configuration send diagnostics to stderr in this mode. Other launchers need-Dseatunnel.console.target=SYSTEM_ERR; custom logging configurations must preserve stream separation. Text mode retains the exception type, validation-mode prefix and original path-resolution exception behavior. Validation errors in both modes omit raw exception causes so launcher stack traces cannot undo message sanitization. Job execution and sample mode reject JSON validation output.The result contains
schemaVersion,valid,phaseand structurederrors. Jackson handles escaping and error messages are sanitized, withValidation failedas the fallback for a missing exception message.validateResult()produces no CLI output. Serialization is outside the validation catch. EN/ZH command guides document the schema, stream separation and custom logging requirement, and explicitly limit launcher integration-test coverage to Bash.The branch is synchronized with upstream
devat37309e1a8, including the existing SFTP fixture fix #13203. No SFTP patch, checkpoint assertion change or dependency change is authored here.Verification
SeaTunnelConnectorTest#testJsonValidationStdoutAndExitStatuspasses without skips. It runs the source Bash launcher and supplied logging configuration for successful validation, a missing config file, and an invalid configuration value. Each JSON case requires one stdout line and a complete JSON document withFAIL_ON_TRAILING_TOKENS, with exit codes 0/1. The invalid-value case reachesConfigCheckExceptioninternally but returns a sanitized JSON error with no text-mode banner on stderr or raw credential in either stream. The same invalid configuration in text mode retains its useful sanitized diagnostic and exit status 1.The fork Build on
90fd7b7ebcompleted successfully after retry: 88 successful jobs and 9 conditional skips. Both Pub/Sub JDK lanes and both engine-v2 JDK lanes pass. The earlier Pub/Sub JDK 11 cleanup wait did not recur; its cause remains unestablished. The later Build on841c8d50cwas cancelled, so it is not a successful matrix. Fork success is not a claim of upstream approval or merge.Current-head CI: Build 44452256373, attempt 3 completed successfully on unchanged
17762e94b893ff4cc5870a189f057d79dc76ca6e. The targeted JDBC part 2 / JDK 17 retry passed on November 27. This retry reran that failed lane, not every carried-forward successful job. Earlier HTTP 429 bootstrap failures remain historical failures; no wrapper, dependency, source or assertion change was made for the retry. Fork success is not upstream approval or merge.