Skip to content

Raise error-message compliance in dispatch validation and CLI evaluation/logging paths - #52173

Closed
pelikhan with Copilot wants to merge 6 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance
Closed

Raise error-message compliance in dispatch validation and CLI evaluation/logging paths#52173
pelikhan with Copilot wants to merge 6 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This PR addresses low compliance reported by lint-error-messages in five targeted files by normalizing validation/operator-facing errors to the repository style guide: what failed, what is expected, and a concrete example. Scope is limited to message text and closely-coupled assertions.

  • dispatch-workflow validation messaging (pkg/workflow/dispatch_workflow_validation.go)

    • Rewrote empty workflow list, self-reference, and missing workflow_dispatch errors to include expected config shape and actionable YAML examples.
    • Preserved existing validation flow and aggregation behavior.
  • dispatch_repository validation messaging (pkg/workflow/dispatch_repository_validation.go)

    • Reworked missing tool/target and repository format errors into structured, example-driven guidance.
    • Clarified allowed allowed_repositories entry format in error text to match runtime validation behavior.
  • Interactive run UX errors (pkg/cli/run_interactive.go)

    • Upgraded CI-mode, no-runnable-workflows, selection-range, and required-input messages with explicit expected input and user-facing examples aligned to interactive prompt semantics.
  • Outcome evaluation input validation (pkg/cli/outcome_eval.go)

    • Updated endpoint and repo-shape validation errors to include normalized expectations and examples.
    • Improved unsupported GraphQL variable-type error with explicit accepted type set.
  • Logs command option validation (pkg/cli/logs_command.go)

    • Reworded invalid --runtime / --engine and --report-file flag-combination errors to include supported values and concrete command examples.
    • Added defensive example fallback for runtime message construction.
  • Focused assertion updates (targeted tests only)

    • Adjusted existing tests in CLI/workflow suites to assert new message shape/content where assertions depended on prior wording.

Example of the new style used across the touched paths:

return fmt.Errorf(
  "invalid runtime value %q. Expected one of: %s. Example: --runtime %s",
  runtime,
  strings.Join(validRuntimes, ", "),
  exampleRuntime,
)

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 26.3 AIC · ⌖ 6.42 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Copilot AI and others added 2 commits August 11, 2026 23:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error message compliance in five files Raise error-message compliance in dispatch validation and CLI evaluation/logging paths Aug 12, 2026
Copilot AI requested a review from pelikhan August 12, 2026 00:05
@pelikhan
pelikhan marked this pull request as ready for review August 12, 2026 00:19
Copilot AI balanced review requested due to automatic review settings August 12, 2026 00:19
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #52173 does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (82 additions detected, threshold is 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship. This PR only rewrites validator/CLI error message strings to the repo style guide (what failed/expected/example) and updates matching test assertions. No new abstractions, dependencies, or reinvented logic introduced — nothing to cut.

Generated by Ponytail Reviewer for #52173

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The error-message compliance improvements look good. All changes consistently follow the Expected ... Example: pattern, include the invalid value with '' for clarity, and have thorough test coverage for each updated message. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 16.3 AIC · ⌖ 6.17 AIC · ⊞ 5.4K

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves validation and CLI error messages with clearer expectations and actionable examples.

Changes:

  • Reworks dispatch validation messages.
  • Improves interactive-run, outcome-evaluation, and logs-command errors.
  • Updates focused message assertions.
Show a summary per file
File Description
pkg/workflow/dispatch_workflow_validation.go Improves dispatch-workflow errors.
pkg/workflow/dispatch_workflow_validation_test.go Updates message assertions.
pkg/workflow/dispatch_repository_validation.go Improves repository dispatch errors.
pkg/workflow/dispatch_repository_test.go Extends error assertions.
pkg/cli/run_interactive.go Improves interactive-run errors.
pkg/cli/run_interactive_test.go Adds CI error coverage.
pkg/cli/outcome_eval.go Improves endpoint and input errors.
pkg/cli/outcome_eval_test.go Updates endpoint assertions.
pkg/cli/logs_command.go Improves option-validation errors.
pkg/cli/logs_command_test.go Adds message-shape tests.

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/cli/run_interactive.go Outdated
// 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. Example: run 'gh aw run --interactive' from your local terminal")

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /codebase-design and /tdd — commenting with a few refinement suggestions, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Embedded newlines in CLI errors: run_interactive.go embeds a raw YAML block literal in a errors.New string, which is fine for compiler output but can look awkward in interactive/terminal error contexts.
  • Internal function name leaked: buildGraphQLArgs received... exposes an internal identifier in a user-facing error.
  • Alternative Example: label: Deviates from the consistent Example: convention enforced across the rest of the PR.
  • Conditional style assertion: The assertStyle bool guard in outcome_eval_test.go weakens regression protection; all error rows should unconditionally assert the new style.
  • Redundant inputName in prompt error: The interactive required-input message repeats the input name twice without added value.

Positive Highlights

  • ✅ Consistent what failed / Expected / Example: pattern applied across all five files.
  • ✅ Defensive fallback for exampleRuntime/exampleEngine guards against empty-slice panics.
  • ✅ New focused tests in logs_command_test.go and run_interactive_test.go pin the new message shape cleanly.
  • ✅ No validation logic was altered — purely a message quality improvement.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 38.2 AIC · ⌖ 6.93 AIC · ⊞ 7K
Comment /matt to run again


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: {}")

Copy link
Copy Markdown
Contributor

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 workflows error embeds a raw newline and YAML snippet in a errors.New string, 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:

return errors.New("no runnable workflows were found. Expected at least one workflow with \"on: workflow_dispatch\". Example: on:\n  workflow_dispatch: {}")

Note this is consistent with dispatch_workflow_validation.go (compiler output), but interactive CLI errors surfaced via huh or a terminal prompt often do better without embedded block literals.

@copilot please address this.

Comment thread pkg/cli/outcome_eval.go Outdated
args = append(args, "-F", fmt.Sprintf("%s=%v", name, value))
default:
return nil, fmt.Errorf("buildGraphQLArgs: unsupported variable type %T for key %q", value, name)
return nil, fmt.Errorf("buildGraphQLArgs received unsupported variable type %T for key %q. Expected string, int, int32, int64, or bool values. Example: map[string]any{\"number\": 42}", value, name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/codebase-design] The new error message starts with buildGraphQLArgs received unsupported variable type — exposing the internal function name buildGraphQLArgs in a user-facing error. The previous message had the same issue, but now it is more prominent with the verbose prefix.

💡 Suggestion

Leave internal function names out of user-facing errors. Prefer describing the problem in terms the caller understands:

return nil, fmt.Errorf("unsupported variable type %T for GraphQL key %q. Expected string, int, int32, int64, or bool. Example: map[string]any{\"number\": 42}", value, name)

@copilot please address this.


if !hasRepository && !hasAllowedRepos {
repoErr := fmt.Errorf("dispatch_repository: tool %q must specify either 'repository' or 'allowed_repositories'\n\nExample with single repository:\n dispatch_repository:\n %s:\n workflow: %s\n event_type: %s\n repository: org/target-repo\n\nExample with multiple repositories:\n dispatch_repository:\n %s:\n workflow: %s\n event_type: %s\n allowed_repositories:\n - org/repo1\n - org/repo2", toolKey, toolKey, tool.Workflow, tool.EventType, toolKey, tool.Workflow, tool.EventType)
repoErr := fmt.Errorf("dispatch_repository tool %q has no repository target. Expected either 'repository' or 'allowed_repositories'. Example:\n dispatch_repository:\n %s:\n workflow: %s\n event_type: %s\n repository: org/target-repo\nAlternative Example:\n dispatch_repository:\n %s:\n workflow: %s\n event_type: %s\n allowed_repositories:\n - org/repo1\n - org/repo2", toolKey, toolKey, tool.Workflow, tool.EventType, toolKey, tool.Workflow, tool.EventType)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/codebase-design] The error uses Alternative Example: as a second example label — this deviates from the rest of the PR which consistently uses a single Example: marker. Operators and linters looking for the style-guide Example: keyword will find this inconsistent.

💡 Suggestion

Use a single Example: label, showing a concise dual-variant summary inline:

repoErr := fmt.Errorf("dispatch_repository tool %q has no repository target. Expected either 'repository' or 'allowed_repositories'. Example: repository: org/target-repo", toolKey)

The YAML block for multiple repos can be kept but should use the same Example: label rather than Alternative Example:.

@copilot please address this.

Comment thread pkg/cli/outcome_eval_test.go Outdated
{name: "leading slash rejected", endpoint: "/issues/comments/123", wantErr: "must not start"},
{name: "dotdot segment rejected", endpoint: "issues/../comments/123", wantErr: "must not contain"},
{name: "leading slash rejected", endpoint: "/issues/comments/123", wantErr: "must not start", assertStyle: true},
{name: "dotdot segment rejected", endpoint: "issues/../comments/123", wantErr: "must not contain", assertStyle: true},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] The new assertStyle bool field in the test table is used to conditionally check Expected and Example: — but all error-path rows in this PR now follow the new style. This guard flag adds complexity without protecting anything: if a future message regresses to the old style, the flag would hide the failure.

💡 Suggestion

Assert the style markers unconditionally on all error cases, removing the assertStyle field:

if tt.wantErr != "" {
    require.Error(t, err)
    require.ErrorContains(t, err, tt.wantErr)
    require.ErrorContains(t, err, "Expected")
    require.ErrorContains(t, err, "Example:")
}

This makes the test a stronger specification and guards against future regressions.

@copilot please address this.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/codebase-design] The required-input validation error repeats inputName twice in the format string (input '%s' is required ... enter a value for '%s' such as my-value). The second repetition adds noise without new information and makes the message longer than it needs to be in a tight interactive prompt.

💡 Suggestion
return 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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Test Quality Sentinel 🧪 — PR #52173 Analysis

Repository: github/gh-aw
PR: #52173 — "Raise error-message compliance in dispatch validation and CLI evaluation/logging paths"
Actor: pelikhan

Overview

This PR adds 5 new test functions across 5 test files to validate error-message compliance. All tests follow the error-message style guide: error messages must include "Expected" descriptors and "Example:" blocks.

Tests added: 5 behavioral tests (error-message validation)
Test inflation ratio: 0.67 (54 test lines / 81 production lines) ✅
Build tags: All 5 files have correct (go/redacted):build !integration tag ✅


Test Inventory

File Tests Added Type Status
pkg/cli/logs_command_test.go 3 new +29 lines Error message validation
pkg/cli/outcome_eval_test.go 1 modified +15 lines Error message validation (expanded)
pkg/cli/run_interactive_test.go 1 new +10 lines Error message validation
pkg/workflow/dispatch_repository_test.go 2 modified +4 lines Error message assertions added
pkg/workflow/dispatch_workflow_validation_test.go 1 modified 0 net lines String assertion updated

Quality Summary

Scoring

design_tests / total_new_tests = 8 / 8 = 1.0 → 40 points
tests_with_edge_cases / total = 8 / 8 = 1.0 → 30 points
duplicate_clusters = 0 → 20 points
inflation_ratio = 0.67 ≤ 2:1 → 10 points

Total: 40 + 30 + 20 + 10 = 100

Test Quality Score: 100/100 ✅ Excellent

Implementation test ratio: 0/8 = 0% (threshold: 30%) ✅

Compliance

  • ✅ All tests include descriptive assertion messages
  • ✅ All test files have correct build tags ((go/redacted):build !integration)
  • ✅ No Go mock libraries detected
  • ✅ No forbidden mock violations
  • ✅ All 8 test cases are behavioral contract tests validating error-message compliance
  • ✅ Zero duplicated test patterns
  • ✅ Well-proportioned test additions (0.67 test:prod ratio)

Key Findings

All tests validate critical design invariants — Each test ensures error messages comply with the established style guide ("Expected" + "Example:" markers)

High-value error coverage — Tests enforce compliance across 5 different validation functions (runtime, engine, report flags, repository format, empty tools, CI detection)

No inflation or duplication — Clean test addition with no bloated or redundant test patterns

Recommendation

✅ APPROVE — This PR demonstrates exemplary test quality. All new tests validate critical design invariants with comprehensive error-path coverage, zero duplicates, and proper proportioning. The 100/100 score reflects strict adherence to error-message compliance standards.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please address the latest review feedback, refresh the branch if GitHub offers it, and run the pr-finisher skill.

Open review items (newest first):

  • Matt Pocock Skills Reviewer called out several message-shape follow-ups: avoid leaking internal helper names in user-facing errors, keep labels aligned with the repo-wide Example: convention, and strengthen the tests so the new style assertions are unconditional.
  • copilot-pull-request-reviewer left a comment review; please inspect and address any remaining inline guidance from that review before finishing.

Please push a follow-up commit and resolve any addressed review threads.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 26.3 AIC · ⌖ 6.42 AIC · ⊞ 8.5K ·
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Triage: PR #52173

Generated by 🔧 PR Triage Agent · auto · 44.5 AIC · ⌖ 2.66 AIC · ⊞ 7.8K ·

Copilot AI and others added 2 commits August 12, 2026 00:55
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please address the latest review feedback, refresh the branch if GitHub offers it, and run the pr-finisher skill.

Open review items (newest first):...

Addressed in the latest commits:

  • Fixed the CI-mode interactive mode cannot be used error at the actual reachable path (cmd/gh-aw/main.go's run guard), replacing the invalid --interactive example with gh aw run <workflow-name>; also updated pkg/cli/run_interactive.go's message for consistency.
  • Removed the leaked internal helper name (buildGraphQLArgs) from the GraphQL variable-type error in pkg/cli/outcome_eval.go.
  • Replaced the non-standard "Alternative Example:" label with the repo-wide Example: convention in pkg/workflow/dispatch_repository_validation.go.
  • Made the TestValidateAPIEndpoint style assertions unconditional (removed the assertStyle flag).
  • Added a CLI-level regression test exercising the CI-mode run guard, tightened per code_review feedback to assert the distinguishing message text.
  • Fixed pre-existing staticcheck violations in call_workflow_validation.go that were blocking the build gate.

Branch is up to date with main and all changes are pushed.

Copilot AI requested a review from gh-aw-bot August 12, 2026 00:57
@pelikhan pelikhan closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants