Skip to content

update flink statement warnings UI based on new response structure#3254

Draft
Noel Cothren (noeldevelops) wants to merge 22 commits intomainfrom
ncothren/3067-statement-warnings
Draft

update flink statement warnings UI based on new response structure#3254
Noel Cothren (noeldevelops) wants to merge 22 commits intomainfrom
ncothren/3067-statement-warnings

Conversation

@noeldevelops
Copy link
Member

@noeldevelops Noel Cothren (noeldevelops) commented Feb 3, 2026

Summary of Changes

  • Display statement warnings that are returned with new API
  • Preserves legacy format for statement warnings inside of Details, but prefers new warnings structure when available
  • Rearranges the way error, info, warnings details are surfaced in the Statement Results Viewer header section & simplifies the HTML/CSS for this element
  • Closes Integrate new Statement Warnings feature #3067

Click-testing instructions

Changes are visible in the VS Code Flink Statement Results viewer when there are Statement Details, Errors, or Warnings. There are detailed testing scenarios for the internal team in shared docs.

To test the new warnings API, check this branch out locally and change the .env file variable to point to Staging, where the feature flag is enabled. You will need to have an account on Staging with Flink compute pool running.

IDE_SIDECAR_CONNECTIONS_CCLOUD_BASE_PATH=stag.cpdev.cloud

  1. Run a Flink statement that you know will produce a warning or error to see the new UI elements
  2. OR Stop a statement that is running to see the Info message "This statement was stopped manually."
  3. OR, mock some warnings in flink-statement-results.ts file. Set this.hasWarnings to true & add an array of mocks e.g.
 this.formattedWarnings = this.derive(() => {
      const mockWarnings = [ {
          severity: "LOW",
          message: "This is a low severity warning for testing purposes.",
          reason: "LOW_SEVERITY_TEST",
          createdAt: "2025-11-14T15:00:00Z",
          isCritical: false,
        }, ...

Optional: Any additional details or context that should be provided?

  • Feature flag for the new warnings API is not flipped yet; we'll stay backward compatible for the time being
  • ⚠️ Note: not all these boxes will be shown at once -- normally just 1 or two items returned
Light
light
Dark
dark

Pull request checklist

Please check if your PR fulfills the following (if applicable):

Tests

  • Added new
  • Updated existing
  • Deleted existing

Release notes

  • Does anything in this PR need to be mentioned in the user-facing CHANGELOG?

@airlock-confluentinc airlock-confluentinc bot force-pushed the ncothren/3067-statement-warnings branch from 741864d to 99f59ae Compare February 25, 2026 17:54
@noeldevelops Noel Cothren (noeldevelops) changed the title [WIP] #3067 statement warnings api #3067 statement warnings api Mar 3, 2026
@noeldevelops Noel Cothren (noeldevelops) changed the title #3067 statement warnings api [#3067] update statement warnings UI based on new response structure Mar 3, 2026
@noeldevelops Noel Cothren (noeldevelops) changed the title [#3067] update statement warnings UI based on new response structure update flink statement warnings UI based on new response structure Mar 3, 2026
Copilot AI review requested due to automatic review settings March 3, 2026 20:34
@noeldevelops Noel Cothren (noeldevelops) review requested due to automatic review settings March 3, 2026 20:34
Clarifies that the type assertion should be removed once the OpenAPI
spec includes the warnings field on statement status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove hasWarnings, hasCriticalWarnings, and formattedWarnings signals
that were not referenced in the template or elsewhere. Inline the
formatting logic directly into the detailItems derivation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Merge identical .detail-item.error/.detail-item.critical and
.detail-severity.error/.detail-severity.critical rules into
combined selectors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
detailText was only consumed by detailItems, making it an unnecessary
intermediate signal. Inline the logic to simplify the reactive graph.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 3, 2026 21:54
@airlock-confluentinc airlock-confluentinc bot force-pushed the ncothren/3067-statement-warnings branch from 4660052 to 22ba7e8 Compare March 3, 2026 21:54
@noeldevelops Noel Cothren (noeldevelops) review requested due to automatic review settings March 3, 2026 21:54
Copilot AI review requested due to automatic review settings March 3, 2026 22:09
@noeldevelops Noel Cothren (noeldevelops) review requested due to automatic review settings March 3, 2026 22:09
Copilot AI review requested due to automatic review settings March 3, 2026 22:15
@noeldevelops Noel Cothren (noeldevelops) review requested due to automatic review settings March 3, 2026 22:15
Copilot AI review requested due to automatic review settings March 3, 2026 23:03
@noeldevelops Noel Cothren (noeldevelops) review requested due to automatic review settings March 3, 2026 23:03
@noeldevelops Noel Cothren (noeldevelops) marked this pull request as ready for review March 3, 2026 23:08
@noeldevelops Noel Cothren (noeldevelops) requested a review from a team as a code owner March 3, 2026 23:08
Copilot AI review requested due to automatic review settings March 3, 2026 23:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Flink Statement Results webview to surface statement warnings using the new structured warnings field from the getSqlv1Statement response, while remaining backward compatible with legacy [Warning] text embedded in status.detail.

Changes:

  • Add warning parsing utilities to prefer structured API warnings and fall back to legacy [Warning] parsing.
  • Extend statement models/results manager/webview view model to pass warnings through to the results viewer.
  • Refactor results viewer “details/warnings” header UI into a unified list with updated HTML/CSS rendering.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/webview/flink-statement-results.ts Builds a unified detailItems list combining error/info detail text with structured/legacy warnings.
src/webview/flink-statement-results.html Reworks the header details UI to render multiple detail items with severity styling.
src/models/flinkStatement.ts Adds a warnings getter that extracts structured warnings or parses legacy detail warnings.
src/flinkSql/warningParser.ts New helper module to parse legacy warnings, prefer structured warnings, and strip [Warning] blocks from detail.
src/flinkSql/warningParser.test.ts Unit tests for warning parsing/extraction/stripping behavior.
src/flinkSql/flinkStatementResultsManager.ts Includes statement warnings in the data returned to the webview.
src/flinkSql/flinkStatementResultsManager.test.ts Updates expected statement meta to include warnings.

You can also share your feedback on Copilot code review. Take the survey.

@noeldevelops Noel Cothren (noeldevelops) marked this pull request as draft March 5, 2026 14:50
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member Author

@noeldevelops Noel Cothren (noeldevelops) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude wrote & posted this :)
"Self-review: found a few items to address."

if (rawDetail) {
const hasApiWarnings = meta.warnings.length > 0;
const processedDetail = hasApiWarnings ? stripWarningsFromDetail(rawDetail) : rawDetail;
detail = processedDetail ? processedDetail.replace(/\n/g, "<br>") : null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: This replaces newlines with literal <br> HTML tags, but the template now uses data-text (not data-html), so users will see the string <br> rendered as visible text. Since .detail-message has white-space: pre-wrap, newlines are already preserved — this .replace() call should be removed.

if (!detail) {
return null;
}
const warningPattern = /\[Warning\]\s*[\s\S]*?(?=\s*\[Warning\]|$)/gi;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY: This regex is a near-duplicate of the one in parseLegacyWarnings (line 28). Consider extracting a shared constant so both functions reference the same pattern.

severity: w.severity,
message: w.message,
reason: w.reason,
createdAt: w.created_at ? String(w.created_at) : undefined,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: String(w.created_at) on a Date produces the verbose format like Thu Nov 14 2025 16:01:00 GMT+0000 (Coordinated Universal Time). Consider using .toLocaleString() or .toISOString() for a cleaner timestamp display.

…ate format

- Remove .replace(/\n/g, "<br>") since data-text + pre-wrap handles newlines
- Extract duplicated legacy warning regex into shared LEGACY_WARNING_PATTERN
- Use .toLocaleString() instead of String() for warning timestamps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqube-confluent
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
72.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate new Statement Warnings feature

2 participants