SEZ9 opened a new pull request, #12537:
URL: https://github.com/apache/seatunnel/pull/12537
### Purpose of this pull request
Closes #12535. Part of #11616.
When a job fails, `seatunnel-cli` hands the failure to the model as a raw
stack trace truncated to a fixed character budget. The two fields that actually
identify a SeaTunnel failure — the error code and the innermost `Caused by` —
have no fixed position in a trace, so they are as likely to be cut off as kept.
The CLI has no error parsing at all today; it only redacts credentials and
truncates.
This adds `seatunnel_cli/diagnostics/errors.py` with `parse_error(text) ->
ParsedError`, returning the error code(s), the root-cause exception class and
message, a category, a hint, and a stable dedupe signature. Decisions worth
calling out, each pinned by a test:
- The `ErrorCode:[NS-NN], ErrorDescription:[...]` shape comes from
`SeaTunnelErrorCode#getErrorMessage`. Descriptions may themselves contain
bracketed paths or SQL (`ErrorDescription:[SeaTunnel write file
[/tmp/out/part-0] failed]`), so one level of nesting is tolerated.
- The innermost `Caused by` wins over the outer wrapper: a generic
`SeaTunnelRuntimeException` says less than the `java.sql.SQLException: Access
denied for user` it wrapped.
- Only the non-connector namespaces (`API`, `COMMON`, `SE`,
`TRANSFORM_COMMON`, `JSONPATH_ERROR_CODE`) are enumerated. Anything else is
treated as a connector namespace, so a new connector classifies correctly
without editing this module — a hardcoded connector list would rot on every new
connector.
- A concrete text match such as `auth` or `missing_dependency` outranks the
namespace category, because "Access denied for user" is more useful than "a
JDBC error happened".
- Unrecognised input returns `category="unknown"` with `hint=None`. A wrong
hint is worse than a missing one: it sends the model and the user down the
wrong path with false confidence.
Pure functions over a string — no I/O, no network, no model calls.
### Does this PR introduce _any_ user-facing change?
No. This PR adds the module and its tests only; nothing calls it yet. The
consumer that feeds the parsed fields into the repair prompt is deliberately
separate so that its effect on the repair rate can be attributed to it and
measured on its own — that measurement needs L2/L3 runtime failures, which a
static run cannot produce.
### How was this patch tested?
New unit tests in `seatunnel-cli/tests/test_diagnostics_errors.py` (10
cases) over realistic trace shapes: a JDBC wrapper chain ending in `Access
denied for user`, a `ClassNotFoundException` for a missing driver, an `API-02`
option-validation failure, a description containing brackets, unknown text,
blank and `None` input, signature collapsing across volatile detail, and
multi-code traces.
The full existing `seatunnel-cli` suite passes alongside them: 202 passed, 3
subtests.
No benchmark delta is reported here, and that is deliberate: this PR changes
no runtime behaviour, so a benchmark run could only reproduce the existing
numbers. The delta will be reported with the PR that wires the parsed fields
into the repair loop.
### Check list
* [x] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [x] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]