Skip to content

Ability to submit Flink statements in snapshot mode. - #3425

Open
James Robinson (jlrobins) wants to merge 5 commits into
mainfrom
submit_flink_snapshot_query
Open

Ability to submit Flink statements in snapshot mode.#3425
James Robinson (jlrobins) wants to merge 5 commits into
mainfrom
submit_flink_snapshot_query

Conversation

@jlrobins

@jlrobins James Robinson (jlrobins) commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for submitting Flink statements in bounded "snapshot" (batch) mode instead of the
default continuous "streaming" mode, via the CCloud REST API's sql.snapshot.mode: "now"
statement property.

  • New FlinkSnapshotMode enum (BATCH / STREAMING) and a FlinkStatement.mode getter that
    reads the mode back off a statement's spec.properties (New property mode in FlinkStatement #1849)
  • submitFlinkStatement() accepts an optional snapshotMode and sets sql.snapshot.mode: "now"
    on the request when submitting in batch mode (Accept FlinkSnapshotMode optarg when submitting new flink statements #1850)
  • New CodeLens toggle ("Mode: Streaming" / "Mode: Snapshot") on Flink SQL documents, backed by a
    new toggleSnapshotModeForUriCommand and a UriMetadataKeys.FLINK_SNAPSHOT_MODE metadata key,
    following the existing compute-pool/database CodeLens pattern (New codelens widget for toggling between batch vs streaming mode (?) #1853)
  • The chosen mode is per-document, persists like the other CodeLens settings (compute pool,
    catalog/database), and defaults to streaming when unset; "Clear Settings" resets it too
  • Added snapshot_mode to the existing Flink statement submission telemetry

Part of the batch-mode-queries epic (#1848). Follow-up work — surfacing the mode in the
statement tooltip (#1851) and the results viewer (#1852) — is intentionally out of scope here
and will land in a separate PR; the results viewer works unmodified for snapshot-mode statements
today.

While Here

  • .vscode/launch.json: added --disable-extension confluentinc.vscode-confluent to the "Run
    Extension" debug config so the marketplace-installed copy of this extension doesn't
    double-activate alongside the local --extensionDevelopmentPath build during F5 debugging.
  • .claude/rules/testing/unit-tests.md: documented a macOS-specific npx gulp test failure mode
    seen on newer VS Code test-host builds (e.g. 1.131.0) — @vscode/test-electron@2.3.9 expects an
    Electron binary that some releases ship renamed to Code, and the local ln -s workaround for
    that invalidates the app bundle's code signature, requiring an ad hoc re-sign. Both are dev-loop
    fixes only; nothing in the gitignored .vscode-test/ cache is committed.

Test plan

  • npx gulp check
  • npx gulp lint
  • npx gulp test — new/updated unit tests in:
    • src/models/flinkStatement.test.ts (mode getter)
    • src/flinkSql/statementUtils.test.ts (submitFlinkStatement property wiring,
      setFlinkDocumentMetadata)
    • src/commands/documents.test.ts (toggleSnapshotModeForUriCommand, updated reset test)
    • src/codelens/flinkSqlProvider.test.ts (new toggle lens, getSnapshotModeFromMetadata)
  • Manually submit a statement with the toggle in each mode and confirm sql.snapshot.mode
    appears (or doesn't) in the submitted statement's properties in CCloud

Relationships

Closes #1849
Closes #1850
Closes #1853

Part of epic #1848

Screenshots

  1. Default streaming mode.
Screenshot 2026-08-04 at 2 22 27 PM
  1. Switched to snapshot mode.
Screenshot 2026-08-04 at 2 17 30 PM

No changes (yet) to the results viewer, although the snapshot mode statement auto-evolves to COMPLETED state when done. No need to manually stop it. The remaining open tickets in the epic will adjust the results viewer page.

Copilot AI lite review requested due to automatic review settings August 4, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds per-document support for submitting Confluent Cloud Flink SQL statements in bounded “snapshot” (batch) mode by wiring sql.snapshot.mode: "now" through statement submission and a new Flink SQL CodeLens toggle, plus telemetry and supporting tests.

Changes:

  • Introduces FlinkSnapshotMode and a FlinkStatement.mode getter derived from spec.properties["sql.snapshot.mode"].
  • Extends submitFlinkStatement() to accept snapshotMode and conditionally set sql.snapshot.mode: "now" for batch execution; persists the chosen mode per-document via URI metadata and a new CodeLens toggle/command.
  • Adds unit tests for the new behavior, plus small developer-experience updates (launch.json, test docs).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/testResources/flinkStatement.ts Extends test fixture to optionally include sql.snapshot.mode when creating statements.
src/storage/constants.ts Adds UriMetadataKeys.FLINK_SNAPSHOT_MODE for per-document mode persistence.
src/models/flinkStatement.ts Adds FlinkSnapshotMode enum and FlinkStatement.mode getter derived from statement properties.
src/models/flinkStatement.test.ts Adds unit tests for FlinkStatement.mode behavior (absent/now/unknown values).
src/flinkSql/statementUtils.ts Wires snapshotMode into statement submission properties and persists snapshot mode into URI metadata.
src/flinkSql/statementUtils.test.ts Adds tests for snapshot-mode property wiring and metadata setting.
src/commands/flinkStatements.ts Passes snapshot mode into submission and includes it in submission telemetry.
src/commands/documents.ts Adds toggleSnapshotModeForUriCommand, resets snapshot mode in “Clear Settings”, and registers the new command.
src/commands/documents.test.ts Adds unit tests for the new toggle command and updates reset expectations.
src/codelens/flinkSqlProvider.ts Adds “Mode: Streaming/Snapshot” CodeLens and metadata reader helper.
src/codelens/flinkSqlProvider.test.ts Adds tests for the new CodeLens and getSnapshotModeFromMetadata().
.vscode/launch.json Prevents double-activation by disabling the marketplace-installed extension during F5 debugging.
.claude/rules/testing/unit-tests.md Documents a macOS-specific local test-host workaround for newer VS Code builds.

Comment thread src/flinkSql/statementUtils.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@jlrobins
James Robinson (jlrobins) marked this pull request as ready for review August 4, 2026 18:40
@jlrobins
James Robinson (jlrobins) requested a review from a team as a code owner August 4, 2026 18:40
@jlrobins James Robinson (jlrobins) changed the title Ability to sumbit Flink statements in snapshot mode. Ability to submit Flink statements in snapshot mode. Aug 4, 2026
@jlrobins
James Robinson (jlrobins) enabled auto-merge (squash) August 5, 2026 20:12
@sonarqube-confluent

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

2 participants