[FSE-1855] Read Flink statement warnings from status.warnings - #3419
[FSE-1855] Read Flink statement warnings from status.warnings#3419Ramin Gharib (raminqaf) wants to merge 1 commit into
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Flink statement UX and serialized outputs to consume structured statement warnings from status.warnings (severity/reason/message/timestamp), ensuring warnings don’t disappear as status.detail changes over a statement’s lifecycle and enabling reliable -o json/-o yaml consumption.
Changes:
- Introduces a
StatementWarningtype plus conversion/formatting utilities, including severity-based ordering. - Plumbs structured warnings into Flink statement create/describe/list outputs (human + serialized), and into shell/dry-run status messaging.
- Adds unit tests, snapshot tests, and integration goldens to cover sorting, rendering, and output stability.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/flink/types/statement_warning.go |
Adds structured warning model, conversion from SDK type, severity sorting, and terminal formatter. |
pkg/flink/types/statement_warning_test.go |
Unit tests for warning conversion/sorting and formatting rules. |
pkg/flink/types/processed_statement.go |
Carries warnings on processed statements and prints them (while reducing legacy status.detail duplication in shell/dry-run flows). |
pkg/flink/types/processed_statement_test.go |
Unit tests for status-detail vs structured-warnings printing rules. |
pkg/flink/internal/store/store.go |
Refreshes warnings while polling since warnings can appear after submission. |
pkg/flink/internal/controller/statement_controller_test.go |
Adds snapshot coverage for structured warnings in the shell execution path. |
pkg/flink/internal/controller/.snapshots/TestStatementControllerTestSuite-TestExecuteStatementWithStructuredWarnings |
Snapshot output for structured warnings ordering/rendering in shell flow. |
internal/flink/command_statement.go |
Adds shared printStatementWarnings helper and extends statement output struct with warnings for serialization. |
internal/flink/command_statement_describe.go |
Includes warnings in serialized output and prints a human-readable warnings block below the table. |
internal/flink/command_statement_create.go |
Includes warnings in serialized output and prints a human-readable warnings block below the table. |
internal/flink/command_statement_list.go |
Adds warnings to serialized list output (kept out of human table rows). |
test/test-server/flink_gateway_router.go |
Test server now returns structured warnings for a dedicated statement name. |
test/flink_test.go |
Adds integration test cases for describing a statement with warnings (human + YAML). |
test/fixtures/output/flink/statement/describe-warnings.golden |
Golden for human describe output including warnings block. |
test/fixtures/output/flink/statement/describe-warnings-yaml.golden |
Golden for YAML describe output including structured warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9b3f8e9 to
4a26984
Compare
Steven Gagniere (sgagniere)
left a comment
There was a problem hiding this comment.
Thanks!
I left a comment. Also, could we get some manual test results from the flink shell?
| if output.GetFormat(cmd) != output.Human { | ||
| return | ||
| } | ||
|
|
||
| if block := types.FormatStatementWarnings(warnings); block != "" { | ||
| output.Println(false, "") | ||
| output.Println(false, block) | ||
| output.Println(false, "") | ||
| } |
There was a problem hiding this comment.
Would it work for the ticket to log these to -v (warn), at least for the non-shell outputs?
It's only in the human readable output so it's not necessarily an issue, but it does deviate from the usual pattern for CLI outputs.
If we do want these to always be displayed, let's write it to stderr instead.
There was a problem hiding this comment.
Good point on the convention, moved to stderr for the non-shell commands. stdout is now just the table, so redirecting or piping gives you clean data, and -o json/-o yaml are untouched since they carry the warnings in the payload itself.
I left the shell on stdout. Everything there is already conversational output on stdout, including the status messages and the old Details: banner, so splitting only the warnings onto stderr would be inconsistent with the surrounding lines.
On -v: I'd rather not hide them behind a verbosity flag. The requirement for this feature is that all warnings are always shown, which is the whole reason for moving them out of status.detail, so making them opt-in would undo that.
Goldens are unchanged since the integration harness captures combined output.
The CLI showed statement warnings by printing status.detail as a warning banner. That field is a single flat string with no severity, reason, or timestamp, and it gets overwritten during the statement lifecycle, so warnings were short-lived and could not be rendered as a list. Statement warnings are now read from the structured status.warnings array and rendered most severe first, in the SQL shell, on dry runs, and in `confluent flink statement describe` and `create`. Serialized output carries the warnings verbatim under a new `warnings` field, so `-o json` and `-o yaml` consumers get severity, reason, message, and created_at. status.detail is still printed when a statement has no warnings, and always for a failed statement where it holds the failure reason.
4a26984 to
b729b60
Compare
|




Release Notes
New Features
Bug Fixes
Checklist
The CLI only renders the warnings the API returns. Where a statement has no warnings, output is unchanged, so no CLI-side enablement is needed.
What
Applies to Confluent Cloud only. The warnings field is part of the Confluent Cloud Flink statement status. The Confluent Platform on-premises code paths are untouched.
The CLI displayed statement warnings by printing status.detail as a warning banner. That field is a single flat string. It has no severity, no machine-readable reason, and no timestamp, and it is rewritten as a statement moves through its lifecycle. Two consequences for users: warnings vanished from view shortly after submission, and several warnings arrived concatenated into one long line that was hard to read and impossible to render as a list.
Statement warnings are now read from the structured status.warnings array. Each warning is rendered with its severity, reason, and creation time, most severe first:
Notes on the approach:
Blast Radius
Confluent Cloud customers using confluent flink shell, confluent flink statement describe, confluent flink statement create, or confluent flink statement list.
If something goes wrong, the worst case is a display defect: warnings are not shown, are shown in the wrong order, or the Status Detail line is omitted for a statement that has warnings. Statement submission, execution, and results are not touched, so no customer would be blocked from running a statement. Serialized output gains a field and loses none, so existing scripts that parse -o json or -o yaml continue to work.
Confluent Platform on-premises users are unaffected.
References
Test & Review
Automated:
Commands run:
Verified output, human format:
Verified output, -o yaml:
Built and tested locally
Describe output:

From Flink Shell
