fix(deps): bump cmf-sdk-go v0.0.5 to v0.0.7 and handle breaking changes#3333
fix(deps): bump cmf-sdk-go v0.0.5 to v0.0.7 and handle breaking changes#3333Paras Negi (paras-negi-flink) wants to merge 3 commits intomainfrom
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 CLI’s CMF integration to use github.com/confluentinc/cmf-sdk-go v0.0.7 and adapts the on-prem Flink commands/tests to two upstream breaking model changes (ComputePool status becoming an untyped map; PostEnvironment name becoming a pointer).
Changes:
- Bump
cmf-sdk-gofrom v0.0.5 → v0.0.7 (and updatego.mod/go.sumaccordingly). - Add
extractComputePoolPhasehelper to readstatus["phase"]from the new untypedComputePool.Statusand use it in on-prem compute-pool list/describe/create + local conversion. - Update environment create/update paths (client + test server + commands) to use
PostEnvironment.Nameas*stringvia&environmentNamewrites andGetName()reads; add unit tests for phase extraction.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/test-server/flink_onprem_handler.go | Adjust test-server models to match SDK pointer/name and status-map changes. |
| pkg/flink/cmf_rest_client.go | Switch PostEnvironment name reads to GetName(); fix UpdateEnvironment godoc. |
| internal/flink/command_environment_create.go | Set PostEnvironment.Name as *string. |
| internal/flink/command_environment_update.go | Set PostEnvironment.Name as *string. |
| internal/flink/command_compute_pool.go | Add extractComputePoolPhase and update local conversion to use it. |
| internal/flink/command_compute_pool_list_onprem.go | Use extractComputePoolPhase instead of typed status access. |
| internal/flink/command_compute_pool_describe_onprem.go | Use extractComputePoolPhase instead of typed status access. |
| internal/flink/command_compute_pool_create_onprem.go | Use extractComputePoolPhase for Phase output. |
| internal/flink/command_compute_pool_test.go | Add table-driven tests for extractComputePoolPhase. |
| go.mod / go.sum | Dependency bump for cmf-sdk-go. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Name: sdkComputePool.GetMetadata().Name, | ||
| Type: sdkComputePool.GetSpec().Type, |
There was a problem hiding this comment.
In the human output table, Name and Type are taken from the input (sdkComputePool) while CreationTime/Phase come from the server response (sdkOutputComputePool). This can print incorrect values if the server defaulted/normalized fields; it’s also inconsistent with describe/list which print response data. Prefer using sdkOutputComputePool for Name and Type as well.
| Name: sdkComputePool.GetMetadata().Name, | |
| Type: sdkComputePool.GetSpec().Type, | |
| Name: sdkOutputComputePool.GetMetadata().Name, | |
| Type: sdkOutputComputePool.GetSpec().Type, |
There was a problem hiding this comment.
This is a valid concern.
33f07a3 to
ba18b99
Compare
| Name: sdkComputePool.GetMetadata().Name, | ||
| Type: sdkComputePool.GetSpec().Type, |
There was a problem hiding this comment.
This is a valid concern.
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
|
|
||
| srsdk "github.com/confluentinc/schema-registry-sdk-go" |
There was a problem hiding this comment.
It looks like we have merging conflict for this file, can we fix that?
v0.0.7 introduces two breaking changes that needed CLI adaptation:
1. ComputePool.Status is now *map[string]interface{} (flattened from the
earlier v0.0.6 nested map shape). Phase is no longer a typed struct
field - callers read it from the untyped status map. Added
extractComputePoolPhase helper used by the 4 compute-pool command
sites; a non-string "phase" value (server/schema contract violation)
is logged at debug level.
2. PostEnvironment.Name is now *string. Writes use &name; reads use the
SDK-generated nil-safe GetName() accessor.
Also fixes a pre-existing godoc typo on UpdateEnvironment.
…d phase-extraction test Addresses review feedback on #3333: - Read Name/Type from sdkOutputComputePool so create matches describe/list and the human/serialized outputs agree on what was actually persisted. - Add table-driven unit test for extractComputePoolPhase covering nil status, missing key, nil/string/empty/non-string phase values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9e95400 to
0b22a62
Compare
| // A missing or nil value is treated as "phase not yet populated" and returns "". A | ||
| // present value that isn't a string indicates a server/schema contract violation and | ||
| // is logged at debug level. | ||
| func extractComputePoolPhase(pool cmfsdk.ComputePool) string { |
There was a problem hiding this comment.
Are we expecting similar *map[string]interface{} as a general data struct for future CMF development?
We have an ongoing initiative to automate the CP CMF CLI source code generation, and your team doesn't need to spend time on the standard CRUDL feature development anymore, so we'd like to have the custom functions as few as possible.
Can we explore ways to make this function more generic so that we can try to generate it whenever we have a need to extract certain key from a map?
There was a problem hiding this comment.
Agreed, it's realistically the only practical way to surface controller-driven values, and patterns like these will pop up from time to time.
Generalized to pkg/flink.GetMapField so auto-gen has a single helper to target.
….GetMapField
cmf-sdk-go v0.0.7 represents 9+ K8s/FKO-style fields as map[string]any
(Environment.Status, ApplicationInstanceStatus.Spec, FlinkApplicationAllOf
.{Metadata,Spec,Status}, ComputePoolDefaults, etc.). The pattern will
recur as more CMF resources surface controller-driven status.
Lift the compute-pool-specific extraction into a generic, type-parameterized
helper available CMF-wide. Replaces the local extractComputePoolPhase logic
with a one-line wrapper. Tests moved alongside the helper and expanded to
cover string, int64, nested map, and slice value types.
The auto-gen tooling for the CP CMF CLI can target this signature directly
when emitting accessors for untyped fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|




Release Notes
Breaking Changes
New Features
Bug Fixes
confluent flink compute-pool list/describe/createon Confluent Platform, which had been broken by an upstreamcmf-sdk-gov0.0.6 schema regression that causedComputePool.statusto fail to decode.Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
This PR bumps
github.com/confluentinc/cmf-sdk-gofrom v0.0.5 → v0.0.7 and adapts the CLI to two breaking type changes the new SDK introduces. Targets Confluent Platform / CP Flink (CMF on-prem).ComputePool.Status:*ComputePoolStatus→*map[string]interface{}Phaseis no longer a struct field — it's an entry in the map.extractComputePoolPhase(pool)helper ininternal/flink/command_compute_pool.go, used by the 4 consumer sites (convertSdkComputePoolToLocalComputePool,_create_onprem,_describe_onprem,_list_onprem).phasevalue (server/schema contract violation) is logged at debug level vialog.CliLogger.Debugf— matches the existingpkg/featureflags/feature_flags.gopattern.PostEnvironment.Name:string→*string&name. Reads use the SDK-generated nil-safeGetName()accessor (pkg/flink/cmf_rest_client.go,test/test-server/flink_onprem_handler.go).Drive-bys:
UpdateEnvironment("Create an environment" → "updates an existing environment").gciimport-ordering violation inpkg/schemaregistry/schema_test.go(from fix: use --normalize flag value when registering schemas #3332) — was blocking lint on this branch.Blast Radius
ComputePool.StatusorPostEnvironment.Name:confluent flink compute-pool {list,describe,create}andconfluent flink environment {create,update}.Phase(helper returns""for any non-string value; debug log fires for unexpected types).nameif the helper logic regresses; current code reads from a required CLI positional, so the field is always populated in practice.References
Test & Review
Environment
confluentinc/clibump-cmf-sdk-v0.0.7github.com/confluentinc/cmf-sdk-go v0.0.7cmf-service(kubectl port-forward svc/cmf-service 9090:80)Automated
go build ./...cleango vet ./...cleango test ./internal/flink/...passesgo test ./pkg/flink/...— only pre-existing flakeTestInteractiveOutputControllerTestSuite/TestCloseTableViewOnUserInput(unrelated to SDK; UI-input test)Manual CLI validation
Attached in the comment below.