Skip to content

Fix error message compliance in 5 low-scoring pkg/workflow files - #52178

Merged
pelikhan merged 6 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-one-more-time
Aug 12, 2026
Merged

Fix error message compliance in 5 low-scoring pkg/workflow files#52178
pelikhan merged 6 commits into
mainfrom
copilot/squad-plan-fix-error-message-compliance-one-more-time

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The lint-error-messages workflow flagged five pkg/workflow files as low-compliance with the repo's error-message style guide ([what's wrong]. [what's expected]. [example]), ranging from 0% to 74% compliant. Messages relied on standalone negative wording (invalid, cannot, must, failed) without pairing it with expected behavior or a concrete fix.

Changes

  • schedule_preprocessing.go — reworded schedule/cron/timezone validation errors to state expected format and a concrete example; fixed %w wrapping order so example text no longer sandwiches the wrapped error.
  • trigger_parser.go — reworded trigger shorthand, reaction, command/label conflict, and status-comment validation errors with expected values and examples.
  • repo_config.go — reworded runs_on/auto_upgrade/maintenance parsing, file read/parse/schema, UTC offset, and cron field errors; replaced generic failed to ...: %w wrapping with specific recovery guidance.
  • compiler_custom_jobs.go — reworded job field YAML conversion, step processing, and job structure (needs, if, augmentation) errors to include expected shape and YAML examples.
  • tools_validation_github_integrity_reactions.go — reworded guard-policy validation errors to list valid values and an example.
  • Updated existing test assertions in schedule_preprocessing_test.go, repo_config_test.go, and compiler_custom_jobs_test.go that checked exact substrings of the old error text.

No control flow or behavior changes — message text only.

// before
return fmt.Errorf("invalid cron expression '%s': must have exactly 5 fields (minute hour day-of-month month day-of-week)", parsedCron)

// after
return fmt.Errorf("cron expression '%s' is malformed. Expected exactly 5 fields (minute hour day-of-month month day-of-week), for example: '0 9 * * 1'", parsedCron)

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

Copilot AI and others added 2 commits August 11, 2026 23:31
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 for specified files Fix error message compliance in 5 low-scoring pkg/workflow files Aug 11, 2026
Copilot AI requested a review from pelikhan August 11, 2026 23:34
@pelikhan
pelikhan marked this pull request as ready for review August 11, 2026 23:41
Copilot AI balanced review requested due to automatic review settings August 11, 2026 23:41
@github-actions

github-actions Bot commented Aug 11, 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 11, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Reviewed PR #52178 for over-engineering per ponytail-review skill. This is a text-only change rewording error messages across 5 files for style-guide compliance; no new abstractions, dependencies, or structural complexity introduced. Lean already. Ship.

Generated by Ponytail Reviewer for #52178

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped. This PR updates error message assertions in existing tests to match improved production error text—test maintenance only, not new test coverage.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

No ADR enforcement needed: PR does not have the implementation label and has ≤100 new lines of code in business logic directories (74 additions detected).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 11, 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 mentioned this pull request Aug 11, 2026

@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 improvements look good and follow the project style guide (constructive language, examples, actionable guidance). All test assertions updated correctly to match the new message substrings. No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 35.4 AIC · ⌖ 6.16 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

Rewords workflow validation errors to provide clearer expectations and corrective examples.

Changes:

  • Improves schedule, trigger, repository configuration, custom-job, and integrity-reaction errors.
  • Preserves existing validation control flow.
  • Updates affected test assertions.
Show a summary per file
File Description
pkg/workflow/trigger_parser.go Improves trigger validation messages.
pkg/workflow/tools_validation_github_integrity_reactions.go Revises integrity-reaction errors.
pkg/workflow/schedule_preprocessing.go Clarifies schedule validation failures.
pkg/workflow/schedule_preprocessing_test.go Updates schedule error assertions.
pkg/workflow/repo_config.go Improves repository configuration errors.
pkg/workflow/repo_config_test.go Updates configuration error assertions.
pkg/workflow/compiler_custom_jobs.go Revises custom-job processing errors.
pkg/workflow/compiler_custom_jobs_test.go Updates custom-job error assertions.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (2)

pkg/workflow/compiler_custom_jobs.go:1076

  • The per-entry type error at line 1083 remains in its old noncompliant form even though this collection-level error was updated. Type mismatches require an expected shape and concrete example, so leaving it unchanged prevents the stated 100% compliance for this file.
		return nil, fmt.Errorf("%s for job '%s' expects an array of step objects. Example: %s:\n  - run: echo hello", fieldName, jobName, fieldName)

pkg/workflow/repo_config.go:408

  • This rewritten duplicate-entry error still lacks the Example: section expected by the referenced compliance check, so it remains one of this file's noncompliant messages and prevents the stated 100% result.
				return fmt.Errorf("%s has duplicate maintenance.disabled_jobs entries %q and %q after normalization. Remove the duplicate so each job is listed once", RepoConfigFileName, previous, jobName)
  • Files reviewed: 8/8 changed files
  • Comments generated: 3
  • Review effort level: Balanced

if hasExplicitReactionFields && !featureEnabled {
toolsValidationLog.Printf("Reaction fields present but integrity-reactions feature flag not enabled in workflow: %s", workflowName)
return errors.New("invalid guard policy: 'endorsement-reactions', 'disapproval-reactions', 'disapproval-integrity', and 'endorser-min-integrity' require the 'integrity-reactions' feature flag to be enabled. Add 'features: integrity-reactions: true' to your workflow")
return errors.New("guard policy fields 'endorsement-reactions', 'disapproval-reactions', 'disapproval-integrity', and 'endorser-min-integrity' require the 'integrity-reactions' feature flag. Example: features:\n integrity-reactions: true")
Comment thread pkg/workflow/compiler_custom_jobs.go Outdated
return fmt.Errorf("jobs.%s.needs lists %q, but a job should not depend on itself. Remove the self-reference from needs", configuredJobName, rawNeed)
}
if _, known := allJobs[need]; !known {
return fmt.Errorf("jobs.%s.needs: unknown job %q", configuredJobName, rawNeed)
Comment thread pkg/workflow/repo_config.go Outdated
}
if _, ok := validDisabledMaintenanceJobs[normalizedJobName]; !ok {
return fmt.Errorf("invalid %s: maintenance.disabled_jobs contains unrecognized job %q (valid values: close-expired-entities, apply_safe_outputs, label_disable_agentic_workflow, label_apply_safe_outputs)", RepoConfigFileName, jobName)
return fmt.Errorf("%s references unrecognized maintenance.disabled_jobs entry %q. Valid values are: close-expired-entities, apply_safe_outputs, label_disable_agentic_workflow, label_apply_safe_outputs", RepoConfigFileName, jobName)

@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 — requesting changes on two structural issues and two test-weakening regressions.

📋 Key Themes & Highlights

Issues Found

  1. Multi-line error strings — Several new messages embed literal \n in fmt.Errorf strings (compiler_custom_jobs.go lines 207, 315, 357, 377, 405; schedule_preprocessing.go line 280). Go error strings should be single-line; wrapping or logging these produces garbled output. Use inline prose examples instead.

  2. Inconsistent phrasingcompiler_custom_jobs.go line 606 still uses "must be an object" while line 767 uses the updated "expects an object" — one instance was missed in the sweep.

  3. Weakened test assertion in schedule_preprocessing_test.go — The new substring "schedule expression" (lines 462, 510) is much broader than the old "invalid schedule expression". Any future error containing those words would falsely pass.

  4. Incomplete test for UTC wrapper messagerepo_config_test.go line 425 only asserts the inner NormalizeUTCOffset message, not the new outer wrapper "has an unsupported utc value", leaving the outer message untested.

Positive Highlights

  • ✅ Clean, consistent pattern applied across all five files — the style guide format (what's wrong / expected / example) is well-implemented throughout.
  • ✅ The %w wrapping order fix in schedule_preprocessing.go is a good correctness improvement.
  • ✅ Test file updates are thorough and correctly track the new error substrings in most cases.
  • ✅ PR description is excellent — clear before/after examples and a good summary of the scope.

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

Comments that could not be inline-anchored

pkg/workflow/compiler_custom_jobs.go:207

[/codebase-design] Embedding literal in fmt.Errorf strings produces multi-line Go error messages, violating the idiomatic rule that error strings should be single-line. When wrapped or logged, the embedded newlines cause garbled output.

<details>
<summary>💡 Suggestion</summary>

Use inline prose instead of a YAML block in the example, or build a dedicated hint layer to present formatted examples separately from the error value.

// Instead of:
return fmt.Errorf(&quot;strategy field</details>

<details><summary>pkg/workflow/repo_config.go:307</summary>

**[/codebase-design]** The message &quot;This indicates a bug in gh-aw; please report it&quot; for a schema compilation failure is reasonable, but it would be more actionable if it included a link to the issue tracker or the specific schema symbol, so a user filing a bug report knows what to include.

&lt;details&gt;
&lt;summary&gt;💡 Suggestion&lt;/summary&gt;

```go
return fmt.Errorf(&quot;could not compile the repo config schema: %w. This is a gh-aw bug — please open an issue at https://github.com/github/gh-aw/issues&quot;, err)…

</details>

<details><summary>pkg/workflow/repo_config_test.go:425</summary>

**[/tdd]** The test assertion `require.ErrorContains(t, err, &quot;must be a numeric UTC offset&quot;)` will continue to pass because that substring comes from `NormalizeUTCOffset` in `utc_offset.go` (unchanged), not from the new wrapper message in `repo_config.go`. The wrapper message changed to `&quot;has an unsupported utc value&quot;`, but the test doesn&#39;t assert the new outer message — it only matches the inner error text.

This means the test would still pass even if the outer wrapper were accidentally remov…

</details>

<details><summary>pkg/workflow/schedule_preprocessing_test.go:462</summary>

**[/tdd]** The substring `&quot;schedule expression&quot;` is very broad — it would match any message that happens to contain those two words. The old assertion was `&quot;invalid schedule expression&quot;`, which was more discriminating. Now the test will pass for any error accidentally containing the word &#39;schedule&#39;, making it a weaker regression guard.

&lt;details&gt;
&lt;summary&gt;💡 Suggestion&lt;/summary&gt;

Assert a more specific substring that uniquely identifies the new message, for example:

```go
errorSubstring: &quot;sche…

</details>

<details><summary>pkg/workflow/compiler_custom_jobs.go:606</summary>

**[/codebase-design]** Line 606 still uses `&quot;must be an object&quot;` while line 767 uses the updated `&quot;expects an object&quot;` — inconsistent phrasing within the same file for the same kind of error.

&lt;details&gt;
&lt;summary&gt;💡 Suggestion&lt;/summary&gt;

Update line 606 to match:

```go
return fmt.Errorf(&quot;jobs.%s expects an object, got %T. Example: jobs:
  job-name:
    setup-steps: []&quot;, jobName, jobConfig)

(Though also consider the concern noted at line 207.)
</details>

@copilot please address this.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please address the open review threads below, refresh the branch if needed, and run the pr-finisher skill.

Open review threads (newest first):

Please refresh the branch if GitHub offers it, then run the pr-finisher skill.

Generated by 👨🍳 PR Sous Chef

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

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 open review threads below, refresh the branch if needed, and run the pr-finisher skill.

Open review threads (newest first):...

Addressed all three open review threads:

  • tools_validation_github_integrity_reactions.go: the four remaining guard-policy errors (MCPG version, min-integrity required, endorsement-reactions, disapproval-reactions) now state expected values and include YAML examples.
  • compiler_custom_jobs.go: the jobs.<name>.needs unknown-job error and the pinned-step non-object error now include expected input and a YAML example (the unknown job %q substring is preserved so existing tests still match).
  • repo_config.go: the maintenance.disabled_jobs enum error and the duplicate-entry error now include an Example: YAML block.

Branch is rebased/up to date with origin/main; make agent-report-progress passes.

Copilot AI requested a review from gh-aw-bot August 12, 2026 00:13
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Triage: PR #52178

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

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please address the remaining open review threads below, refresh the branch if GitHub offers it, and run the pr-finisher skill.

Open review threads (newest first):

The current PR author update says these were addressed, but the review threads still appear unresolved. Please either push the remaining fixes or resolve the threads with the reviewer-facing follow-up.

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

…x-error-message-compliance-one-more-time

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 remaining open review threads below, refresh the branch if GitHub offers it, and run the pr-finisher skill.

Open review threads (newest first):...

All three threads were already fixed in commit bcc4bcd and the code is still present on the branch head after the merge with main. The threads are unresolved because the reviewer bot has not re-run, not because code is missing. Current state:

tools_validation_github_integrity_reactions.go — all 7 guard-policy constructors now have expected values + examples (lines 65, 75, 82, 89, 97, 104, 110). The four previously flagged:

  • L75 MCPG version: Example:\ntools:\n github:\n mcp-gateway:\n version: "..."
  • L82 min-integrity: Expected one of: 'unapproved', 'approved', 'merged'. Example:\ntools:\n github:\n min-integrity: approved
  • L89 endorsement-reactions / L97 disapproval-reactions: Expected one of: THUMBS_UP, ... Example:\ntools:\n github:\n endorsement-reactions: [THUMBS_UP]

compiler_custom_jobs.go — L812 jobs.%s.needs: unknown job %q. Expected a job defined in this workflow or a generated built-in job. Example:\njobs:\n %s:\n needs: [activation]; L1083 pinned-step error now states expected shape plus a YAML example. (The unknown job %q prefix is intentionally preserved so builtin_job_needs_integration_test.go:95 and compiler_custom_jobs_test.go:539 keep matching.)

repo_config.go — L405 enum error and L408 duplicate error both end with Example:\nmaintenance:\n disabled_jobs:\n - close-expired-entities.

Branch refreshed against latest main; go build ./..., targeted pkg/workflow tests, and make agent-report-progress all pass.

@pelikhan
pelikhan merged commit 4fda6ec into main Aug 12, 2026
@pelikhan
pelikhan deleted the copilot/squad-plan-fix-error-message-compliance-one-more-time branch August 12, 2026 01:21
@github-actions

Copy link
Copy Markdown
Contributor

Hey 👋 — thanks for this error message compliance fix! This is a well-scoped chore that improves consistency across the codebase.

What's working well:

This looks ready for review.

Generated by ✅ Contribution Check · auto · 51.1 AIC · ⌖ 2.96 AIC · ⊞ 8.8K ·

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

Projects

None yet

4 participants