Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/confluentinc/cli/v4/internal/connect"
"github.com/confluentinc/cli/v4/internal/context"
ccl "github.com/confluentinc/cli/v4/internal/custom-code-logging"
idebug "github.com/confluentinc/cli/v4/internal/debug"
"github.com/confluentinc/cli/v4/internal/environment"
"github.com/confluentinc/cli/v4/internal/feedback"
"github.com/confluentinc/cli/v4/internal/flink"
Expand Down Expand Up @@ -117,6 +118,7 @@ func NewConfluentCommand(cfg *config.Config) *cobra.Command {
cmd.AddCommand(configuration.New(cfg, prerunner))
cmd.AddCommand(connect.New(cfg, prerunner))
cmd.AddCommand(context.New(prerunner))
cmd.AddCommand(idebug.New(prerunner))
cmd.AddCommand(environment.New(prerunner))
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Registering an intentionally crashing command on the main CLI root means any user who discovers it can force a panic (and potentially generate crash telemetry noise when logged into Confluent Cloud). Consider gating this command behind an explicit opt-in (env var / build tag / feature flag) or adding a confirmation flag so it can’t be triggered accidentally.

Suggested change
cmd.AddCommand(environment.New(prerunner))
if os.Getenv("CONFLUENT_ENABLE_UNSAFE_ENVIRONMENT_COMMAND") == "1" {
cmd.AddCommand(environment.New(prerunner))
}

Copilot uses AI. Check for mistakes.
Comment on lines 118 to 122
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

PR description release notes still contain placeholders (Breaking Changes / New Features / Bug Fixes). If this change is intended to ship, please replace placeholders with an appropriate entry (or remove the unused sections) to keep release notes accurate.

Copilot uses AI. Check for mistakes.
cmd.AddCommand(feedback.New(prerunner))
cmd.AddCommand(flink.New(cfg, prerunner))
Expand Down
25 changes: 25 additions & 0 deletions internal/debug/command.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package debug

import (
"github.com/spf13/cobra"

pcmd "github.com/confluentinc/cli/v4/pkg/cmd"
)

type command struct {
*pcmd.CLICommand
}

func New(prerunner pcmd.PreRunner) *cobra.Command {
cmd := &cobra.Command{
Use: "debug",
Short: "Debug utilities for internal testing.",
Hidden: true,
}

c := &command{CLICommand: pcmd.NewAnonymousCLICommand(cmd, prerunner)}

cmd.AddCommand(c.newPanicCommand())

return cmd
}
19 changes: 19 additions & 0 deletions internal/debug/command_panic.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package debug

import (
"github.com/spf13/cobra"
)

func (c *command) newPanicCommand() *cobra.Command {
return &cobra.Command{
Use: "panic",
Short: "Trigger a test panic for crash reporting validation.",
Long: "Trigger a test panic to validate the crash reporting pipeline; note that panic traces are only collected and reported when logged in to Confluent Cloud.",
Args: cobra.NoArgs,
RunE: c.panic,
}
}

func (c *command) panic(_ *cobra.Command, _ []string) error {
Comment on lines +13 to +17
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The method name panic is a predeclared identifier in Go and will be flagged by the repo’s enabled predeclared golangci-lint check. Rename this handler to something like triggerPanic/runPanic and update the RunE reference accordingly so linting passes and the intent is clearer.

Suggested change
RunE: c.panic,
}
}
func (c *command) panic(_ *cobra.Command, _ []string) error {
RunE: c.triggerPanic,
}
}
func (c *command) triggerPanic(_ *cobra.Command, _ []string) error {

Copilot uses AI. Check for mistakes.
panic("test panic")
}