Skip to content

fix: error in ci when interactive inputs are required#468

Open
zimeg wants to merge 1 commit intomainfrom
zimeg-fix-ci-prompt-hangs
Open

fix: error in ci when interactive inputs are required#468
zimeg wants to merge 1 commit intomainfrom
zimeg-fix-ci-prompt-hangs

Conversation

@zimeg
Copy link
Copy Markdown
Member

@zimeg zimeg commented Apr 3, 2026

Changelog

Errors will appear sooner in CI and scripting setups if interactive input or a confirmation is requested. This guards against waiting until a timeout.

Summary

This PR fixes an error in CI when interactive inputs are required.

Preview

Login command

login

Update command

update

Reviewers

$ slack create | cat  # No change
$ slack login | cat   # Now errors
$ slack update | cat  # Now errors

Notes

  • Some prompts don't have flag substitutes at this time but either might not have a required input or might need a flag option. This is saved for follow up PR but aligns more with the style guides:

### Prompts are Flags with Forms
When information is needed we can prompt for text, confirmation, or a selection.
These decisions can be made in an interactive terminal (TTY) or not, such as in a scripting environment.
A flag option should exist for each prompt with a form fallback. Either default values should be used if forms are attempted in a non-TTY setup or an error and remmediation to use a flag should be returned.

Requirements

@zimeg zimeg added this to the Next Release milestone Apr 3, 2026
@zimeg zimeg self-assigned this Apr 3, 2026
@zimeg zimeg requested a review from a team as a code owner April 3, 2026 05:39
@zimeg zimeg added bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment labels Apr 3, 2026
Copy link
Copy Markdown
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

🦠 More comments to the kind reviewers!

Comment on lines +216 to +218
if !io.IsTTY() {
return nil, errInteractivityFlags(MultiSelectPromptConfig{})
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🔬 note: Here is the implementation of this function, with a default for no flags:

// errInteractivityFlags formats an error for when flag substitutes are needed
func errInteractivityFlags(cfg PromptConfig) error {
flags := cfg.GetFlags()
var remediation string
var helpMessage = "Learn more about this command with `--help`"
if len(flags) == 1 {
remediation = fmt.Sprintf("Try running the command with the `--%s` flag included", flags[0].Name)
helpMessage = "Learn more about this flag with `--help`"
} else if len(flags) > 1 {
var names []string
for _, flag := range flags {
names = append(names, flag.Name)
}
flags := strings.Join(names, "`\n `--")
remediation = fmt.Sprintf("Consider using the following flags when running this command:\n `--%s`", flags)
helpMessage = "Learn more about these flags with `--help`"
}
return slackerror.New(slackerror.ErrPrompt).
WithDetails(slackerror.ErrorDetails{
slackerror.ErrorDetail{Message: "The input device is not a TTY or does not support interactivity"},
}).
WithRemediation("%s\n%s", remediation, helpMessage)
}

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.09%. Comparing base (5ee9e10) to head (3215666).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #468      +/-   ##
==========================================
+ Coverage   71.03%   71.09%   +0.05%     
==========================================
  Files         220      220              
  Lines       18522    18530       +8     
==========================================
+ Hits        13158    13173      +15     
+ Misses       4185     4178       -7     
  Partials     1179     1179              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented changelog Use on updates to be included in the release notes semver:patch Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant