-
Notifications
You must be signed in to change notification settings - Fork 494
Raise error-message compliance in dispatch validation and CLI evaluation/logging paths #52173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c0bdded
5f5e38f
85af92b
41fcd10
23ff6cd
7328cd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ func RunWorkflowInteractively(ctx context.Context, opts RunWorkflowOptions) erro | |
|
|
||
| // Check if running in CI environment | ||
| if IsRunningInCI() { | ||
| return errors.New("interactive mode cannot be used in CI environments") | ||
| return errors.New("interactive mode is unavailable in CI environments. Expected an interactive terminal session outside CI, or a workflow name argument. Example: gh aw run daily-perf-improver") | ||
| } | ||
|
|
||
| if opts.Verbose { | ||
|
|
@@ -47,7 +47,7 @@ func RunWorkflowInteractively(ctx context.Context, opts RunWorkflowOptions) erro | |
| } | ||
|
|
||
| if len(workflows) == 0 { | ||
| return errors.New("no runnable workflows found. Workflows must have 'workflow_dispatch' trigger") | ||
| return errors.New("no runnable workflows were found. Expected at least one workflow with 'on: workflow_dispatch'. Example:\non:\n workflow_dispatch: {}") | ||
| } | ||
|
|
||
| // Step 2: Let user select a workflow | ||
|
|
@@ -221,7 +221,7 @@ func selectWorkflowNonInteractive(workflows []WorkflowOption) (*WorkflowOption, | |
| } | ||
|
|
||
| if choice < 1 || choice > len(workflows) { | ||
| return nil, fmt.Errorf("selection out of range (must be 1-%d)", len(workflows)) | ||
| return nil, fmt.Errorf("selection %d is out of range. Expected a number between 1 and %d. Example: enter 1 to select the first workflow", choice, len(workflows)) | ||
| } | ||
|
|
||
| selectedWorkflow := &workflows[choice-1] | ||
|
|
@@ -301,7 +301,7 @@ func collectInputsWithMap(ctx context.Context, inputs map[string]*workflow.Input | |
| if inputDef.Required { | ||
| field = field.Validate(func(s string) error { | ||
| if s == "" { | ||
| return errors.New("this input is required") | ||
| return fmt.Errorf("input '%s' is required. Expected a non-empty value in the interactive prompt. Example: enter a value for '%s' such as my-value", inputName, inputName) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/codebase-design] The required-input validation error repeats 💡 Suggestionreturn fmt.Errorf("input '%s' is required. Expected a non-empty value. Example: my-value", inputName)This stays within the style guide while keeping the prompt-facing message concise. @copilot please address this. |
||
| } | ||
| return nil | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/codebase-design] The
no runnable workflowserror embeds a raw newline and YAML snippet in aerrors.Newstring, which breaks single-line log/error formatting and makes programmatic matching harder.💡 Suggestion
Keep the example concise without embedded newlines, or move multi-line YAML to a separate line using a const:
Note this is consistent with dispatch_workflow_validation.go (compiler output), but interactive CLI errors surfaced via
huhor a terminal prompt often do better without embedded block literals.@copilot please address this.