Skip to content

[APIE-989] Initial generated code for Symphony control plane APIs (Don't Merge)#3331

Open
Channing Dong (channingdong) wants to merge 1 commit intomainfrom
APIE-989
Open

[APIE-989] Initial generated code for Symphony control plane APIs (Don't Merge)#3331
Channing Dong (channingdong) wants to merge 1 commit intomainfrom
APIE-989

Conversation

@channingdong
Copy link
Copy Markdown
Contributor

Release Notes

Breaking Changes

  • PLACEHOLDER

New Features

  • PLACEHOLDER

Bug Fixes

  • PLACEHOLDER

Checklist

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

What

Blast Radius

References

Test & Review

Copilot AI review requested due to automatic review settings April 23, 2026 00:29
@channingdong Channing Dong (channingdong) requested a review from a team as a code owner April 23, 2026 00:29
@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Comment thread go.mod
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This line will be removed after the rtce APIs SDK are made available to the public.

Copy link
Copy Markdown

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

Introduces initial generated CLI and client support for Symphony/RTCE control plane APIs, including RTCE regions and RTCE topic CRUD, plus corresponding test-server routes and tests.

Changes:

  • Add RTCE API client wiring and list/create/get/update/delete helpers in pkg/ccloudv2.
  • Add confluent rtce command group with region list and rtce-topic subcommands.
  • Add test-server handlers/routes and new integration/live tests for RTCE commands.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
pkg/ccloudv2/client.go Wires an RTCE SDK client into the shared v2 client.
pkg/ccloudv2/rtce.go Adds RTCE API wrapper methods (topics + regions).
internal/command.go Registers the new rtce top-level command group.
internal/rtce/* Implements RTCE CLI commands (regions + rtce-topic CRUD + autocomplete).
test/test-server/ccloudv2_router.go Registers RTCE routes in the test server.
test/test-server/region_handler.go Adds test-server handler for RTCE regions.
test/test-server/rtce_topic_handler.go Adds test-server handlers for RTCE topics endpoints.
test/region_test.go Adds integration tests for rtce region list.
test/rtce_topic_test.go Adds integration tests for rtce rtce-topic commands.
test/live/region_live_test.go Adds live test for RTCE region listing.
test/live/rtce_topic_live_test.go Adds live CRUD test for RTCE topics.
go.mod Adds RTCE SDK dependency (currently with a local replace).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +82 to +86
func (c *rtceTopicCommand) autocompleteRtceTopics() []string {
rtceTopics, err := c.V2Client.ListRtceTopics("", "", "", "")
if err != nil {
return nil
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This autocomplete implementation calls ListRtceTopics with empty environment/cluster, even though the normal list/describe/delete flows derive these from the current CLI context. That likely makes autocomplete return no suggestions (errors are swallowed) when the backend requires those scopes. Fetch environment + kafka cluster from context (like other autocomplete helpers do) and pass them through.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +26
// Variables
regionName := uniqueName("region")

// Cleanup (LIFO)

steps := []CLILiveTest{
{
Name: "List rtce regions",
Args: "rtce region list",
UseStateVars: true,
ExitCode: 0,
Contains: []string{regionName},
},
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

regionName is randomly generated but never used to create a region; asserting Contains: []string{regionName} will be flaky/always fail against real environments. Either assert on a known region value (from config) or remove the Contains check and only validate exit code/output structure.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@channingdong Channing Dong (channingdong) Apr 30, 2026

Choose a reason for hiding this comment

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

This is a live test specific issue, we will address it in the upcoming commits.

Comment on lines +16 to +21
cmd := &cobra.Command{
Use: "create",
Short: "Create a rtce topic.",
Args: cobra.NoArgs,
RunE: c.create,
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The command is configured with cobra.NoArgs, but the tests/live tests invoke rtce rtce-topic create <name> .... As written, the CLI will error on the extra positional arg. Update the command to accept the positional identifier (e.g., Use: "create <topic-name>" + cobra.ExactArgs(1)) and plumb the arg into the create request, or update the tests to match the no-arg UX.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be no-arg, we need to update the corresponding tests/live tests.

Comment thread test/rtce_topic_test.go
Comment on lines +4 to +6
tests := []CLITest{
{args: "rtce rtce-topic create test-name --cloud aws --description \"Customer orders table for real-time analytics\" --region us-west-2 --topic-name orders_topic", fixture: "rtce/rtce-topic/create.golden"},
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

These integration tests reference golden fixtures under test/fixtures/output/rtce/..., but that directory/files do not exist in the repository right now. Add the corresponding golden files (and any required input fixtures) or the tests will fail at runtime.

Copilot uses AI. Check for mistakes.
Comment thread test/region_test.go
Comment on lines +4 to +8
tests := []CLITest{
{args: "rtce region list", fixture: "rtce/region/list.golden"},
{args: "rtce region list --region us-east-2", fixture: "rtce/region/list-region.golden"},
{args: "rtce region list -o json", fixture: "rtce/region/list-json.golden"},
{args: "rtce region list -o yaml", fixture: "rtce/region/list-yaml.golden"},
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

These integration tests reference golden fixtures under test/fixtures/output/rtce/..., but that directory/files do not exist in the repository right now. Add the corresponding golden files (and any required input fixtures) or the tests will fail at runtime.

Copilot uses AI. Check for mistakes.
Comment on lines +72 to +75
switch topic_name {
case "invalid":
w.WriteHeader(http.StatusNotFound)
default:
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

For consistency with other test-server handlers (and to match CLI error parsing), the invalid-resource path should write a structured error body (e.g., via writeResourceNotFoundError(w)) rather than only setting a 404 status with an empty body.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +46
topic_name := mux.Vars(r)["topic_name"]
switch r.Method {
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

Use Go-style camelCase for local variables. topic_name is inconsistent with the rest of this package (e.g., most handlers use id, envId, etc.). Rename to topicName for readability.

Copilot uses AI. Check for mistakes.
Comment thread go.mod
Comment on lines +292 to +293

replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This replace points to a developer-local absolute path. It will break builds for everyone else and must not be committed. Remove the replace (or replace it with a repo-relative path / published module version) before merging.

Suggested change
replace github.com/confluentinc/ccloud-sdk-go-v2/rtce => /Users/channingdong/git/go/src/github.com/confluentinc/cli-terraform-generator/test-suites/specs/rtce

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We will replace this with official SDK soon, not a concern here.

Comment on lines +82 to +85
func readRtceV1RtceTopicFile(t *testing.T, filename string) rtcev1.RtceV1RtceTopic {
jsonPath := filepath.Join("..", "fixtures", "input", "rtce", "rtce_topic", filename)
jsonData, err := os.ReadFile(jsonPath)
require.NoError(t, err)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This handler reads RTCE topic fixtures from test/fixtures/input/rtce/..., but that fixtures directory/files are not present in the repo. Add the fixtures (and ensure the relative path matches the test runner working directory) or the test server will panic/fail when the endpoint is hit.

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +35
func readRtceV1RegionFile(t *testing.T, filename string) rtcev1.RtceV1Region {
jsonPath := filepath.Join("..", "fixtures", "input", "rtce", "region", filename)
jsonData, err := os.ReadFile(jsonPath)
require.NoError(t, err)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This handler reads RTCE region fixtures from test/fixtures/input/rtce/..., but that fixtures directory/files are not present in the repo. Add the fixtures (and ensure the relative path matches the test runner working directory) or the test server will panic/fail when the endpoint is hit.

Copilot uses AI. Check for mistakes.
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.

2 participants