Add panic command for internal testing purposes#3310
Add panic command for internal testing purposes#3310Steven Gagniere (sgagniere) wants to merge 2 commits intomainfrom
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds a new hidden confluent debug command group intended for internal testing, with a subcommand that intentionally panics to help validate the CLI panic/crash reporting flow.
Changes:
- Introduces a hidden top-level
debugcommand underinternal/debug. - Adds
confluent debug panicwhich triggers an intentional panic. - Registers the new
debugcommand on the root CLI command tree.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/debug/command.go | Adds hidden debug command group and wires subcommands. |
| internal/debug/command_panic.go | Implements panic subcommand to intentionally crash the CLI. |
| internal/command.go | Registers the new debug command on the root command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RunE: c.panic, | ||
| } | ||
| } | ||
|
|
||
| func (c *command) panic(_ *cobra.Command, _ []string) error { |
There was a problem hiding this comment.
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.
| RunE: c.panic, | |
| } | |
| } | |
| func (c *command) panic(_ *cobra.Command, _ []string) error { | |
| RunE: c.triggerPanic, | |
| } | |
| } | |
| func (c *command) triggerPanic(_ *cobra.Command, _ []string) error { |
| cmd.AddCommand(connect.New(cfg, prerunner)) | ||
| cmd.AddCommand(context.New(prerunner)) | ||
| cmd.AddCommand(idebug.New(prerunner)) | ||
| cmd.AddCommand(environment.New(prerunner)) |
There was a problem hiding this comment.
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.
| cmd.AddCommand(environment.New(prerunner)) | |
| if os.Getenv("CONFLUENT_ENABLE_UNSAFE_ENVIRONMENT_COMMAND") == "1" { | |
| cmd.AddCommand(environment.New(prerunner)) | |
| } |
| 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)) |
There was a problem hiding this comment.
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.
Release Notes
Breaking Changes
New Features
Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
Add a new hidden command whose only purpose is to cause a panic.
Blast Radius
References
Test & Review